Commit ef5c5b56 authored by JC Brand's avatar JC Brand

Make sure that bare jids are used for chatboxes.

parent eb8fb67b
...@@ -32,7 +32,7 @@ xmppchat.UI = (function (xmppUI, $, console) { ...@@ -32,7 +32,7 @@ xmppchat.UI = (function (xmppUI, $, console) {
} else { } else {
xmppchat.Presence.getUserInfo(user_id, function (data) { xmppchat.Presence.getUserInfo(user_id, function (data) {
if ($('#online-users-' + user_id).length > 0) { return; } if ($('#online-users-' + user_id).length > 0) { return; }
var li = $('<li></li>').attr('id', 'online-users-'+user_id).attr('data-recipient', jid); var li = $('<li></li>').attr('id', 'online-users-'+user_id).attr('data-recipient', bare_jid);
li.append($('<a></a>').addClass('user-details-toggle').text(data.fullname)); li.append($('<a></a>').addClass('user-details-toggle').text(data.fullname));
$('#online-users').append(li); $('#online-users').append(li);
}); });
...@@ -173,8 +173,9 @@ xmppchat.UI = (function (xmppUI, $, console) { ...@@ -173,8 +173,9 @@ xmppchat.UI = (function (xmppUI, $, console) {
// //
// This method can be deferred. // This method can be deferred.
// http://www.erichynds.com/jquery/using-deferreds-in-jquery/ // http://www.erichynds.com/jquery/using-deferreds-in-jquery/
var chat_content, var bare_jid = Strophe.getBareJidFromJid(jid),
chat_id = helpers.hash(jid), chat_content,
chat_id = helpers.hash(bare_jid),
$chat = $("#"+chat_id), $chat = $("#"+chat_id),
that = this, that = this,
dfd = $.Deferred(); dfd = $.Deferred();
...@@ -189,18 +190,18 @@ xmppchat.UI = (function (xmppUI, $, console) { ...@@ -189,18 +190,18 @@ xmppchat.UI = (function (xmppUI, $, console) {
} else { } else {
// The chatbox exists, merely hidden // The chatbox exists, merely hidden
$chat.show('fast', function () { $chat.show('fast', function () {
that.prepNewChat(this, jid); that.prepNewChat(this, bare_jid);
that.reorderChats(); that.reorderChats();
callback(this); callback(this);
dfd.resolve(); dfd.resolve();
}); });
} }
} else { } else {
this.createChatbox(jid, function ($chat) { this.createChatbox(bare_jid, function ($chat) {
// that.retrieveCollections(); // that.retrieveCollections();
that.positionNewChat($chat); that.positionNewChat($chat);
$chat.show('fast', function () { $chat.show('fast', function () {
that.prepNewChat(this, jid); that.prepNewChat(this, bare_jid);
that.handleChatEvents(chat_id); that.handleChatEvents(chat_id);
callback(this); callback(this);
dfd.resolve(); dfd.resolve();
......
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