From 14952ba5e5ffbbbda2d0453157f03779ffbdaffb Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 17 May 2016 10:43:48 +0200 Subject: offer offline members to be invited again --- .../eu/siacs/conversations/entities/MucOptions.java | 18 ++++++++++++++++-- .../java/eu/siacs/conversations/ui/XmppActivity.java | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 50641f5a..e931f5fd 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -349,7 +349,7 @@ public class MucOptions { User user = findUserByFullJid(jid); if (user != null) { users.remove(user); - if (user.affiliation.ranks(Affiliation.MEMBER)) { + if (user.affiliation.ranks(Affiliation.MEMBER) && user.realJid != null) { user.role = Role.NONE; user.avatar = null; user.fullJid = null; @@ -417,7 +417,21 @@ public class MucOptions { } public ArrayList getUsers() { - return new ArrayList<>(users); + return getUsers(true); + } + + public ArrayList getUsers(boolean includeOffline) { + if (includeOffline) { + return new ArrayList<>(users); + } else { + ArrayList onlineUsers = new ArrayList<>(); + for(User user : users) { + if(user.getRole().ranks(Role.PARTICIPANT)) { + onlineUsers.add(user); + } + } + return onlineUsers; + } } public List getUsers(int max) { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index e963ef4c..858806e3 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -478,7 +478,7 @@ public abstract class XmppActivity extends Activity { ChooseContactActivity.class); List contacts = new ArrayList<>(); if (conversation.getMode() == Conversation.MODE_MULTI) { - for (MucOptions.User user : conversation.getMucOptions().getUsers()) { + for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) { Jid jid = user.getRealJid(); if (jid != null) { contacts.add(jid.toBareJid().toString()); -- cgit v1.2.3