Ping other domains to test s2s

[?]
Dec 14, 2020, 8:16 AM
C6VGR2RWNTZG56XLWTO3P65NQXCMBLDKIAKX6BEIKK2CPNUCNSHAC

Dependencies

  • [2] FZBPGF6X Describe ping
  • [3] EKBSFYEF Make mailbox based on bare jid because of roster
  • [4] 3RMEABMU Prepare to add HTTP API to ping cutom jids
  • [5] TGO4TIWU Fix README
  • [*] UL67RM6X Re-implement sending message

Change contents

  • replacement in src/xmpp/xmpp_connection.rs at line 2
    [4.71][4.71:114]()
    use std::collections::{HashMap, VecDeque};
    [4.71]
    [4.114]
    use std::collections::{HashMap, HashSet, VecDeque};
  • edit in src/xmpp/xmpp_connection.rs at line 235
    [4.6117]
    [4.6117]
    /// domains needed to pinged, add here one for mucs, messages and pings
    used_domains: HashSet<String>,
  • replacement in src/xmpp/xmpp_connection.rs at line 913
    [4.29562][4.250:283]()
    opt_xmpp_to,
    [4.29562]
    [4.29562]
    opt_xmpp_to.clone(),
  • edit in src/xmpp/xmpp_connection.rs at line 920
    [2.235]
    [4.29800]
    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());
    }
  • edit in src/xmpp/xmpp_connection.rs at line 977
    [3.221]
    [7.70]
    self.add_domain_to_ping(bare_xmpp_to.clone());
  • edit in src/xmpp/xmpp_connection.rs at line 1157
    [4.32553]
    [4.32553]
    fn add_domain_to_ping(&mut self, jid: xmpp_parsers::BareJid) {
    if jid.domain != (*self.account).jid.clone().domain() {
    self.state.data.used_domains.insert(jid.domain);
    }
    }