package ozulip

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The Message module represents the content of "message" events returned by Zulip's real-time events API.

type flag =
  1. | Read
  2. | Starred
  3. | Collapsed
  4. | Mentioned
  5. | Wildcard_mentioned
  6. | Has_alert_word
  7. | Historical
type recipients =
  1. | Stream of int * string
    (*

    Stream (stream_id, topic)

    *)
  2. | Private of int list
    (*

    Private user_ids

    *)

Message recipients

type t = private {
  1. id : int;
  2. sender_id : int;
  3. sender_email : string;
  4. sender_full_name : string;
  5. recipients : recipients;
  6. content : string;
  7. flags : flag list;
}

The type of messages.

val content : t -> string

Returns the message's content as a string.

val sender_mention : ?silent:bool -> t -> string

Returns a mention (or silent mention) of the message's sender.

val sender_destination : t -> Messages.destination

Returns a Messages.destination for privately replying to the sender.

val destination : t -> Messages.destination

Returns the message's destination as a Messages.destination.

val has_flag : flag -> t -> bool

Tests whether a message has the given message flag.

val is_trusted : ?trusted_ids:int list -> ?trusted_emails:string list -> t -> bool

Determines whether a message should be trusted.

Messages sent by users that are *either* in the trusted_ids or trusted_emails lists are considered as trusted.

If none of trusted_ids and trusted_emails is provided (or if both lists are empty), no message will be trusted.

val is_own_message : Ozulip__.Config.config -> t -> bool

Returns whether the message was sent by the current user.

val is_selfmsg : t -> bool

Returns whether the message is a self-message, i.e. a message in a conversation between the current user and themselves.

Note that this is different from is_own_message: all "selfmsg" are sent by the current user (i.e. is_own_message is true), but the current user can send messages in conversations involving other users (in which case is_own_message would be true but is_selfmsg would be false).

val is_privmsg : t -> bool

Returns whether the message is in a private conversation with exactly two users.

Note that what OZulip calls a "privmsg" here is not the same as what Zulip calls a "private" message, because Zulip's "private" message can also be group conversations with many users.

val is_groupmsg : t -> bool

Returns whether the message is in a private *group* conversation.

Messages sent to a stream are never "groupmsg", and neither are private messages with two members or less.

val reply : ?privmsg:bool -> ?mention:bool -> Ozulip__.Config.config -> t -> string -> (int, int * string option) Lwt_result.t

Reply to a message.

  • parameter privmsg

    Determines how to reply to commands. By default, replies are sent to the same stream that the command was sent to. If privmsg is true, the replies are always sent as private message to the user initiating the command instead.

  • parameter mention

    By default, a mention of the sender is added to the reply. If mention is set false, no such mention will be added. Mentions are never added in private messages.

val replyf : ?privmsg:bool -> ?mention:bool -> Ozulip__.Config.config -> t -> ('a, Format.formatter, unit, (int, int * string option) Lwt_result.t) format4 -> 'a

replyf calls reply with a pretty-printed string argument.

replyf conf msg "Here is a quote: %s" quote does the same thing as reply conf msg (Format.asprintf "Here is a quote: %s" quote) but is more convenient.

OCaml

Innovation. Community. Security.