aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-07 23:28:35 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-07 23:28:42 +0200
commit903a3d17f2055bdc5ba4f316419b158ce453bfda (patch)
treef7048f145227143c22122574579eb0d3ff3e118e /src/main/java/de/pixart/messenger/services
parentb1daabbb86e41d0a07737e0951530322f1cdedfe (diff)
return contact and account.getServer() as String
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r--src/main/java/de/pixart/messenger/services/AvatarService.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java23
4 files changed, 15 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java
index 4e3ed756b..96114727e 100644
--- a/src/main/java/de/pixart/messenger/services/AvatarService.java
+++ b/src/main/java/de/pixart/messenger/services/AvatarService.java
@@ -220,7 +220,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
final List<MucOptions.User> users = mucOptions.getUsersRelevantForNameAndAvatar();
if (users.size() == 0) {
Conversation c = mucOptions.getConversation();
- bitmap = getImpl(c.getName(), c.getJid().asBareJid().toString(), size);
+ bitmap = getImpl(c.getName().toString(), c.getJid().asBareJid().toString(), size);
} else {
bitmap = getImpl(users, size);
}
diff --git a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
index 53a7b6625..e05c719dc 100644
--- a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
+++ b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
@@ -46,7 +46,7 @@ public class ContactChooserTargetService extends ChooserTargetService implements
final int pixel = (int) (48 * getResources().getDisplayMetrics().density);
for (int i = 0; i < Math.min(conversations.size(), MAX_TARGETS); ++i) {
final Conversation conversation = conversations.get(i);
- final String name = conversation.getName();
+ final String name = conversation.getName().toString();
final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel));
final float score = 1 - (1.0f / MAX_TARGETS) * i;
final Bundle extras = new Bundle();
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index ad6c9f518..64c168a1b 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -350,7 +350,7 @@ public class NotificationService {
for (final ArrayList<Message> messages : notifications.values()) {
if (messages.size() > 0) {
conversation = messages.get(0).getConversation();
- final String name = conversation.getName();
+ final String name = conversation.getName().toString();
SpannableString styledString;
if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) {
int count = messages.size();
@@ -389,7 +389,7 @@ public class NotificationService {
final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
if (messages.size() >= 1) {
final Conversation conversation = messages.get(0).getConversation();
- final UnreadConversation.Builder mUnreadBuilder = new UnreadConversation.Builder(conversation.getName());
+ final UnreadConversation.Builder mUnreadBuilder = new UnreadConversation.Builder(conversation.getName().toString());
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
.get(conversation, getPixel(64)));
mBuilder.setContentTitle(conversation.getName());
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);
}
}