Make the stats command aware of duplicate networks
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user