forked from GitHub/dbot
Activity indicator [#111]
This commit is contained in:
parent
4939446116
commit
c28047efc1
@ -38,7 +38,6 @@ 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];
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
var pages = function(dbot) {
|
||||
var connections = dbot.instance.connections;
|
||||
|
||||
return {
|
||||
'/connections': function(req, res) {
|
||||
var connections = Object.keys(dbot.instance.connections);
|
||||
@ -23,23 +25,31 @@ var pages = function(dbot) {
|
||||
if(connections.hasOwnProperty(connection) &&
|
||||
connections[connection].channels.hasOwnProperty(channel)) {
|
||||
|
||||
var nicks = dbot.db.knownUsers[connection].channelUsers[channel];
|
||||
var channelUsers = {};
|
||||
for(var i=0;i<nicks.length;i++) {
|
||||
channelUsers[nicks[i]] = { 'name': nicks[i], 'online': false };
|
||||
console.log(nicks[i]);
|
||||
var channelUsers = dbot.db.knownUsers[connection].channelUsers[channel];
|
||||
var usersData = {};
|
||||
for(var i=0;i<channelUsers.length;i++) {
|
||||
usersData[channelUsers[i]] = {
|
||||
'name': channelUsers[i],
|
||||
'online': false,
|
||||
'active': false
|
||||
};
|
||||
}
|
||||
|
||||
var channelOnline = dbot.instance.connections[connection].channels[channel].nicks;
|
||||
channelOnline.each(function(nick) {
|
||||
var onlineNicks = connections[connection].channels[channel].nicks;
|
||||
onlineNicks.each(function(nick) {
|
||||
var nick = dbot.api.users.resolveUser(connection, nick);
|
||||
if(channelUsers.hasOwnProperty(nick)) {
|
||||
channelUsers[nick].online = true;
|
||||
if(onlineNicks.hasOwnProperty(nick)) {
|
||||
usersData[nick].online = true;
|
||||
}
|
||||
/*usersData[nick].active = dbot.api.stats.isActive({
|
||||
'server': connection,
|
||||
'user': nick,
|
||||
'channel': channel
|
||||
});*/
|
||||
}.bind(this));
|
||||
|
||||
res.render('users', { 'name': dbot.config.name, 'connection': connection,
|
||||
'channel': channel, 'nicks': channelUsers });
|
||||
'channel': channel, 'nicks': usersData });
|
||||
} else {
|
||||
res.render_core('error', { 'name': dbot.config.name, 'message': 'No such connection or channel.' });
|
||||
}
|
||||
|
@ -9,6 +9,9 @@ block content
|
||||
if nicks.hasOwnProperty(nick.name)
|
||||
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick)
|
||||
if nick.online
|
||||
li.quotes #{nick.name} (Online)
|
||||
if nick.active
|
||||
li.quotes #{nick.name} (Online, Active)
|
||||
else
|
||||
li.quotes #{nick.name} (Online, Inactive)
|
||||
else
|
||||
li.quotes #{nick.name} (Offline)
|
||||
|
Loading…
Reference in New Issue
Block a user