diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-03-05 10:15:04 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-03-05 10:15:04 +0100 |
commit | c5230e081cd2c9a1c5b5bd0459e339668ff4cb6d (patch) | |
tree | eb3e1c9e44e9c41e9a056ca73d50e6e2d7bfc095 /src/main/java/eu | |
parent | e10c4e78f17dd7f428c139f1f4c29feb97b64099 (diff) |
added config option to disable string prep in jids
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/Config.java | 1 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 41e8971f0..2b9cee9fd 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -27,6 +27,7 @@ public final class Config { public static final int REFRESH_UI_INTERVAL = 500; public static final boolean NO_PROXY_LOOKUP = false; //useful to debug ibb + public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY / 2; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java index f6ab73bfa..c95e45f91 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java @@ -6,6 +6,7 @@ import net.java.otr4j.session.SessionID; import java.net.IDN; +import eu.siacs.conversations.Config; import gnu.inet.encoding.Stringprep; import gnu.inet.encoding.StringprepException; @@ -103,7 +104,7 @@ public final class Jid { } else { final String lp = jid.substring(0, atLoc); try { - localpart = Stringprep.nodeprep(lp); + localpart = Config.DISABLE_STRING_PREP ? lp : Stringprep.nodeprep(lp); } catch (final StringprepException e) { throw new InvalidJidException(InvalidJidException.STRINGPREP_FAIL, e); } @@ -118,7 +119,7 @@ public final class Jid { if (slashCount > 0) { final String rp = jid.substring(slashLoc + 1, jid.length()); try { - resourcepart = Stringprep.resourceprep(rp); + resourcepart = Config.DISABLE_STRING_PREP ? rp : Stringprep.resourceprep(rp); } catch (final StringprepException e) { throw new InvalidJidException(InvalidJidException.STRINGPREP_FAIL, e); } @@ -154,7 +155,7 @@ public final class Jid { throw new InvalidJidException(InvalidJidException.INVALID_PART_LENGTH); } - Jid.cache.put(jid,this); + Jid.cache.put(jid, this); this.displayjid = finaljid; } |