diff --git a/xmpp/src/agent.rs b/xmpp/src/agent.rs index df31db7a..7630a649 100644 --- a/xmpp/src/agent.rs +++ b/xmpp/src/agent.rs @@ -24,6 +24,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 d416a127..9c996b00 100644 --- a/xmpp/src/builder.rs +++ b/xmpp/src/builder.rs @@ -155,14 +155,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) } }