From 5f563f6c2602a6e0a8d7a76ff2e19414c20906e6 Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 8 Jan 2013 06:14:58 +0000 Subject: [PATCH] show online status of known users in web + nick tracking fixes --- modules/users/users.js | 5 +++-- modules/users/web.js | 19 +++++++++++++++++-- views/users/users.jade | 10 +++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/modules/users/users.js b/modules/users/users.js index 2d57193..d08c91f 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -38,13 +38,14 @@ var users = function(dbot) { var knownUsers = getServerUsers(event.server); if(!knownUsers.channelUsers.hasOwnProperty(event.channel.name)) { knownUsers.channelUsers[event.channel.name] = []; + event.reply('creating new chanusers') } var channelUsers = knownUsers.channelUsers[event.channel.name]; event.channel.nicks.each(function(nick) { nick = nick.name; if(api.isKnownUser(event.server, nick)) { - nick = api.resolveUser(nick); + nick = api.resolveUser(event.server, nick); } else { knownUsers.users.push(nick); } @@ -167,7 +168,7 @@ var users = function(dbot) { var channelUsers = knownUsers.channelUsers[event.channel.name]; if(api.isKnownUser(event.server, nick)) { - nick = api.resolveUser(nick); + nick = api.resolveUser(event.server, nick); } else { knownUsers.users.push(nick); } diff --git a/modules/users/web.js b/modules/users/web.js index b6d4ad2..ff7754b 100644 --- a/modules/users/web.js +++ b/modules/users/web.js @@ -22,9 +22,24 @@ var pages = function(dbot) { if(connections.hasOwnProperty(connection) && connections[connection].channels.hasOwnProperty(channel)) { - var nicks = Object.keys(connections[connection].channels[channel].nicks); + + var nicks = dbot.db.knownUsers[connection].channelUsers[channel]; + var channelUsers = {}; + for(var i=0;i