if opt_xmpp_to.is_none() {
for domains in &self.state.data.used_domains {
self.state.data.counter += 1;
let id_ping = format!("id_ping{}", self.state.data.counter);
let ping = stanzas::make_ping(
&id_ping,
self.state
.client
.bound_jid()
.map_or_else(|| self.account.jid.clone(), |j| j.clone()),
Some(xmpp_parsers::Jid::Bare(xmpp_parsers::BareJid::domain(
domains,
))),
);
self.state.data.send_queue.push_back(ping);
self.state
.data
.pending_ids
.insert(id_ping, IqWait::new(30, PingIqHandler { ignorable: true }));
}
}
if let Some(xmpp_to) = opt_xmpp_to {
self.add_domain_to_ping(xmpp_to.into());
}