split on first dot when using domain instead of black listed local part
This commit is contained in:
parent
bc3e5f1dd4
commit
97598c63dc
|
@ -39,13 +39,13 @@ 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('.');
|
||||
return index > 1 ? domain.substring(0,index) : domain;
|
||||
final int index = domain.indexOf('.');
|
||||
return index > 1 ? domain.substring(0, index) : domain;
|
||||
} else {
|
||||
return jid.getLocal();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue