aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-09 20:11:17 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-09 20:11:17 +0100
commit1693f715437e5c1e03c2bfa5d0c87f696c675de3 (patch)
tree3d1c76f7a28d6a0b0a457e60aa6bd7c866bf755f /src/main/java/de/pixart
parent9cae1f7a6002acfc6b5299c599756093136c70d4 (diff)
cleaned code of muc name generator
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 77fd1189c..5831a7da5 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -595,20 +595,16 @@ public class MucOptions {
public String createNameFromParticipants() {
if (users.size() >= 1) {
- List<String> names = new ArrayList<>();
+ StringBuilder builder = new StringBuilder();
for (User user : getUsers(5)) {
+ if (builder.length() != 0) {
+ builder.append(", ");
+ }
Contact contact = user.getContact();
if (contact != null && !contact.getDisplayName().isEmpty()) {
- names.add(contact.getDisplayName().split("\\s+")[0]);
+ builder.append(contact.getDisplayName().split("\\s+")[0]);
} else if (user.getName() != null) {
- names.add(user.getName());
- }
- }
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < names.size(); ++i) {
- builder.append(names.get(i));
- if (i != names.size() - 1) {
- builder.append(", ");
+ builder.append(user.getName());
}
}
return builder.toString();