do not include white listed domains in room list. fixes #3082
This commit is contained in:
parent
1fc432af53
commit
e6532e739a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -610,17 +614,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,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) {
|
||||
|
@ -834,11 +834,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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2220,13 +2220,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;
|
||||
|
@ -2237,7 +2237,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();
|
||||
|
|
|
@ -244,7 +244,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;
|
||||
|
|
|
@ -720,5 +720,5 @@
|
|||
<string name="host_does_not_support_group_chat_avatars">Host does not support group chat avatars</string>
|
||||
<string name="only_the_owner_can_change_group_chat_avatar">Only the owner can change group chat avatar</string>
|
||||
<string name="contact_name">Contact name</string>
|
||||
<string name="nickname_for_this_group_chat">Nickname for this group chat</string>
|
||||
<string name="nickname">Nickname</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue