added config option to disable string prep in jids

This commit is contained in:
iNPUTmice 2015-03-05 10:15:04 +01:00
parent e10c4e78f1
commit c5230e081c
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}