diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-05-20 22:47:52 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-05-20 22:47:52 +0200 |
commit | d3728e504f9673e97536d9bd519097c3df961035 (patch) | |
tree | 00207e961ca1f49d83a6c5f3a43289fabb0e8145 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | 893a1a0958d4b9f6d3ba5f81ee29b9341fdc07c5 (diff) | |
parent | 9ce2cfa3d2e8aac80f8e73855a879baad78dad0d (diff) |
Merge remote-tracking branch 'refs/remotes/siacs/master'
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 18c72d0ca..5d1f87fb6 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -83,6 +83,7 @@ import eu.siacs.conversations.generator.IqGenerator; import eu.siacs.conversations.generator.MessageGenerator; import eu.siacs.conversations.generator.PresenceGenerator; import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.parser.AbstractParser; import eu.siacs.conversations.parser.IqParser; import eu.siacs.conversations.parser.MessageParser; import eu.siacs.conversations.parser.PresenceParser; @@ -1762,7 +1763,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } - private boolean checkListeners() { + public boolean checkListeners() { return (this.mOnAccountUpdate == null && this.mOnConversationUpdate == null && this.mOnRosterUpdate == null @@ -1894,11 +1895,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa @Override public void onIqPacketReceived(Account account, IqPacket packet) { + Element query = packet.query("http://jabber.org/protocol/muc#admin"); if (packet.getType() == IqPacket.TYPE.RESULT && query != null) { for(Element child : query.getChildren()) { if ("item".equals(child.getName())) { - conversation.getMucOptions().putMember(child.getAttributeAsJid("jid")); + MucOptions.User user = AbstractParser.parseItem(conversation,child); + if (!user.realJidMatchesAccount()) { + conversation.getMucOptions().addUser(user); + } } } } else { @@ -2170,13 +2175,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } - public void changeAffiliationInConference(final Conversation conference, Jid user, MucOptions.Affiliation affiliation, final OnAffiliationChanged callback) { + public void changeAffiliationInConference(final Conversation conference, Jid user, final MucOptions.Affiliation affiliation, final OnAffiliationChanged callback) { final Jid jid = user.toBareJid(); IqPacket request = this.mIqGenerator.changeAffiliation(conference, jid, affiliation.toString()); sendIqPacket(conference.getAccount(), request, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { if (packet.getType() == IqPacket.TYPE.RESULT) { + conference.getMucOptions().changeAffiliation(jid, affiliation); + getAvatarService().clear(conference); callback.onAffiliationChangedSuccessful(jid); } else { callback.onAffiliationChangeFailed(jid, R.string.could_not_change_affiliation); @@ -2188,8 +2195,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void changeAffiliationsInConference(final Conversation conference, MucOptions.Affiliation before, MucOptions.Affiliation after) { List<Jid> jids = new ArrayList<>(); for (MucOptions.User user : conference.getMucOptions().getUsers()) { - if (user.getAffiliation() == before && user.getJid() != null) { - jids.add(user.getJid()); + if (user.getAffiliation() == before && user.getRealJid() != null) { + jids.add(user.getRealJid()); } } IqPacket request = this.mIqGenerator.changeAffiliation(conference, jids, after.toString()); @@ -2570,7 +2577,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } else { Conversation conversation = find(account, avatar.owner.toBareJid()); if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) { - MucOptions.User user = conversation.getMucOptions().findUser(avatar.owner.getResourcepart()); + MucOptions.User user = conversation.getMucOptions().findUserByFullJid(avatar.owner); if (user != null) { if (user.setAvatar(avatar)) { getAvatarService().clear(user); @@ -3169,7 +3176,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } - private ServiceDiscoveryResult getCachedServiceDiscoveryResult(Pair<String,String> key) { + public ServiceDiscoveryResult getCachedServiceDiscoveryResult(Pair<String, String> key) { ServiceDiscoveryResult result = discoCache.get(key); if (result != null) { return result; |