aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-11 14:49:06 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-11 14:49:06 +0200
commit2b14ad51ecbfccbed326b82f141d96fa2c5b268f (patch)
tree53f9fc9446527bce5d1eeb435df592955567a846
parentbeb82310dad23d1337b6969638e805bb75f6a376 (diff)
fishing invites and delivery reports out of carbon copied messages
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 598cf830..91d5e18d 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -155,8 +155,12 @@ public class MessageParser extends AbstractParser {
return null;
}
Element message = forwarded.findChild("message");
- if ((message == null) || (!message.hasChild("body")))
- return null; // either malformed or boring
+ if ((message == null) || (!message.hasChild("body"))) {
+ if (status == Message.STATUS_RECIEVED) {
+ parseNormal(message, account);
+ }
+ return null;
+ }
if (status == Message.STATUS_RECIEVED) {
fullJid = message.getAttribute("from");
updateLastseen(message, account,true);
@@ -185,21 +189,21 @@ public class MessageParser extends AbstractParser {
packet.getId(), Message.STATUS_SEND_FAILED);
}
- public void parseNormal(MessagePacket packet, Account account) {
+ public void parseNormal(Element packet, Account account) {
if (packet.hasChild("displayed","urn:xmpp:chat-markers:0")) {
String id = packet.findChild("displayed","urn:xmpp:chat-markers:0").getAttribute("id");
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getAttribute("from").split("/");
updateLastseen(packet, account,true);
mXmppConnectionService.markMessage(account,fromParts[0], id, Message.STATUS_SEND_DISPLAYED);
} else if (packet.hasChild("received","urn:xmpp:chat-markers:0")) {
String id = packet.findChild("received","urn:xmpp:chat-markers:0").getAttribute("id");
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getAttribute("from").split("/");
updateLastseen(packet, account,false);
mXmppConnectionService.markMessage(account,fromParts[0], id, Message.STATUS_SEND_RECEIVED);
} else if (packet.hasChild("x")) {
Element x = packet.findChild("x");
if (x.hasChild("invite")) {
- Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, packet.getFrom(),
+ Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, packet.getAttribute("from"),
true);
mXmppConnectionService.updateUi(conversation, false);
}