diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-10 19:42:37 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-10 19:42:37 +0200 |
commit | a523127a805db12a82701ccf7cf6a21d979607d2 (patch) | |
tree | 3a0abf186f80123c9070a7b5e7d107bc0e7b6960 /src/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | e97b5244552c8da06b3311bccb831be30c9a641a (diff) |
fixed #38
Diffstat (limited to 'src/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 9993dd67..fb6297e7 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.services; import java.security.SecureRandom; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; @@ -1496,4 +1497,22 @@ public class XmppConnectionService extends Service { }).start(); } + + public List<String> getKnownHosts() { + List<String> hosts = new ArrayList<String>(); + for(Account account : getAccounts()) { + if (!hosts.contains(account.getServer())) { + hosts.add(account.getServer()); + } + for(Contact contact : account.getRoster().getContacts()) { + if (contact.showInRoster()) { + String server = contact.getServer(); + if (server!=null && !hosts.contains(server)) { + hosts.add(server); + } + } + } + } + return hosts; + } } |