diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index f4fe80b5..81b68ed9 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -333,7 +333,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } if (timestamp == null) { - timestamp = AbstractParser.parseTimestamp(packet); + timestamp = AbstractParser.parseTimestamp(original,AbstractParser.parseTimestamp(packet)); } final String body = packet.getBody(); final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user"); @@ -539,7 +539,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece mXmppConnectionService.updateConversationUi(); } - if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) { + if (mXmppConnectionService.confirmMessages() + && message.trusted() + && remoteMsgId != null + && !isForwarded + && !isTypeGroupChat) { sendMessageReceipts(account, packet); } @@ -583,26 +587,27 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } } if (conversation != null && mucUserElement != null && from.isBareJid()) { - if (mucUserElement.hasChild("status")) { - for (Element child : mucUserElement.getChildren()) { - if (child.getName().equals("status") - && MucOptions.STATUS_CODE_ROOM_CONFIG_CHANGED.equals(child.getAttribute("code"))) { - mXmppConnectionService.fetchConferenceConfiguration(conversation); - } - } - } else if (mucUserElement.hasChild("item")) { - for(Element child : mucUserElement.getChildren()) { - if ("item".equals(child.getName())) { - MucOptions.User user = AbstractParser.parseItem(conversation,child); - Log.d(Config.LOGTAG,account.getJid()+": changing affiliation for " - +user.getRealJid()+" to "+user.getAffiliation()+" in " - +conversation.getJid().toBareJid()); - if (!user.realJidMatchesAccount()) { - conversation.getMucOptions().addUser(user); - mXmppConnectionService.getAvatarService().clear(conversation); - mXmppConnectionService.updateMucRosterUi(); - mXmppConnectionService.updateConversationUi(); + for (Element child : mucUserElement.getChildren()) { + if ("status".equals(child.getName())) { + try { + int code = Integer.parseInt(child.getAttribute("code")); + if ((code >= 170 && code <= 174) || (code >= 102 && code <= 104)) { + mXmppConnectionService.fetchConferenceConfiguration(conversation); + break; } + } catch (Exception e) { + //ignored + } + } else if ("item".equals(child.getName())) { + MucOptions.User user = AbstractParser.parseItem(conversation,child); + Log.d(Config.LOGTAG,account.getJid()+": changing affiliation for " + +user.getRealJid()+" to "+user.getAffiliation()+" in " + +conversation.getJid().toBareJid()); + if (!user.realJidMatchesAccount()) { + conversation.getMucOptions().addUser(user); + mXmppConnectionService.getAvatarService().clear(conversation); + mXmppConnectionService.updateMucRosterUi(); + mXmppConnectionService.updateConversationUi(); } } } |