From 440900626db4d1b1b65752b9b882295664a63b82 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sun, 24 Jun 2012 11:33:34 +0200 Subject: [PATCH] Use getUserInfo to get the user's fullname. --- chatui.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/chatui.js b/chatui.js index 931cb97eb..a7d0730dd 100644 --- a/chatui.js +++ b/chatui.js @@ -26,24 +26,15 @@ xmppchat.UI = (function (xmppUI, $, console) { } existing_user_element.attr('class', status); } else { - if ($('#online-users-' + user_id).length > 0) { - return; - } - var li = $('
  • ').attr('id', 'online-users-'+user_id).attr('data-recipient', jid); - li.append($('').addClass('user-details-toggle').text(user_id)); - $('#online-users').append(li); - // Pre-fetch user info if we have a session storage. - if (xmppchat.Storage.storage !== null) { - xmppchat.Presence.getUserInfo(user_id, function (data) {}); - } + if ($('#online-users-' + user_id).length > 0) { return; } + xmppchat.Presence.getUserInfo(user_id, function (data) { + if ($('#online-users-' + user_id).length > 0) { return; } + var li = $('
  • ').attr('id', 'online-users-'+user_id).attr('data-recipient', jid); + li.append($('').addClass('user-details-toggle').text(data.fullname)); + $('#online-users').append(li); + }); } - online_count = xmppchat.Presence.onlineCount(); - if (online_count > 0) { - $('#no-users-online').hide(); - } else { - $('#no-users-online').show(); - } - $('#online-count').text(online_count); + $('#online-count').text(xmppchat.Presence.onlineCount()); }; ob.positionNewChat = function ($chat) {