aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-06-29 22:52:50 +0200
committerChristian Schneppe <christian@pix-art.de>2018-06-29 22:52:50 +0200
commit127981e3cbfca4b2bda85c93a0ad4877df0728a7 (patch)
tree5bfc0e154898d5da4abfd0dd2358e1163fc243fb /src/main/java
parent81ba0b467e17c901c9d25dbea2331c7a848c7034 (diff)
do not include white listed domains in room list
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java2
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java24
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java2
4 files changed, 16 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 5d2982064..51da8ccb0 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -868,7 +868,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
jids = new ArrayList<>();
jids.add(conversation.getJid().asBareJid());
} else {
- jids = conversation.getMucOptions().getMembers();
+ jids = conversation.getMucOptions().getMembers(false);
}
return jids;
}
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 39afe65a6..2ef23882f 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -306,6 +306,10 @@ public class MucOptions {
}
+ public boolean isDomain() {
+ return realJid != null && realJid.getLocal() == null && role == Role.NONE;
+ }
+
@Override
public int hashCode() {
int result = role != null ? role.hashCode() : 0;
@@ -609,17 +613,13 @@ public class MucOptions {
public ArrayList<User> getUsers(boolean includeOffline) {
synchronized (users) {
- if (includeOffline) {
- return new ArrayList<>(users);
- } else {
- ArrayList<User> onlineUsers = new ArrayList<>();
- for (User user : users) {
- if (user.getRole().ranks(Role.PARTICIPANT)) {
- onlineUsers.add(user);
- }
+ ArrayList<User> users = new ArrayList<>();
+ for (User user : this.users) {
+ if (!user.isDomain() && (includeOffline || user.getRole().ranks(Role.PARTICIPANT))) {
+ users.add(user);
}
- return onlineUsers;
}
+ return users;
}
}
@@ -644,7 +644,7 @@ public class MucOptions {
jids.add(account.getJid().asBareJid());
synchronized (users) {
for(User user : users) {
- if (user.getRealJid() == null || jids.add(user.getRealJid())) {
+ if (user.getRealJid() == null || (user.getRealJid().getLocal() != null && jids.add(user.getRealJid()))) {
subset.add(user);
}
if (subset.size() >= max) {
@@ -845,11 +845,11 @@ public class MucOptions {
return this.conversation;
}
- public List<Jid> getMembers() {
+ public List<Jid> getMembers(final boolean includeDomains) {
ArrayList<Jid> members = new ArrayList<>();
synchronized (users) {
for (User user : users) {
- if (user.affiliation.ranks(Affiliation.MEMBER) && user.realJid != null) {
+ if (user.affiliation.ranks(Affiliation.MEMBER) && user.realJid != null && (!user.isDomain() || includeDomains)) {
members.add(user.realJid);
}
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index b6a28ac3c..3b2699667 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2470,13 +2470,13 @@ public class XmppConnectionService extends Service {
}
++i;
if (i >= affiliations.length) {
- List<Jid> members = conversation.getMucOptions().getMembers();
+ List<Jid> members = conversation.getMucOptions().getMembers(true);
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)) {
+ if (!members.contains(jid) && !members.contains(Jid.ofDomain(jid.getDomain()))) {
iterator.remove();
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": removed " + jid + " from crypto targets of " + conversation.getName());
changed = true;
@@ -2487,7 +2487,6 @@ public class XmppConnectionService extends Service {
updateConversation(conversation);
}
}
- Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retrieved members for " + conversation.getJid().asBareJid() + ": " + conversation.getMucOptions().getMembers());
getAvatarService().clear(conversation);
updateMucRosterUi();
updateConversationUi();
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index 4782d371f..4b0477e1a 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -292,7 +292,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
setSupportActionBar((Toolbar) binding.toolbar);
configureActionBar(getSupportActionBar());
this.binding.editNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(),
- R.string.nickname_for_this_group_chat,
+ R.string.nickname,
value -> {
if (xmppConnectionService.renameInMuc(mConversation, value, renameCallback)) {
return null;