diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-01-27 22:03:15 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-01-27 22:03:15 +0100 |
commit | 7ba79653b17284ac5d6c2e8ca6287dad1cc9bb06 (patch) | |
tree | b7b9d90751fdae65e75993adf75b4622b6627748 /src/main/java/de/pixart/messenger/parser | |
parent | ff1b7567d122aaa22a191f0fc7a1cc270bd57a0e (diff) |
improvements for self messages
* fix omemo in group chats w/o participants
* don't create two axolotl messages when messaging self
* fix read marker for self messages
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index bbc9d05bb..82810bc1c 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -581,6 +581,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece && replacedMessage.getStatus() == Message.STATUS_RECEIVED && (replacedMessage.trusted() || replacedMessage.getType() == Message.TYPE_PRIVATE) && remoteMsgId != null + && !selfAddressed && !isTypeGroupChat) { processMessageReceipts(account, packet, query); } @@ -658,6 +659,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece && message.getStatus() == Message.STATUS_RECEIVED && (message.trusted() || message.getType() == Message.TYPE_PRIVATE) && remoteMsgId != null + && !selfAddressed && !isTypeGroupChat) { processMessageReceipts(account, packet, query); } @@ -783,11 +785,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (displayed != null) { final String id = displayed.getAttribute("id"); final Jid sender = displayed.getAttributeAsJid("sender"); - if (packet.fromAccount(account)) { - Conversation conversation = mXmppConnectionService.find(account, counterpart.toBareJid()); - if (conversation != null && (query == null || query.isCatchup())) { - mXmppConnectionService.markRead(conversation); - } + if (packet.fromAccount(account) && !selfAddressed) { + dismissNotification(account, counterpart, query); } else if (isTypeGroupChat) { Conversation conversation = mXmppConnectionService.find(account, counterpart.toBareJid()); if (conversation != null && id != null && sender != null) { @@ -820,6 +819,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece mXmppConnectionService.markMessage(message, Message.STATUS_SEND_DISPLAYED); message = message.prev(); } + if (displayedMessage != null && selfAddressed) { + dismissNotification(account, counterpart, query); + } } } @@ -837,6 +839,13 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } } + private void dismissNotification(Account account, Jid counterpart, MessageArchiveService.Query query) { + Conversation conversation = mXmppConnectionService.find(account, counterpart.toBareJid()); + if (conversation != null && (query == null || query.isCatchup())) { + mXmppConnectionService.markRead(conversation); //TODO only mark messages read that are older than timestamp + } + } + private static Jid getTrueCounterpart(Element mucUserElement, Jid fallback) { final Element item = mucUserElement == null ? null : mucUserElement.findChild("item"); Jid result = item == null ? null : item.getAttributeAsJid("jid"); |