From 19ef0f8c71ca7e813c3cda359286eaf0150ae059 Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 3 Sep 2015 16:13:01 +0200 Subject: [PATCH 1/2] Fix #461: MUC working with spaces etc. in room names --- converse.js | 9 +++++---- src/templates/chatroom.html | 2 +- src/templates/room_item.html | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/converse.js b/converse.js index 458505d8c..0d2ab7959 100644 --- a/converse.js +++ b/converse.js @@ -2319,15 +2319,16 @@ else { $nick.removeClass('error'); } if (ev.type === 'click') { + name = $(ev.target).text(); jid = $(ev.target).attr('data-room-jid'); } else { $name = this.$el.find('input.new-chatroom-name'); $server= this.$el.find('input.new-chatroom-server'); server = $server.val(); - name = $name.val().trim().toLowerCase(); + name = $name.val().trim(); $name.val(''); // Clear the input if (name && server) { - jid = Strophe.escapeNode(name) + '@' + server; + jid = Strophe.escapeNode(name.toLowerCase()) + '@' + server; $name.removeClass('error'); $server.removeClass('error'); this.model.save({muc_domain: server}); @@ -2341,7 +2342,7 @@ chatroom = converse.chatboxviews.showChat({ 'id': jid, 'jid': jid, - 'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)), + 'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)), 'nick': nick, 'chatroom': true, 'box_id' : b64_sha1(jid) @@ -3009,7 +3010,7 @@ getRoomJIDAndNick: function (nick) { nick = nick || this.model.get('nick'); var room = this.model.get('jid'); - var node = Strophe.escapeNode(Strophe.getNodeFromJid(room)); + var node = Strophe.getNodeFromJid(room); var domain = Strophe.getDomainFromJid(room); return node + "@" + domain + (nick !== null ? "/" + nick : ""); }, diff --git a/src/templates/chatroom.html b/src/templates/chatroom.html index 9118b0a59..6e4ccbc72 100644 --- a/src/templates/chatroom.html +++ b/src/templates/chatroom.html @@ -5,7 +5,7 @@ -
{{ name }}
+
{{ _.escape(name) }}

diff --git a/src/templates/room_item.html b/src/templates/room_item.html index cd62c9cda..7d2a8a6d8 100644 --- a/src/templates/room_item.html +++ b/src/templates/room_item.html @@ -1,6 +1,6 @@
{{name}} + title="{{open_title}}" href="#">{{_.escape(name)}}  
From d08ce409c82aa3479d55ed475dbf1e71b75beb28 Mon Sep 17 00:00:00 2001 From: Christoph Geschwind Date: Fri, 4 Sep 2015 13:26:33 +0200 Subject: [PATCH 2/2] Add #462 to CHANGES.rst --- docs/CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index 8aa5fc316..8758ab8b0 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -9,6 +9,7 @@ Changelog * #440 null added as resource to contact [jcbrand] * Add new event serviceDiscovered [jcbrand] * Add a new configuration setting `muc_history_max_stanzas `_. [jcbrand] +* #462 Fix MUC rooms with names containing special characters not working [1st8] 0.9.4 (2015-07-04) ------------------