diff options
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"); |