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.
Message flags.
See https://zulip.com/api/update-message-flags#available-flags.
type t = private {
id : int;
sender_id : int;
sender_email : string;
sender_full_name : string;
recipients : recipients;
content : string;
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 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.
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.