mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
plugins/roster: Subscription is now an enum
This commit is contained in:
parent
5e58956408
commit
5e5086e2ef
1 changed files with 3 additions and 3 deletions
|
@ -77,7 +77,7 @@ impl RosterPlugin {
|
|||
|
||||
// TODO: use a better error type.
|
||||
pub fn send_roster_set(&self, to: Option<Jid>, item: Item) -> Result<(), String> {
|
||||
if item.subscription.is_some() && item.subscription != Some(Subscription::Remove) {
|
||||
if item.subscription != Subscription::Remove {
|
||||
return Err(String::from("Subscription must be either nothing or Remove."));
|
||||
}
|
||||
let iq = Iq {
|
||||
|
@ -117,10 +117,10 @@ impl RosterPlugin {
|
|||
let mut jids = self.jids.lock().unwrap();
|
||||
let previous = jids.insert(item.jid.clone(), item.clone());
|
||||
if previous.is_none() {
|
||||
assert!(item.subscription != Some(Subscription::Remove));
|
||||
assert!(item.subscription != Subscription::Remove);
|
||||
self.proxy.dispatch(RosterPush::Added(item));
|
||||
} else {
|
||||
if item.subscription == Some(Subscription::Remove) {
|
||||
if item.subscription == Subscription::Remove {
|
||||
self.proxy.dispatch(RosterPush::Removed(item));
|
||||
} else {
|
||||
self.proxy.dispatch(RosterPush::Modified(item));
|
||||
|
|
Loading…
Reference in a new issue