diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-06-29 22:52:50 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-06-29 22:52:50 +0200 |
commit | 127981e3cbfca4b2bda85c93a0ad4877df0728a7 (patch) | |
tree | 5bfc0e154898d5da4abfd0dd2358e1163fc243fb /src/main/java/de/pixart/messenger/entities | |
parent | 81ba0b467e17c901c9d25dbea2331c7a848c7034 (diff) |
do not include white listed domains in room list
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/MucOptions.java | 24 |
1 files changed, 12 insertions, 12 deletions
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); } } |