aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-25 19:57:39 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-25 19:57:39 +0100
commitcf15b442d087287ef285cda70e3dacfeae485055 (patch)
tree9a2102244254a463aec6433e10610510e48be07e /src/main/java/de/pixart/messenger/services
parent508c381e2ede2742801cc0995fb8561e6fa30b45 (diff)
cleaning up crypto targets when conference member is getting removed
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 439e6b1c3..4578ef99a 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -67,6 +67,7 @@ import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -2332,6 +2333,7 @@ public class XmppConnectionService extends Service {
OnIqPacketReceived callback = new OnIqPacketReceived() {
private int i = 0;
+ private boolean success = true;
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
@@ -2347,10 +2349,28 @@ public class XmppConnectionService extends Service {
}
}
} else {
+ success = false;
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not request affiliation " + affiliations[i] + " in " + conversation.getJid().toBareJid());
}
++i;
if (i >= affiliations.length) {
+ List<Jid> members = conversation.getMucOptions().getMembers();
+ if (success) {
+ List<Jid> cryptoTargets = conversation.getAcceptedCryptoTargets();
+ boolean changed = false;
+ for (ListIterator<Jid> iterator = cryptoTargets.listIterator(); iterator.hasNext(); ) {
+ Jid jid = iterator.next();
+ if (!members.contains(jid)) {
+ iterator.remove();
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": removed " + jid + " from crypto targets of " + conversation.getName());
+ changed = true;
+ }
+ }
+ if (changed) {
+ conversation.setAcceptedCryptoTargets(cryptoTargets);
+ updateConversation(conversation);
+ }
+ }
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": retrieved members for " + conversation.getJid().toBareJid() + ": " + conversation.getMucOptions().getMembers());
getAvatarService().clear(conversation);
updateMucRosterUi();