diff options
author | fiaxh <git@lightrise.org> | 2019-05-12 00:09:50 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-05-16 11:12:14 -0600 |
commit | d3c6e5c62cb405cb6db646ee1ee03ca1e51d5e00 (patch) | |
tree | f304fb028397c668d87651e4e9350c3d009c280c /xmpp-vala/src/module/xep | |
parent | 951be638f6596e9156dd087c310837cfeda242b3 (diff) | |
download | dino-d3c6e5c62cb405cb6db646ee1ee03ca1e51d5e00.tar.gz dino-d3c6e5c62cb405cb6db646ee1ee03ca1e51d5e00.zip |
Enable sending chat state notifications in private rooms
Diffstat (limited to 'xmpp-vala/src/module/xep')
-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); +} + +} |