about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/main.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/main.js b/scripts/main.js
index 5c4e9c4..8a79b4f 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -48,15 +48,16 @@
 			key_prefix = "muc.";
 		}
 
-		var jid_parts = display_data.jid.split("?");
-		jid_parts[0] = encodeURIComponent(jid_parts[0]) // URL-encode the JID only
-		display_data.jid = jid_parts.join("?");
-
 		// TODO: proper error checking / display / Creation of invitations
 		if (jid.search("@") <= 0) return {jid:"", name: "Somebody"};
 
 		var name = jid.split("@")[0];
 		name = name.charAt(0).toUpperCase() + name.slice(1);
+
+		var jid_parts = jid.split("?");
+		jid_parts[0] = encodeURIComponent(jid_parts[0]) // URL-encode the JID only
+		jid = jid_parts.join("?");
+
 		return {jid: jid, name: name};
 	}