aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-09-04 20:50:26 +0200
committerChristian Schneppe <christian@pix-art.de>2017-09-04 20:50:26 +0200
commit846008301cf24843aefa57c06b8969e9d1b6eeab (patch)
treebbafa168db43a8c61021922b9238e4517af232de /src/main/java/de/pixart/messenger/entities
parent4842181235241bdc362cfdce17c4ef5b3d2b9572 (diff)
don’t use xmpp or jabber as default muc nick
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 6560e3bb7..86c8c3326 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -3,6 +3,7 @@ package de.pixart.messenger.entities;
import android.annotation.SuppressLint;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -20,6 +21,8 @@ import de.pixart.messenger.xmpp.pep.Avatar;
@SuppressLint("DefaultLocale")
public class MucOptions {
+ private static List<String> LOCALPART_BLACKLIST = Arrays.asList("xmpp", "jabber");
+
private boolean mAutoPushConfiguration = true;
public Account getAccount() {
@@ -599,7 +602,14 @@ public class MucOptions {
} else if (!conversation.getJid().isBareJid()) {
return conversation.getJid().getResourcepart();
} else {
- return account.getUsername();
+ Jid jid = account.getJid();
+ if (LOCALPART_BLACKLIST.contains(jid.getLocalpart())) {
+ final String domain = jid.getDomainpart();
+ final int index = domain.lastIndexOf('.');
+ return index > 1 ? domain.substring(0, index) : domain;
+ } else {
+ return jid.getLocalpart();
+ }
}
}