Skip to main content

register_chat_conditional

Function register_chat_conditional 

Source
pub fn register_chat_conditional<B>(
    dispatcher: &mut Dispatcher<B::CallerCtx>,
    backend: Arc<B>,
)
where B: ChatBackend + ConditionalBackend + 'static,
Expand description

Opt this crate’s registered Foo/set methods in to draft-ietf-jmap-conditional-02 (ifUnchangedBy and atomic; docs/design/DECISIONS.md decisions 1 and 17).

Call after register_chat_handlers. Attaches SetSupport to each of Chat/set, Message/set, Space/set, ChatContact/set, ReadPosition/set, SpaceInvite/set, SpaceBan/set, ChatBan/set, CustomEmoji/set and PresenceStatus/set that is registered, and skips the rest; no handler is re-registered. For PushSubscription/set, call jmap_server::register_push_subscription_conditional too.

The dispatcher reads preconditions through each type’s /get and runs each call in the scope backend opens (ConditionalBackend::begin_set). Under atomic that scope must hold back outbound federation and lifecycle effects until commit and check cross-object constraints (CustomEmoji names, the push subscription cap) against the final state; the memory backend does. Advertise urn:ietf:params:jmap:conditional only once Dispatcher::conditional_ready is true for the whole dispatcher.