Commit 8a427672 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-158] Auto-kill spaces in JIDs instead of just escaping them.

[GATE-168] Added optional tweak to use percent hack instead of JID escaping.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6895 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0d69fb3d
...@@ -16,6 +16,7 @@ import org.dom4j.QName; ...@@ -16,6 +16,7 @@ import org.dom4j.QName;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.NotFoundException; import org.jivesoftware.util.NotFoundException;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.wildfire.SessionManager; import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.PluginManager; import org.jivesoftware.wildfire.container.PluginManager;
...@@ -834,7 +835,12 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -834,7 +835,12 @@ public abstract class BaseTransport implements Component, RosterEventListener {
* @return The legacy username as a JID. * @return The legacy username as a JID.
*/ */
public JID convertIDToJID(String username) { public JID convertIDToJID(String username) {
return new JID(JID.escapeNode(username), this.jid.getDomain(), null); if (JiveGlobals.getBooleanProperty("plugin.gateway.tweak.percenthack", false)) {
return new JID(username.replace('@', '%').replace(" ", ""), this.jid.getDomain(), null);
}
else {
return new JID(JID.escapeNode(username.replace(" ", "")), this.jid.getDomain(), null);
}
} }
/** /**
...@@ -844,8 +850,13 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -844,8 +850,13 @@ public abstract class BaseTransport implements Component, RosterEventListener {
* @return THe legacy username as a String. * @return THe legacy username as a String.
*/ */
public String convertJIDToID(JID jid) { public String convertJIDToID(JID jid) {
if (JiveGlobals.getBooleanProperty("plugin.gateway.tweak.percenthack", false)) {
return jid.getNode().replace('%', '@');
}
else {
return JID.unescapeNode(jid.getNode()); return JID.unescapeNode(jid.getNode());
} }
}
/** /**
* Gets an easy to use presence type from a presence packet. * Gets an easy to use presence type from a presence packet.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment