VW7NVWAGIOHOEEYGAT77GV6GXXIAKWCXVXPZFRMAV7SPWXVGPTTQC
37OMJ4CKEJIHMGWDGILSULMALWUTXSIL2DK2SBEHLKECFZUG2P5QC
FV6BJ5K64QG63YI2PTII44ZEBAYNJBQZ5FSBHW65EPHGBKFGUW4AC
J7VX56FW5BPM77MEFTKK6HP2ZOWRXP6GFUTBTQKBO52EBGFTVXMQC
VS6AHRWIPIMQNQAFX7INQGSUB72OW2K6HM6NGOV76RBRF6COQFRQC
OB3HA2MD7TDBGGURKXNQKLLLC5FAAD5OX5BENF3M2XNU7OTJ5HHAC
AA2ZWGRLFD5XV3LYOFJU7ELWMVKGXTNUSH4BJNLXFWPSSTDZWO2AC
RGOSS73USO7B6YLKHSZ5R3K4OIZA56JXFVHPFFCNKSTWG7INPC7QC
HKSQO7JZEW6GXKPDJD4VJSYCJJBUDLKVN7SGUU5ZEMIVGII455RAC
pub fn make_muc_presence_leave(from: xmpp_parsers::Jid, to: xmpp_parsers::Jid) -> Element {
let mut presence = Presence::new(PresenceType::Unavailable);
presence.from = Some(from);
presence.to = Some(to);
presence.into()
}
fn shutdown(self) -> impl Future<Item = (), Error = failure::Error> {
info!("Shutdown connection");
let XmppConnection { account, state } = self;
stream::iter_ok(
state
.data
.mucs
.values()
.map(std::clone::Clone::clone)
.collect::<Vec<_>>(),
)
.fold(state, move |XmppState { client, data }, muc_jid| {
let muc_presence =
stanzas::make_muc_presence_leave(account.jid.clone(), muc_jid.clone());
fn deserialize_jid_map<'de, D>(
deserializer: D,
) -> Result<HashMap<String, xmpp_parsers::Jid>, D::Error>
where
D: serde::Deserializer<'de>,
{
use serde::Deserialize;
let s = HashMap::<String, String>::deserialize(deserializer)?;
let size = s.len();
s.into_iter()
.map(|(k, v)| (k, std::str::FromStr::from_str(&v)))
.take_while(|(_k, r)| r.is_ok())
.fold(Ok(HashMap::with_capacity(size)), |res, (k, r)| match res {
Ok(mut res) => match r {
Ok(v) => {
res.insert(k, v);
Ok(res)
}
Err(e) => Err(e),
},
Err(e) => Err(e),
})
.map_err(serde::de::Error::custom)
}