support SCRAM-SHA-1
This commit is contained in:
parent
74fb4fd9ad
commit
ff7387a92a
6 changed files with 283 additions and 10 deletions
|
|
@ -4,7 +4,7 @@ use xmpp::jid::Jid;
|
|||
use xmpp::client::ClientBuilder;
|
||||
use xmpp::plugins::messaging::{MessagingPlugin, MessageEvent};
|
||||
use xmpp::plugins::presence::{PresencePlugin, Show};
|
||||
use xmpp::sasl::mechanisms::Plain;
|
||||
use xmpp::sasl::mechanisms::{Scram, Sha1, Plain};
|
||||
|
||||
use std::env;
|
||||
|
||||
|
|
@ -14,7 +14,10 @@ fn main() {
|
|||
client.register_plugin(MessagingPlugin::new());
|
||||
client.register_plugin(PresencePlugin::new());
|
||||
let pass = env::var("PASS").unwrap();
|
||||
client.connect(&mut Plain::new(jid.node.clone().expect("JID requires a node"), pass)).unwrap();
|
||||
let name = jid.node.clone().expect("JID requires a node");
|
||||
client.connect(&mut Plain::new(name, pass)).unwrap();
|
||||
// Replace with this line if you want SCRAM-SHA-1 authentication:
|
||||
// client.connect(&mut Scram::<Sha1>::new(name, pass).unwrap()).unwrap();
|
||||
client.plugin::<PresencePlugin>().set_presence(Show::Available, None).unwrap();
|
||||
loop {
|
||||
let event = client.next_event().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue