diff --git a/xmpp/src/agent.rs b/xmpp/src/agent.rs index 48d39cf3..c718efdd 100644 --- a/xmpp/src/agent.rs +++ b/xmpp/src/agent.rs @@ -28,6 +28,24 @@ pub struct Agent { } impl Agent { + async fn new( + client: TokioXmppClient, + default_nick: String, + lang: String, + diso: DiscoInfoResult, + node: String, + ) -> Agent { + Agent { + client, + default_nick: Arc::new(RwLock::new(default_nick)), + lang: Arc::new(lang), + disco, + node, + uploads: Vec::new(), + awaiting_disco_bookmarks_type: false, + } + } + pub async fn disconnect(&mut self) -> Result<(), Error> { self.client.send_end().await } diff --git a/xmpp/src/builder.rs b/xmpp/src/builder.rs index 73ceaab9..44c2d771 100644 --- a/xmpp/src/builder.rs +++ b/xmpp/src/builder.rs @@ -156,14 +156,6 @@ impl ClientBuilder<'_, C> { let disco = self.make_disco(); let node = self.website; - Agent { - client, - default_nick: Arc::new(RwLock::new(self.default_nick)), - lang: Arc::new(self.lang), - disco, - node, - uploads: Vec::new(), - awaiting_disco_bookmarks_type: false, - } + Agent::new(client, default_nick, lang, disco, node) } }