diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-07-17 20:50:03 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-07-17 20:50:03 +0200 |
commit | fa07274d2d5c0f59ce5f83b4b7a76c2a637686e1 (patch) | |
tree | 5697878128f7053ebcdb4584055222da6f0da76f /src/main/java/de | |
parent | 6e93f698a138122f61915cce190292c8a487c811 (diff) |
split on first dot when using domain instead of black listed local part
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/JidHelper.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/JidHelper.java b/src/main/java/de/pixart/messenger/utils/JidHelper.java index 6b0dc0122..830dd817c 100644 --- a/src/main/java/de/pixart/messenger/utils/JidHelper.java +++ b/src/main/java/de/pixart/messenger/utils/JidHelper.java @@ -39,12 +39,12 @@ import rocks.xmpp.addr.Jid; public class JidHelper { - private static List<String> LOCALPART_BLACKLIST = Arrays.asList("xmpp", "jabber", "me"); + private static List<String> LOCAL_PART_BLACKLIST = Arrays.asList("xmpp", "jabber", "me"); public static String localPartOrFallback(Jid jid) { - if (LOCALPART_BLACKLIST.contains(jid.getLocal().toLowerCase(Locale.ENGLISH))) { + if (LOCAL_PART_BLACKLIST.contains(jid.getLocal().toLowerCase(Locale.ENGLISH))) { final String domain = jid.getDomain(); - final int index = domain.lastIndexOf('.'); + final int index = domain.indexOf('.'); return index > 1 ? domain.substring(0, index) : domain; } else { return jid.getLocal(); @@ -58,4 +58,5 @@ public class JidHelper { return InvalidJid.of(jid, true); } } + }
\ No newline at end of file |