offer offline members to be invited again

This commit is contained in:
Daniel Gultsch 2016-05-17 10:43:48 +02:00
parent fc5304c6fe
commit 14952ba5e5
2 changed files with 17 additions and 3 deletions

View file

@ -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<User> getUsers() {
return new ArrayList<>(users);
return getUsers(true);
}
public ArrayList<User> getUsers(boolean includeOffline) {
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);
}
}
return onlineUsers;
}
}
public List<User> getUsers(int max) {

View file

@ -478,7 +478,7 @@ public abstract class XmppActivity extends Activity {
ChooseContactActivity.class);
List<String> 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());