From 846008301cf24843aefa57c06b8969e9d1b6eeab Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 4 Sep 2017 20:50:26 +0200 Subject: =?UTF-8?q?don=E2=80=99t=20use=20xmpp=20or=20jabber=20as=20default?= =?UTF-8?q?=20muc=20nick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/de/pixart/messenger/entities/MucOptions.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/pixart/messenger/entities') 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 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(); + } } } -- cgit v1.2.3