Use PresenceState from ruma_common, deprecate SetPresence
This commit is contained in:
parent
9fb2c42f06
commit
5365ee3afe
@ -15,7 +15,12 @@ Breaking changes:
|
|||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
* Add method `into_event_content` for `r0::room::create_room::CreationContent`
|
* Add method `into_event_content` for `r0::room::create_room::CreationContent`
|
||||||
* Add room visibility endpoints: `r0::directory::{get_room_visibility, set_room_visibility}`.
|
* Add room visibility endpoints: `r0::directory::{get_room_visibility, set_room_visibility}`.
|
||||||
|
|
||||||
|
Deprecations:
|
||||||
|
|
||||||
|
* `r0::sync::sync_events::SetPresence` has been renamed to `PresenceState`. It is still available
|
||||||
|
under its previous name, but only for one release.
|
||||||
|
|
||||||
# 0.9.0
|
# 0.9.0
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ edition = "2018"
|
|||||||
http = "0.2.1"
|
http = "0.2.1"
|
||||||
js_int = { version = "0.1.5", features = ["serde"] }
|
js_int = { version = "0.1.5", features = ["serde"] }
|
||||||
ruma-api = "0.16.1"
|
ruma-api = "0.16.1"
|
||||||
ruma-common = "0.1.2"
|
ruma-common = "0.1.3"
|
||||||
ruma-events = { git = "https://github.com/ruma/ruma-events", rev = "7395f94" }
|
ruma-events = { git = "https://github.com/ruma/ruma-events", rev = "7395f94" }
|
||||||
ruma-identifiers = "0.16.2"
|
ruma-identifiers = "0.16.2"
|
||||||
ruma-serde = "0.2.2"
|
ruma-serde = "0.2.2"
|
||||||
|
@ -51,7 +51,7 @@ ruma_api! {
|
|||||||
/// Controls whether the client is automatically marked as online by polling this API.
|
/// Controls whether the client is automatically marked as online by polling this API.
|
||||||
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub set_presence: SetPresence,
|
pub set_presence: PresenceState,
|
||||||
|
|
||||||
/// The maximum time to poll in milliseconds before returning this request.
|
/// The maximum time to poll in milliseconds before returning this request.
|
||||||
#[serde(
|
#[serde(
|
||||||
@ -98,25 +98,10 @@ ruma_api! {
|
|||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether to set presence or not during sync.
|
pub use ruma_common::presence::PresenceState;
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "lowercase")]
|
|
||||||
pub enum SetPresence {
|
|
||||||
/// Do not set the presence of the user calling this API.
|
|
||||||
Offline,
|
|
||||||
|
|
||||||
/// Mark client as online explicitly. Assumed by default.
|
#[deprecated = "use `PresenceState` instead"]
|
||||||
Online,
|
pub use self::PresenceState as SetPresence;
|
||||||
|
|
||||||
/// Mark client as being idle.
|
|
||||||
Unavailable,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for SetPresence {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Online
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A filter represented either as its full JSON definition or the ID of a saved filter.
|
/// A filter represented either as its full JSON definition or the ID of a saved filter.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
@ -344,7 +329,7 @@ mod tests {
|
|||||||
|
|
||||||
use matches::assert_matches;
|
use matches::assert_matches;
|
||||||
|
|
||||||
use super::{Filter, Request, SetPresence};
|
use super::{Filter, PresenceState, Request};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn serialize_all_params() {
|
fn serialize_all_params() {
|
||||||
@ -352,7 +337,7 @@ mod tests {
|
|||||||
filter: Some(Filter::FilterId("66696p746572".into())),
|
filter: Some(Filter::FilterId("66696p746572".into())),
|
||||||
since: Some("s72594_4483_1934".into()),
|
since: Some("s72594_4483_1934".into()),
|
||||||
full_state: true,
|
full_state: true,
|
||||||
set_presence: SetPresence::Offline,
|
set_presence: PresenceState::Offline,
|
||||||
timeout: Some(Duration::from_millis(30000)),
|
timeout: Some(Duration::from_millis(30000)),
|
||||||
}
|
}
|
||||||
.try_into()
|
.try_into()
|
||||||
@ -395,7 +380,7 @@ mod tests {
|
|||||||
assert_matches!(req.filter, Some(Filter::FilterId(id)) if id == "myfilter");
|
assert_matches!(req.filter, Some(Filter::FilterId(id)) if id == "myfilter");
|
||||||
assert_eq!(req.since, Some("myts".into()));
|
assert_eq!(req.since, Some("myts".into()));
|
||||||
assert_eq!(req.full_state, false);
|
assert_eq!(req.full_state, false);
|
||||||
assert_eq!(req.set_presence, SetPresence::Offline);
|
assert_eq!(req.set_presence, PresenceState::Offline);
|
||||||
assert_eq!(req.timeout, Some(Duration::from_millis(5000)));
|
assert_eq!(req.timeout, Some(Duration::from_millis(5000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +403,7 @@ mod tests {
|
|||||||
assert_matches!(req.filter, None);
|
assert_matches!(req.filter, None);
|
||||||
assert_eq!(req.since, None);
|
assert_eq!(req.since, None);
|
||||||
assert_eq!(req.full_state, false);
|
assert_eq!(req.full_state, false);
|
||||||
assert_eq!(req.set_presence, SetPresence::Online);
|
assert_eq!(req.set_presence, PresenceState::Online);
|
||||||
assert_eq!(req.timeout, None);
|
assert_eq!(req.timeout, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +430,7 @@ mod tests {
|
|||||||
assert_matches!(req.filter, Some(Filter::FilterId(id)) if id == "EOKFFmdZYF");
|
assert_matches!(req.filter, Some(Filter::FilterId(id)) if id == "EOKFFmdZYF");
|
||||||
assert_eq!(req.since, None);
|
assert_eq!(req.since, None);
|
||||||
assert_eq!(req.full_state, false);
|
assert_eq!(req.full_state, false);
|
||||||
assert_eq!(req.set_presence, SetPresence::Online);
|
assert_eq!(req.set_presence, PresenceState::Online);
|
||||||
assert_eq!(req.timeout, Some(Duration::from_millis(0)));
|
assert_eq!(req.timeout, Some(Duration::from_millis(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user