diff options
Diffstat (limited to 'xmpp-vala/src/module')
-rw-r--r-- | xmpp-vala/src/module/xep/0085_chat_state_notifications.vala | 9 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0334_message_processing_hints.vala | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala index e1106597..5a9b0914 100644 --- a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala +++ b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala @@ -21,11 +21,12 @@ public class Module : XmppStreamModule { /** * "A message stanza that does not contain standard messaging content [...] SHOULD be a state other than <active/>" (0085, 5.6) */ - public void send_state(XmppStream stream, Jid jid, string state) { - MessageStanza message = new MessageStanza(); - message.to = jid; - message.type_ = MessageStanza.TYPE_CHAT; + public void send_state(XmppStream stream, Jid jid, string message_type, string state) { + MessageStanza message = new MessageStanza() { to=jid, type_=message_type }; message.stanza.put_node(new StanzaNode.build(state, NS_URI).add_self_xmlns()); + + MessageProcessingHints.set_message_hint(message, MessageProcessingHints.HINT_NO_STORE); + stream.get_module(MessageModule.IDENTITY).send_message(stream, message); } diff --git a/xmpp-vala/src/module/xep/0334_message_processing_hints.vala b/xmpp-vala/src/module/xep/0334_message_processing_hints.vala new file mode 100644 index 00000000..352e03ac --- /dev/null +++ b/xmpp-vala/src/module/xep/0334_message_processing_hints.vala @@ -0,0 +1,15 @@ +namespace Xmpp.Xep.MessageProcessingHints { + +private const string NS_URI = "urn:xmpp:hints"; + +private const string HINT_NO_PERMANENT_STORE = "no-permanent-store"; +private const string HINT_NO_STORE = "no-store"; +private const string HINT_NO_COPY = "no-copy"; +private const string HINT_STORE = "store"; + +public static void set_message_hint(MessageStanza message, string message_hint) { + StanzaNode hint_node = (new StanzaNode.build(message_hint, NS_URI)).add_self_xmlns(); + message.stanza.put_node(hint_node); +} + +} |