Checks for self XEP-0163 support
Dependencies
- [2]
WXPEN4YCUpdate dependencies - [3]
TGO4TIWUFix README - [4]
K7XUYBRZUpdate dependencies and format - [5]
ZDGCVSXJSend id and receipts with message - [6]
OX5ZPQRFUpdate tokio to 1.* - [*]
C6VGR2RWPing other domains to test s2s
Change contents
- edit in "src/xmpp/xmpp_connection.rs" at line 188
struct SelfDiscoveryIqHandler {} - edit in "src/xmpp/xmpp_connection.rs" at line 191
impl IqHandler for SelfDiscoveryIqHandler {fn result(self: Box<Self>,conn: &mut XmppConnection,opt_element: Option<xmpp_parsers::Element>,) -> bool {if let Some(result) = opt_element {use std::convert::TryInto;match result.try_into() as Result<xmpp_parsers::disco::DiscoInfoResult, _> {Ok(self_discovery) => {conn.state.data.self_discovery_init = true;conn.state.data.self_pubsub_pep = false;for i in self_discovery.identities {if i.category == "pubsub" && i.type_ == "pep" {conn.state.data.self_pubsub_pep = true;break;}}info!("Support XEP-0163: Personal Eventing Protocol: {}",conn.state.data.self_pubsub_pep);true}Err(e) => {error!("Cann't parse self discovery: {}", e);false}}} else {error!("No self discovery");false}}fn error(self: Box<Self>,_conn: &mut XmppConnection,_error: xmpp_parsers::stanza_error::StanzaError,) -> bool {false}fn timeout(self: Box<Self>, _conn: &mut XmppConnection) -> bool {false}} - edit in "src/xmpp/xmpp_connection.rs" at line 272
/// if self discovery was initialized/// ToDo: remove it as it is used only for initializationself_discovery_init: bool,/// if XEP-0163 Personal Eventing Protocol supportedself_pubsub_pep: bool, - replacement in "src/xmpp/xmpp_connection.rs" at line 541
match (connected, stopped) {let (connected, stopped) = match (connected, stopped) { - edit in "src/xmpp/xmpp_connection.rs" at line 544
}(connected, stopped) => (connected, stopped),};match (connected, stopped) {(Ok(connection), Either::Left(stop_future)) => {connection.self_discovery(stop_future).await - edit in "src/xmpp/xmpp_connection.rs" at line 1198[8.1466][8.1466]
async fn self_discovery<F>(mut self,mut stop_future: F,) -> (Result<Self, std::rc::Rc<config::Account>>, Either<F, ()>)whereF: std::future::Future<Output = ()> + Unpin,{self.state.data.counter += 1;let id_self_discovery = format!("id_self_discovery{}", self.state.data.counter);let self_discovery = stanzas::make_disco_get(id_self_discovery.clone(),Some(self.account.jid.clone()),Some(xmpp_parsers::BareJid::from(self.account.jid.clone()).into()),);self.state.data.pending_ids.insert(id_self_discovery,IqWait::new(60, SelfDiscoveryIqHandler {}),);info!("Sending self discovery... {}",String::from(&self_discovery));let opt_stop_future = {let send_future = self.state.client.send_stanza(self_discovery);tokio::pin!(send_future);match futures_util::future::select(stop_future, send_future).await {Either::Left(((), _)) => None,Either::Right((Ok(_), stop_future)) => Some(stop_future),Either::Right((Err(e), f)) => {error!("Send self discovery error: {}", e);return (Err(self.account), Either::Left(f));}}};if let Some(f) = opt_stop_future {stop_future = f;} else {return (Ok(self), Either::Right(()));}(Ok(self), Either::Left(stop_future))} - replacement in "src/xmpp/stanzas.rs" at line 2
use xmpp_parsers::disco::{DiscoInfoResult, DiscoItemsResult, Feature, Identity};use xmpp_parsers::disco::{DiscoInfoQuery, DiscoInfoResult, DiscoItemsResult, Feature, Identity}; - edit in "src/xmpp/stanzas.rs" at line 232[3.38862]
pub fn make_disco_get(id: String,from: Option<xmpp_parsers::Jid>,to: Option<xmpp_parsers::Jid>,) -> Element {let mut get = Iq::from_get(id, DiscoInfoQuery { node: None });get.from = from;get.to = to;get.into()} - edit in "README.md" at line 15
At start send self-discovery to server. - edit in "README.md" at line 29
#### XEP-0163: Personal Eventing Protocol - edit in "README.md" at line 32
Checks if own server supports it. - replacement in "Cargo.toml" at line 18
env_logger = "0.8"env_logger = "0.9" - replacement in "Cargo.lock" at line 237
version = "0.8.4"version = "0.9.0" - replacement in "Cargo.lock" at line 239
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"