blob: 934e5ff351e4e1f2ee8b02fb0d21773546ed6489 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
namespace Xmpp.Xep.MessageModeration {
public const string NS_URI = "urn:xmpp:message-moderate:1";
/**
* @return whether the moderation was successful
*/
public static async bool moderate(XmppStream stream, Jid muc_jid, string message_id) {
try {
StanzaNode moderate_node = new StanzaNode.build("moderate", NS_URI)
.add_self_xmlns()
.put_attribute("id", message_id)
.put_node(new StanzaNode.build("retract", Xep.MessageRetraction.NS_URI).add_self_xmlns());
Iq.Stanza iq = new Iq.Stanza.set(moderate_node) { to = muc_jid };
Iq.Stanza result_stanza = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
return !result_stanza.is_error();
} catch (IOError e) {
return false;
}
}
}
|