From 24eeb0b3c95ecba7dfaaa931c15ece4d01fb5a78 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 27 Nov 2020 20:47:53 +0100 Subject: [PATCH] xmpp-parsers/iq: Add a helper to create an empty result iq. This can be useful to reply to a get/set iq. --- xmpp-parsers/src/iq.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xmpp-parsers/src/iq.rs b/xmpp-parsers/src/iq.rs index 5b7d5a6f..b9c022f3 100644 --- a/xmpp-parsers/src/iq.rs +++ b/xmpp-parsers/src/iq.rs @@ -90,6 +90,16 @@ impl Iq { } } + /// Creates an empty `` stanza. + pub fn empty_result>(to: Jid, id: S) -> Iq { + Iq { + from: None, + to: Some(to), + id: id.into(), + payload: IqType::Result(None), + } + } + /// Creates an `` stanza containing a result. pub fn from_result>(id: S, payload: Option) -> Iq { Iq {