aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/parser/MessageParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 6652842d..88d9daae 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -44,12 +44,11 @@ public class MessageParser extends AbstractParser implements
}
private Message parseChat(MessagePacket packet, Account account) {
- final Jid jid = packet.getFrom();
+ final Jid jid = packet.getFrom();
if (jid == null) {
return null;
}
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid.toBareJid(), false);
- updateLastseen(packet, account, true);
String pgpBody = getPgpBody(packet);
Message finishedMessage;
if (pgpBody != null) {
@@ -64,13 +63,18 @@ public class MessageParser extends AbstractParser implements
finishedMessage.markable = isMarkable(packet);
if (conversation.getMode() == Conversation.MODE_MULTI
&& !jid.isBareJid()) {
+ final Jid trueCounterpart = conversation.getMucOptions()
+ .getTrueCounterpart(jid.getResourcepart());
+ if (trueCounterpart != null) {
+ updateLastseen(packet, account, trueCounterpart, true);
+ }
finishedMessage.setType(Message.TYPE_PRIVATE);
- finishedMessage.setTrueCounterpart(conversation.getMucOptions()
- .getTrueCounterpart(jid.getResourcepart()));
+ finishedMessage.setTrueCounterpart(trueCounterpart);
if (conversation.hasDuplicateMessage(finishedMessage)) {
return null;
}
-
+ } else {
+ updateLastseen(packet, account, true);
}
finishedMessage.setCounterpart(jid);
finishedMessage.setTime(getTimestamp(packet));
@@ -89,7 +93,7 @@ public class MessageParser extends AbstractParser implements
.findOrCreateConversation(account, from.toBareJid(), false);
String presence;
if (from.isBareJid()) {
- presence = "";
+ presence = "";
} else {
presence = from.getResourcepart();
}
@@ -153,7 +157,7 @@ public class MessageParser extends AbstractParser implements
private Message parseGroupchat(MessagePacket packet, Account account) {
int status;
- final Jid from = packet.getFrom();
+ final Jid from = packet.getFrom();
if (from == null) {
return null;
}
@@ -163,6 +167,10 @@ public class MessageParser extends AbstractParser implements
}
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, from.toBareJid(), true);
+ final Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(from.getResourcepart());
+ if (trueCounterpart != null) {
+ updateLastseen(packet, account, trueCounterpart.toBareJid(), true);
+ }
if (packet.hasChild("subject")) {
conversation.setHasMessagesLeftOnServer(true);
conversation.getMucOptions().setSubject(packet.findChild("subject").getContent());