#[non_exhaustive]pub enum OutboundEvent {
NewMessage {
chat_id: Id,
message_id: Id,
sender_msg_id: Id,
},
Retract {
chat_id: Id,
message_id: Id,
sender_msg_id: Id,
},
Edit {
chat_id: Id,
message_id: Id,
sender_msg_id: Id,
},
ReactionUpdate {
chat_id: Id,
message_id: Id,
sender_msg_id: Id,
sender_reaction_id: String,
action: ReactionAction,
},
GroupUpdate {
chat_id: Id,
action: GroupUpdateAction,
recipients: Vec<Id>,
},
Receipt {
chat_id: Id,
message_id: Id,
sender_msg_id: Id,
sender_id: Id,
read_at: UTCDate,
read_disposition: Option<ReadDisposition>,
},
Typing {
chat_id: Id,
typing: bool,
},
Presence,
}Expand description
One outbound event the Message/set, Chat/set, Chat/typing or
PresenceStatus/set handler reports.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NewMessage
The owner created a Message. draft-atwood-jmap-chat-00
§Message/set: the server sets the server-assigned fields “then
enqueues the message for outbound delivery” (Peer/deliver
message). Reported after the Message is written; the payload
fields are read from the stored Message.
Fields
Retract
The owner set deletedForAll: true on a Message they sent.
draft-atwood-jmap-chat-federation-00 §Peer/retract “Sender
Behavior”: “the server MUST send Peer/retract to the server of
every other participant in the Chat.” Reported after the update is
written; the payload fields are read from the stored Message
before the update.
Fields
Edit
The owner edited a Message’s body, bodyType, mentions or
broadcastMentions. draft-atwood-jmap-chat-00 §Editing a Message:
“Send Peer/deliver carrying an edit payload to all recipients”.
Reported after the edit is written; the payload fields are read
from the stored Message.
Fields
ReactionUpdate
The owner added or removed one of their reactions on a Message.
draft-atwood-jmap-chat-00 §Adding and Removing Reactions: the
server “MUST propagate the reaction to all recipients via
Peer/deliver reactionUpdate payload, carrying the
senderReactionId as the map key”, and a removal “using the same
senderReactionId”. Reported after the update is written, one
event per reactions/<senderReactionId> patch key.
Fields
action: ReactionActionreactionUpdate.action.
GroupUpdate
A group Chat was created or changed (Peer/groupUpdate), reported
after the change is written.
Fields
action: GroupUpdateActionWhat changed (Peer/groupUpdate action).
recipients: Vec<Id>ChatContact ids of the members to notify, per
draft-atwood-jmap-chat-00 §Chat/set (see each
GroupUpdateAction variant). Never contains the accountId.
Receipt
The owner set a non-null readAt on a Message another participant
sent. draft-atwood-jmap-chat-federation-00 §Peer/receipt: readAt
“SHOULD be present when the recipient’s owner has read the
message”. Reported after the update is written, and only when the
owner’s effective receipt-sharing preference is true: “If the
effective preference is false, the server SHOULD NOT invoke
Peer/receipt” (§Peer/receipt “Sender Behavior”). The read fields
and the sender are carried here because a burnOnRead Message is
gone once read.
Fields
message_id: IdThe Message’s local id. Under burnOnRead the Message has been
hard-deleted by the time the event is reported.
sender_id: IdThe Message’s senderId: the ChatContact id of its original
sender, whose identity is the Peer/receipt recipientUserId
(“the message’s original sender”).
read_disposition: Option<ReadDisposition>Peer/receipt readDisposition, as stored: "displayed" when
the patch set readAt without it.
Typing
The owner called Chat/typing. draft-atwood-jmap-chat-00
§Chat/typing: the server SHOULD deliver a typing push event to
each local participant other than the owner and, “For federated
Chats, the server SHOULD invoke Peer/typing” on each remote
participant’s home server. Reported after the request is validated;
the event is never stored. The per-recipient checks belong to the
receiving side (see should_deliver_typing).
Presence
The owner changed presence, statusText or statusEmoji.
draft-atwood-jmap-chat-federation-00 §Peer/subscribePresence
(jmap-chat-spec b1cd625 L1049): the server “MAY push subsequent
Peer/presence calls to the subscriber whenever the subscribed
user’s presence, statusText, or statusEmoji changes; each
carries the subscribed user’s identity in identity and the
subscriberId in recipientUserId”. Here the subscribed user is
the owner, so each push sends the owner’s ownerUserId as
identity and one subscriber as recipientUserId. Reported after a
PresenceStatus/set update that names any of the three is written;
the payload is read from the stored PresenceStatus, and the
subscribers are the backend’s.