diff --git a/commands/stats.py b/commands/stats.py index 35d2d40..eab9a01 100644 --- a/commands/stats.py +++ b/commands/stats.py @@ -1,6 +1,7 @@ import main import modules.counters as count import modules.userinfo as userinfo +from string import digits class Stats: def __init__(self, register): @@ -15,8 +16,12 @@ class Stats: for i in main.IRCPool.keys(): numChannels += len(main.IRCPool[i].channels) numWhoEntries += userinfo.getNumTotalWhoEntries() - stats.append("Servers: %s" % len(main.pool.keys())) - stats.append("Online servers: %s" % len(main.IRCPool.keys())) + stats.append("Registered servers:") + stats.append(" Total: %s" % len(main.pool.keys())) + stats.append(" Unique: %s" % len(main.nets())) + stats.append("Online servers:") + stats.append(" Total: %s" % len(main.IRCPool.keys())) + stats.append(" Unique: %s" % len(main.liveNets())) stats.append("Channels: %s" % numChannels) stats.append("User records: %s" % numWhoEntries) counterEvents = count.getEvents() @@ -33,14 +38,20 @@ class Stats: stats = [] numChannels = 0 numWhoEntries = 0 + found = False + numNodes = 0 - if spl[1] in main.IRCPool.keys(): - numChannels += len(main.IRCPool[spl[1]].channels) - else: + for i in main.IRCPool.keys(): + if "".join([x for x in i if not x in digits]) == spl[1]: + numChannels += len(main.IRCPool[spl[1]].channels) + found = True + numNodes += 1 + if not found: failure("Name does not exist: %s" % spl[1]) numWhoEntries += userinfo.getNumWhoEntries(spl[1]) stats.append("Channels: %s" % numChannels) stats.append("User records: %s" % numWhoEntries) + stats.append("Endpoints: %s" % numNodes) counterEvents = count.getEvents(spl[1]) if counterEvents == None: stats.append("No counters records") diff --git a/core/bot.py b/core/bot.py index 18e9956..6bc0921 100644 --- a/core/bot.py +++ b/core/bot.py @@ -76,7 +76,7 @@ class IRCBot(IRCClient): def privmsg(self, user, channel, msg): nick, ident, host = self.parsen(user) - userinfo.editUser(self.net, channel, nick, user) + #userinfo.editUser(self.net, channel, nick, user) count.event(self.net, "privmsg") keyword.actKeyword(user, channel, msg, self.nickname, "MSG", self.name) diff --git a/main.py b/main.py index 24b78ef..cc08e94 100644 --- a/main.py +++ b/main.py @@ -31,8 +31,14 @@ def nets(): if not "pool" in globals(): return networks = set() - for i in pool: - networks.add("".join([x for x in i if not i in digits])) + for i in pool.keys(): + networks.add("".join([x for x in i if not x in digits])) + return networks + +def liveNets(): + networks = set() + for i in IRCPool.keys(): + networks.add("".join([x for x in i if not x in digits])) return networks def register(command, function):