Query roster
[?]
Dec 30, 2018, 10:28 AM
PFC7OJQFPAFGRAF4CDWVSFR5DERUNOBAIYOW2TKLROPL3VKKSBPQCDependencies
- [2]
HU3NZX5ZProcess self-presence via new processing code - [3]
PBRUH4BJRename optional XmppConnection to MaybeXmppConnection - [4]
BTOZT4JPUse failure - [5]
VS6AHRWIMove XMPP to separate dir - [6]
XGP44R5HRework stopping xmpp connection - [7]
X6L47BHQUse different structure for established xmpp connection - [8]
IK3YDPTYUpdate deps - [9]
AGIW6YR3Use shared future for signal everywhere - [10]
FV6BJ5K6Send self-presence and store account info in Rc so it willbe used in some future in parallel - [11]
QWE26TMVupdate deps - [12]
TDOR5XQUAccept destination - [*]
FVVPKFTLInitial commit
Change contents
- edit in src/xmpp/stanzas.rs at line 2
use xmpp_parsers::iq::Iq; - edit in src/xmpp/stanzas.rs at line 4
use xmpp_parsers::roster::Roster; - edit in src/xmpp/stanzas.rs at line 14[3.419]
pub fn make_get_roster(id: &str) -> Element {let mut get_roster = Iq::from_get(Roster {ver: None,items: vec![],});get_roster.id = Some(id.to_string());get_roster.into()} - edit in src/xmpp/mod.rs at line 68
let stop_future3 = stop_future.clone(); - replacement in src/xmpp/mod.rs at line 79
.and_then(|conn| conn.self_presence(stop_future2)).and_then(|conn| conn.initial_roster(stop_future2)).and_then(|conn| conn.self_presence(stop_future3)) - replacement in src/xmpp/mod.rs at line 129
S: FnMut(&mut Self, &Event) -> Result<bool, failure::Error>,S: FnMut(&mut Self, Event) -> Result<bool, failure::Error>, - replacement in src/xmpp/mod.rs at line 143
match stop_condition(&mut xmpp, &event) {match stop_condition(&mut xmpp, event) { - replacement in src/xmpp/mod.rs at line 184
fn online(&mut self, event: &Event) -> Result<bool, failure::Error> {fn online(&mut self, event: Event) -> Result<bool, failure::Error> { - edit in src/xmpp/mod.rs at line 200
fn initial_roster<F, E>(self,stop_future: F,) -> impl Future<Item = Self, Error = std::rc::Rc<config::Account>>whereF: Future<Error = E>,E: Into<failure::Error>,{let XmppConnection {account,inner: client,} = self;use tokio::prelude::Sink;let id_get_roster: String = "id_get_roster0".to_string(); - edit in src/xmpp/mod.rs at line 217
let get_roster = stanzas::make_get_roster(&id_get_roster);let account2 = account.clone();info!("Quering roster... {:?}", get_roster);client.send(get_roster).map_err(move |e| {error!("Error on querying roster: {}", e);(account2, Err(failure::SyncFailure::new(e).into()))}).and_then(move |client| {XmppConnection {inner: client,account,}.processing(move |_conn, event| {if let Event::Stanza(s) = event {use try_from::TryInto;match s.try_into() as Result<xmpp_parsers::iq::Iq, _> {Ok(iq) => {if let Some(id) = iq.id {if id == id_get_roster {match iq.payload {xmpp_parsers::iq::IqType::Error(_e) => {Err(format_err!("Get error instead of roster"))}_ => Ok(true),}} else {Ok(false)}} else {Err(format_err!("Iq stanza without id"))}}Err(_e) => Ok(false),}} else {Err(format_err!("Wrong event while waiting roster"))}},stop_future,)}).then(|r| match r {Err((account, e)) => {error!("Cann't wait roster: {}",e.err().map_or_else(|| std::borrow::Cow::Borrowed("None"),|e| e.to_string().into()));future::err(account)}Ok((conn, _)) => future::ok(conn),})} - replacement in src/xmpp/mod.rs at line 285
let XmppConnection { account, inner } = self;let client = inner;let XmppConnection {account,inner: client,} = self; - edit in src/xmpp/mod.rs at line 292
info!("Sending presence..."); - edit in src/xmpp/mod.rs at line 293
info!("Sending presence... {:?}", presence); - replacement in src/xmpp/mod.rs at line 325
Err((account, e)) => {Err((account, _e)) => { - replacement in src/xmpp/mod.rs at line 400
future::err(format_err!("Cmd error"))future::err(e) - edit in Cargo.toml at line 23
try_from = "=0.2.2" # dependency of xmpp-parsers - edit in Cargo.lock at line 1110
"try_from 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",