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.
|
// TODO: use a better error type.
|
||||||
pub fn send_roster_set(&self, to: Option<Jid>, item: Item) -> Result<(), String> {
|
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."));
|
return Err(String::from("Subscription must be either nothing or Remove."));
|
||||||
}
|
}
|
||||||
let iq = Iq {
|
let iq = Iq {
|
||||||
|
@ -117,10 +117,10 @@ impl RosterPlugin {
|
||||||
let mut jids = self.jids.lock().unwrap();
|
let mut jids = self.jids.lock().unwrap();
|
||||||
let previous = jids.insert(item.jid.clone(), item.clone());
|
let previous = jids.insert(item.jid.clone(), item.clone());
|
||||||
if previous.is_none() {
|
if previous.is_none() {
|
||||||
assert!(item.subscription != Some(Subscription::Remove));
|
assert!(item.subscription != Subscription::Remove);
|
||||||
self.proxy.dispatch(RosterPush::Added(item));
|
self.proxy.dispatch(RosterPush::Added(item));
|
||||||
} else {
|
} else {
|
||||||
if item.subscription == Some(Subscription::Remove) {
|
if item.subscription == Subscription::Remove {
|
||||||
self.proxy.dispatch(RosterPush::Removed(item));
|
self.proxy.dispatch(RosterPush::Removed(item));
|
||||||
} else {
|
} else {
|
||||||
self.proxy.dispatch(RosterPush::Modified(item));
|
self.proxy.dispatch(RosterPush::Modified(item));
|
||||||
|
|
Loading…
Reference in a new issue