fixing duplicate private muc messages

This commit is contained in:
iNPUTmice 2014-08-25 19:20:53 +02:00
parent 07b422d4c8
commit 450b911cb2

View file

@ -40,15 +40,18 @@ public class MessageParser extends AbstractParser implements
packet.getBody(), Message.ENCRYPTION_NONE, packet.getBody(), Message.ENCRYPTION_NONE,
Message.STATUS_RECIEVED); Message.STATUS_RECIEVED);
} }
finishedMessage.setRemoteMsgId(packet.getId());
if (conversation.getMode() == Conversation.MODE_MULTI if (conversation.getMode() == Conversation.MODE_MULTI
&& fromParts.length >= 2) { && fromParts.length >= 2) {
finishedMessage.setType(Message.TYPE_PRIVATE); finishedMessage.setType(Message.TYPE_PRIVATE);
finishedMessage.setPresence(fromParts[1]); finishedMessage.setPresence(fromParts[1]);
finishedMessage.setTrueCounterpart(conversation.getMucOptions() finishedMessage.setTrueCounterpart(conversation.getMucOptions()
.getTrueCounterpart(fromParts[1])); .getTrueCounterpart(fromParts[1]));
if (conversation.hasDuplicateMessage(finishedMessage)) {
return null;
}
} }
finishedMessage.setRemoteMsgId(packet.getId());
finishedMessage.setTime(getTimestamp(packet)); finishedMessage.setTime(getTimestamp(packet));
return finishedMessage; return finishedMessage;
} }
@ -236,7 +239,9 @@ public class MessageParser extends AbstractParser implements
finishedMessage.setPresence(parts[1]); finishedMessage.setPresence(parts[1]);
finishedMessage.setTrueCounterpart(conversation.getMucOptions() finishedMessage.setTrueCounterpart(conversation.getMucOptions()
.getTrueCounterpart(parts[1])); .getTrueCounterpart(parts[1]));
if (conversation.hasDuplicateMessage(finishedMessage)) {
return null;
}
} }
return finishedMessage; return finishedMessage;
@ -362,7 +367,9 @@ public class MessageParser extends AbstractParser implements
} }
} else if (packet.hasChild("body")) { } else if (packet.hasChild("body")) {
message = this.parseChat(packet, account); message = this.parseChat(packet, account);
if (message != null) {
message.markUnread(); message.markUnread();
}
} else if (packet.hasChild("received") || (packet.hasChild("sent"))) { } else if (packet.hasChild("received") || (packet.hasChild("sent"))) {
message = this.parseCarbonMessage(packet, account); message = this.parseCarbonMessage(packet, account);
if (message != null) { if (message != null) {