Add presence module
This commit is contained in:
parent
1696c47430
commit
a79c3d51e0
@ -12,6 +12,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
matches = "0.1.8"
|
matches = "0.1.8"
|
||||||
ruma-serde = "0.2.1"
|
ruma-serde = "0.2.2"
|
||||||
serde = { version = "1.0.110", features = ["derive"] }
|
serde = { version = "1.0.111", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.53", features = ["raw_value"] }
|
serde_json = { version = "1.0.53", features = ["raw_value"] }
|
||||||
|
strum = { version = "0.18.0", features = ["derive"] }
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
pub mod presence;
|
||||||
pub mod push;
|
pub mod push;
|
||||||
|
23
src/presence.rs
Normal file
23
src/presence.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use strum::{Display, EnumString};
|
||||||
|
|
||||||
|
/// A description of a user's connectivity and availability for chat.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Display, EnumString, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
#[strum(serialize_all = "snake_case")]
|
||||||
|
pub enum PresenceState {
|
||||||
|
/// Disconnected from the service.
|
||||||
|
Offline,
|
||||||
|
|
||||||
|
/// Connected to the service.
|
||||||
|
Online,
|
||||||
|
|
||||||
|
/// Connected to the service but not available for chat.
|
||||||
|
Unavailable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for PresenceState {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::Online
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user