diff --git a/WebStats/plugin.py b/WebStats/plugin.py index 05a49a5..2eef671 100644 --- a/WebStats/plugin.py +++ b/WebStats/plugin.py @@ -386,6 +386,36 @@ class WebStats(callbacks.Plugin): self.db.recordMessage(channel, nick, content) doNotice = doPrivmsg + def doJoin(self, irc, msg): + channel = msg.args[0] + if not self.registryValue('channel.enable', channel): + return + nick = msg.prefix.split('!')[0] + self.db.recordMove(channel, nick, 'join') + + def doPart(self, irc, msg): + channel = msg.args[0] + if not self.registryValue('channel.enable', channel): + return + if len(msg.args) > 1: + message = msg.args[1] + else: + message = '' + nick = msg.prefix.split('!')[0] + self.db.recordMove(channel, nick, 'part', message) + + def doQuit(self, irc, msg): + channel = msg.args[0] + if not self.registryValue('channel.enable', channel): + return + nick = msg.prefix.split('!')[0] + if len(msg.args) > 1: + message = msg.args[1] + else: + message = '' + nick = msg.prefix.split('!')[0] + self.db.recordMove(channel, nick, 'quit', message) + Class = WebStats diff --git a/WebStats/templates/chan_index.py b/WebStats/templates/chan_index.py index f60fa23..c02d9bd 100644 --- a/WebStats/templates/chan_index.py +++ b/WebStats/templates/chan_index.py @@ -17,7 +17,10 @@ def progressbar(item, max_):
%i
""" - template %= (item, round(float(item)/float(max_)*100)) + try: + template %= (item, round(float(item)/float(max_)*100)) + except ZeroDivisionError: + template %= (item, 0) return template def get(useSkeleton, channel, db): @@ -34,10 +37,13 @@ def get(useSkeleton, channel, db): %s %s %s + %s + %s + %s """ - output %= (_('Hour'), _('Lines'), _('Words')) + output %= (_('Hour'), _('Lines'), _('Words'), _('Joins'), _('Parts'), _('Quits')) items = db.getChanXXlyData(channel, 'hour') - max_ = [0, 0] + max_ = [0, 0, 0, 0, 0, 0] for hour in items: for index in range(0, len(max_)): max_[index] = max(max_[index], items[hour][index]) @@ -46,10 +52,16 @@ def get(useSkeleton, channel, db): %s %s %s + %s + %s + %s """ % \ (hour, progressbar(items[hour][0], max_[0]), - progressbar(items[hour][1], max_[1]) + progressbar(items[hour][1], max_[1]), + progressbar(items[hour][3], max_[3]), + progressbar(items[hour][4], max_[4]), + progressbar(items[hour][5], max_[5]) ) output += '' if useSkeleton: