From edd7df67997320cf7e0edbed448065318eef9b70 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 15 Sep 2006 20:53:18 +0000 Subject: [PATCH] Escape on setting JID instead of getting JID. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5382 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/packet/Packet.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/org/jivesoftware/smack/packet/Packet.java b/source/org/jivesoftware/smack/packet/Packet.java index 1be71c8a3..2ad24125e 100644 --- a/source/org/jivesoftware/smack/packet/Packet.java +++ b/source/org/jivesoftware/smack/packet/Packet.java @@ -112,7 +112,7 @@ public abstract class Packet { * value has not been set. */ public String getTo() { - return StringUtils.escapeJID(to); + return to; } /** @@ -122,7 +122,8 @@ public abstract class Packet { * @param to who the packet is being sent to. */ public void setTo(String to) { - this.to = to; + // Use escaped version of the JID in case the user included invalid characters. + this.to = StringUtils.escapeJID(to); } /** @@ -134,7 +135,7 @@ public abstract class Packet { * valud has not been set. */ public String getFrom() { - return StringUtils.escapeJID(from); + return from; } /** @@ -145,7 +146,8 @@ public abstract class Packet { * @param from who the packet is being sent to. */ public void setFrom(String from) { - this.from = from; + // Use escaped version of the JID in case the user included invalid characters. + this.from = StringUtils.escapeJID(from); } /**