Simplify xmpp incoming stanzas processing without futures

[?]
Jan 2, 2019, 1:48 PM
XOAM22TTB4TTPABSG753EQWIADXB43ZEW6LKS64P6NWRETLDUONQC

Dependencies

  • [2] DKXSFTDY Send stanzas via send queue
  • [3] 3ADA5BBX Add items to roster from iq of "set" type
  • [4] FWJDW3G5 Allow process xmpp incoming stanzas with futures
  • [5] QTCUURXN Add additional requirement for command stream
  • [6] UMTLHH77 Process commands in the separate function
  • [7] SA2IOFGY Add items to roster
  • [8] EBETRYK7 Add counter for id. Check for jid in roster
  • [9] OANBCLN5 Move xmpp client into XmppState
  • [10] BWDUANCV Second part of processing result is only about stop_future
  • [11] XGP44R5H Rework stopping xmpp connection
  • [12] SU4DNVCB Start to processing roster data
  • [13] CBWCXUZZ Prepare adding new items to roster
  • [14] ALP2YJIU Rename XmppState to XmppProcessState
  • [15] 5IKA4GO7 Rename xmpp client field from "inner" to "client"
  • [*] VS6AHRWI Move XMPP to separate dir

Change contents

  • replacement in src/xmpp/mod.rs at line 149
    [3.3788][3.759:783](),[3.783][3.773:791](),[3.791][3.797:894](),[3.1150][3.797:894](),[3.18][3.797:894](),[3.797][3.797:894]()
    fn xmpp_processing(
    mut self,
    event: &Event,
    ) -> impl Future<Item = Self, Error = std::rc::Rc<config::Account>> {
    [3.3788]
    [3.792]
    /// Returns false on error
    fn xmpp_processing(&mut self, event: &Event) -> bool {
  • replacement in src/xmpp/mod.rs at line 181
    [3.2201][3.2201:2234]()
    future::ok(self)
    [3.2201]
    [3.2234]
    true
  • replacement in src/xmpp/mod.rs at line 183
    [3.2248][3.2248:2295]()
    Event::Online => future::ok(self),
    [3.2248]
    [3.2295]
    Event::Online => true,
  • replacement in src/xmpp/mod.rs at line 186
    [3.2365][3.2365:2407]()
    future::err(self.account)
    [3.2365]
    [3.2407]
    false
  • replacement in src/xmpp/mod.rs at line 275
    [2.2979][2.2979:3047]()
    let xmpp = XmppConnection {
    [2.2979]
    [2.3047]
    let mut xmpp = XmppConnection {
  • replacement in src/xmpp/mod.rs at line 279
    [2.3222][2.3222:4515]()
    Box::new(xmpp.xmpp_processing(&event).then(|r| match r {
    Ok(mut xmpp) => {
    match stop_condition(&mut xmpp, event) {
    Ok(true) => future::ok(future::Loop::Break((
    xmpp,
    Ok(Either::A(b)),
    ))),
    Ok(false) => {
    future::ok(future::Loop::Continue((
    xmpp,
    b,
    stop_condition,
    )))
    }
    Err(_e) => future::err((
    xmpp.account,
    Ok(Either::A(b)),
    )),
    [2.3222]
    [2.4515]
    if xmpp.xmpp_processing(&event) {
    match stop_condition(&mut xmpp, event) {
    Ok(true) => future::ok(future::Loop::Break((
    xmpp,
    Ok(Either::A(b)),
    ))),
    Ok(false) => future::ok(future::Loop::Continue((
    xmpp,
    b,
    stop_condition,
    ))),
    Err(_e) => {
    future::err((xmpp.account, Ok(Either::A(b))))
  • replacement in src/xmpp/mod.rs at line 295
    [2.4611][2.4611:4936]()
    Err(account) => {
    future::err((account, Ok(Either::A(b))))
    }
    }))
    as Box<dyn Future<Item = _, Error = _>>
    [2.4611]
    [2.4936]
    } else {
    future::err((xmpp.account, Ok(Either::A(b))))
    }
  • replacement in src/xmpp/mod.rs at line 299
    [2.4981][2.4981:5072]()
    Box::new(future::err((account, Ok(Either::A(b)))))
    [2.4981]
    [2.5072]
    future::err((account, Ok(Either::A(b))))
  • replacement in src/xmpp/mod.rs at line 303
    [2.5203][2.5203:5287]()
    Box::new(if let Some(client) = a.into_inner() {
    [2.5203]
    [2.5287]
    if let Some(client) = a.into_inner() {
  • replacement in src/xmpp/mod.rs at line 313
    [2.5840][2.5840:5879]()
    })
    [2.5840]
    [2.5879]
    }
  • replacement in src/xmpp/mod.rs at line 317
    [2.6039][2.6039:6126]()
    Box::new(future::err((account, Ok(Either::A(b)))))
    [2.6039]
    [2.6126]
    future::err((account, Ok(Either::A(b))))
  • replacement in src/xmpp/mod.rs at line 320
    [2.6220][2.6220:6304]()
    Box::new(if let Some(client) = a.into_inner() {
    [2.6220]
    [2.6304]
    if let Some(client) = a.into_inner() {
  • replacement in src/xmpp/mod.rs at line 330
    [2.6837][2.6837:6876]()
    })
    [2.6837]
    [2.6876]
    }