@@ -5,7 +5,8 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::path::{Path, PathBuf};
-use std::sync::{Arc, RwLock};
+use std::sync::Arc;
+use tokio::sync::RwLock;
use tokio_xmpp::connect::ServerConnector;
pub use tokio_xmpp::parsers;
use tokio_xmpp::parsers::{disco::DiscoInfoResult, message::MessageType};
@@ -4,7 +4,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::sync::{Arc, RwLock};
+use std::sync::Arc;
+use tokio::sync::RwLock;
use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{
jid::{BareJid, Jid},
@@ -28,7 +28,12 @@ pub async fn join_room<C: ServerConnector>(
muc = muc.with_password(password);
}
- let nick = nick.unwrap_or_else(|| agent.default_nick.read().unwrap().clone());
+ let nick = if let Some(nick) = nick {
+ nick
+ } else {
+ agent.default_nick.read().await.clone()
+ };
+
let room_jid = room.with_resource_str(&nick).unwrap();
let mut presence = Presence::new(PresenceType::None).with_to(room_jid);
presence.add_payload(muc);