Merge branch 'presence' into 'master'

update the presence plugin to match xmpp-parsers 0.5.0

See merge request !22
This commit is contained in:
lumi 2017-06-11 14:09:30 +00:00
commit 04a3afb621
3 changed files with 5 additions and 5 deletions

View file

@ -16,7 +16,7 @@ gitlab = { repository = "lumi/xmpp-rs" }
[dependencies] [dependencies]
xml-rs = "0.4.1" xml-rs = "0.4.1"
xmpp-parsers = "0.4.0" xmpp-parsers = "0.5.0"
openssl = "0.9.12" openssl = "0.9.12"
base64 = "0.5.2" base64 = "0.5.2"
minidom = "0.4.1" minidom = "0.4.1"

View file

@ -5,7 +5,7 @@ use xmpp::client::ClientBuilder;
use xmpp::plugins::stanza::StanzaPlugin; use xmpp::plugins::stanza::StanzaPlugin;
use xmpp::plugins::unhandled_iq::UnhandledIqPlugin; use xmpp::plugins::unhandled_iq::UnhandledIqPlugin;
use xmpp::plugins::messaging::{MessagingPlugin, MessageEvent}; use xmpp::plugins::messaging::{MessagingPlugin, MessageEvent};
use xmpp::plugins::presence::{PresencePlugin, Type}; use xmpp::plugins::presence::{PresencePlugin, Type, Show};
use xmpp::plugins::disco::DiscoPlugin; use xmpp::plugins::disco::DiscoPlugin;
use xmpp::plugins::ibb::IbbPlugin; use xmpp::plugins::ibb::IbbPlugin;
use xmpp::plugins::ping::PingPlugin; use xmpp::plugins::ping::PingPlugin;
@ -33,6 +33,6 @@ fn main() {
println!("{:?}", e); println!("{:?}", e);
Propagation::Continue Propagation::Continue
}); });
client.plugin::<PresencePlugin>().set_presence(Type::Available, None, None).unwrap(); client.plugin::<PresencePlugin>().set_presence(Type::None, Show::None, None).unwrap();
client.main().unwrap(); client.main().unwrap();
} }

View file

@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use error::Error; use error::Error;
use plugin::PluginProxy; use plugin::PluginProxy;
pub use xmpp_parsers::presence::{Presence, PresenceType as Type, Show}; pub use xmpp_parsers::presence::{Presence, Type, Show};
pub struct PresencePlugin { pub struct PresencePlugin {
proxy: PluginProxy, proxy: PluginProxy,
@ -16,7 +16,7 @@ impl PresencePlugin {
} }
} }
pub fn set_presence(&self, type_: Type, show: Option<Show>, status: Option<String>) -> Result<(), Error> { pub fn set_presence(&self, type_: Type, show: Show, status: Option<String>) -> Result<(), Error> {
let presence = Presence { let presence = Presence {
from: None, from: None,
to: None, to: None,