aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index a95debd89..8ec3cbfd4 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -394,10 +394,18 @@ public class MucOptions {
if (user != null) {
synchronized (users) {
users.remove(user);
- if (membersOnly() &&
- nonanonymous() &&
- user.affiliation.ranks(Affiliation.MEMBER) &&
- user.realJid != null) {
+ boolean realJidInMuc = false;
+ for (User u : users) {
+ if (user.realJid != null && user.realJid.equals(u.realJid)) {
+ realJidInMuc = true;
+ break;
+ }
+ }
+ if (membersOnly()
+ && nonanonymous()
+ && user.affiliation.ranks(Affiliation.MEMBER)
+ && user.realJid != null
+ && !realJidInMuc) {
user.role = Role.NONE;
user.avatar = null;
user.fullJid = null;
@@ -507,8 +515,19 @@ public class MucOptions {
}
public List<User> getUsers(int max) {
- ArrayList<User> users = getUsers();
- return users.subList(0, Math.min(max, users.size()));
+ ArrayList<User> subset = new ArrayList<>();
+ HashSet<Jid> jids = new HashSet<>();
+ synchronized (users) {
+ for(User user : users) {
+ if (user.getRealJid() == null || jids.add(user.getRealJid())) {
+ subset.add(user);
+ }
+ if (subset.size() >= max) {
+ break;
+ }
+ }
+ }
+ return subset;
}
public int getUserCount() {