From 2b14ad51ecbfccbed326b82f141d96fa2c5b268f Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Fri, 11 Jul 2014 14:49:06 +0200 Subject: fishing invites and delivery reports out of carbon copied messages --- src/eu/siacs/conversations/parser/MessageParser.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3