diff options
author | fiaxh <git@lightrise.org> | 2019-10-20 00:14:52 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-10-22 01:23:08 +0200 |
commit | c032ab00ecc9d2b0c5d2fdbc5bd622a5406f691c (patch) | |
tree | 4ad3d3380d5de2775945f7e73c7e9ba9067c6d38 /libdino/src/service | |
parent | 394862dbd31a938be8e953e0edaa73d2f4fb9769 (diff) | |
download | dino-c032ab00ecc9d2b0c5d2fdbc5bd622a5406f691c.tar.gz dino-c032ab00ecc9d2b0c5d2fdbc5bd622a5406f691c.zip |
Don't send delivery recipts or chat states for own messages
fixes #631
Diffstat (limited to 'libdino/src/service')
-rw-r--r-- | libdino/src/service/chat_interaction.vala | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala index b200916a..44a78b3e 100644 --- a/libdino/src/service/chat_interaction.vala +++ b/libdino/src/service/chat_interaction.vala @@ -177,6 +177,9 @@ public class ChatInteraction : StreamInteractionModule, Object { ChatInteraction outer = stream_interactor.get_module(ChatInteraction.IDENTITY); outer.send_delivery_receipt(message, stanza, conversation); + + // Send chat marker + if (message.direction == Entities.Message.DIRECTION_SENT) return false; if (outer.is_active_focus(conversation)) { outer.check_send_read(); conversation.read_up_to = message; @@ -208,15 +211,21 @@ public class ChatInteraction : StreamInteractionModule, Object { } private void send_delivery_receipt(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) { + if (message.direction == Entities.Message.DIRECTION_SENT) return; + if (!Xep.MessageDeliveryReceipts.Module.requests_receipt(stanza)) return; + if (conversation.type_ == Conversation.Type.GROUPCHAT) return; + XmppStream? stream = stream_interactor.get_stream(conversation.account); - if (stream != null && conversation.type_ != Conversation.Type.GROUPCHAT && Xep.MessageDeliveryReceipts.Module.requests_receipt(stanza)) { + if (stream != null) { stream.get_module(Xep.MessageDeliveryReceipts.Module.IDENTITY).send_received(stream, message.from, message.stanza_id); } } private void send_chat_state_notification(Conversation conversation, string state) { + if (conversation.get_send_typing_setting(stream_interactor) != Conversation.Setting.ON) return; + XmppStream? stream = stream_interactor.get_stream(conversation.account); - if (stream != null && conversation.get_send_typing_setting(stream_interactor) == Conversation.Setting.ON) { + if (stream != null) { string message_type = conversation.type_ == Conversation.Type.GROUPCHAT ? Xmpp.MessageStanza.TYPE_GROUPCHAT : Xmpp.MessageStanza.TYPE_CHAT; stream.get_module(Xep.ChatStateNotifications.Module.IDENTITY).send_state(stream, conversation.counterpart, message_type, state); } |