diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-07 23:28:35 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-07 23:28:42 +0200 |
commit | 903a3d17f2055bdc5ba4f316419b158ce453bfda (patch) | |
tree | f7048f145227143c22122574579eb0d3ff3e118e /src/main/java/de/pixart/messenger/services/XmppConnectionService.java | |
parent | b1daabbb86e41d0a07737e0951530322f1cdedfe (diff) |
return contact and account.getServer() as String
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 6f6c4188b..5c19a9de2 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -65,6 +65,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; @@ -3753,42 +3754,40 @@ public class XmppConnectionService extends Service { } - public List<String> getKnownHosts() { - final List<String> hosts = new ArrayList<>(); + public Collection<String> getKnownHosts() { + final Set<String> hosts = new HashSet<>(); for (final Account account : getAccounts()) { - if (!hosts.contains(account.getServer().toString())) { - hosts.add(account.getServer().toString()); - } + hosts.add(account.getServer()); for (final Contact contact : account.getRoster().getContacts()) { if (contact.showInRoster()) { - final String server = contact.getServer().toString(); + final String server = contact.getServer(); if (server != null && !hosts.contains(server)) { hosts.add(server); } } } } - if (Config.DOMAIN_LOCK != null && !hosts.contains(Config.DOMAIN_LOCK)) { + if (Config.DOMAIN_LOCK != null) { hosts.add(Config.DOMAIN_LOCK); } - if (Config.MAGIC_CREATE_DOMAIN != null && !hosts.contains(Config.MAGIC_CREATE_DOMAIN)) { + if (Config.MAGIC_CREATE_DOMAIN != null) { hosts.add(Config.MAGIC_CREATE_DOMAIN); } return hosts; } - public List<String> getKnownConferenceHosts() { - final ArrayList<String> mucServers = new ArrayList<>(); + public Collection<String> getKnownConferenceHosts() { + final Set<String> mucServers = new HashSet<>(); for (final Account account : accounts) { if (account.getXmppConnection() != null) { final String server = account.getXmppConnection().getMucServer(); - if (server != null && !mucServers.contains(server)) { + if (server != null) { mucServers.add(server); } for (Bookmark bookmark : account.getBookmarks()) { final Jid jid = bookmark.getJid(); final String s = jid == null ? null : jid.getDomain(); - if (s != null && !mucServers.contains(s)) { + if (s != null) { mucServers.add(s); } } |