Skip to main content

ruma_events/presence/
persistent.rs

1//! Types for the `m.presence.persistent` account data key.
2//!
3//! This account data type is defined in [MSC4532].
4//!
5//! [MSC4532]: https://github.com/matrix-org/matrix-spec-proposals/pull/4532
6
7use ruma_common::presence::{PresenceState, PresenceStatus};
8use ruma_macros::EventContent;
9use serde::{Deserialize, Serialize};
10
11/// The content of the `m.presence.persistent` account data key.
12///
13/// This uses the unstable prefix defined in [MSC4532].
14///
15/// [MSC4532]: https://github.com/matrix-org/matrix-spec-proposals/pull/4532
16#[derive(Clone, Default, Debug, Deserialize, Serialize, EventContent)]
17#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
18#[ruma_event(type = "org.continuwuity.presence_v2.msc4532.presence.persistent", kind = GlobalAccountData)]
19pub struct PresencePersistentEventContent {
20    /// A persistent global override for the user's presence state.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub state_override: Option<PresenceState>,
23
24    /// The user's extensible status.
25    #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
26    pub status: PresenceStatus,
27}