1
0
mirror of https://gitlab.com/xmpp-rs/xmpp-rs.git synced 2024-07-02 19:30:36 +02:00

xmpp-parsers/iq: Add a helper to create an empty result iq.

This can be useful to reply to a get/set iq.
This commit is contained in:
Emmanuel Gil Peyrot 2020-11-27 20:47:53 +01:00
parent eaa63fbe46
commit 24eeb0b3c9

View File

@ -90,6 +90,16 @@ impl Iq {
}
}
/// Creates an empty `<iq type="result"/>` stanza.
pub fn empty_result<S: Into<String>>(to: Jid, id: S) -> Iq {
Iq {
from: None,
to: Some(to),
id: id.into(),
payload: IqType::Result(None),
}
}
/// Creates an `<iq/>` stanza containing a result.
pub fn from_result<S: Into<String>>(id: S, payload: Option<impl IqResultPayload>) -> Iq {
Iq {