diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-10-08 12:10:53 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-10-08 12:10:53 +0200 |
commit | f3ef8d497875d472a7b96bed0c14086b71ecfa7b (patch) | |
tree | 3afdf85862c416be0c3a59131dc1a81d234341da /src/main/java/eu | |
parent | 9efef24a04d3ba9802bef191e6b7dc739785ebad (diff) |
fetch new conference configuration on every conf update
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/MucOptions.java | 1 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 39 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 9d54a86d..fa6afcfa 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -127,7 +127,6 @@ public class MucOptions { UNKNOWN } - public static final String STATUS_CODE_ROOM_CONFIG_CHANGED = "104"; public static final String STATUS_CODE_SELF_PRESENCE = "110"; public static final String STATUS_CODE_ROOM_CREATED = "201"; public static final String STATUS_CODE_BANNED = "301"; diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index b4553012..81b68ed9 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -587,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(); } } } |