WebStats: add join, parts, and quits managment
parent
9ee24ef683
commit
ef637f7b48
|
@ -386,6 +386,36 @@ class WebStats(callbacks.Plugin):
|
||||||
self.db.recordMessage(channel, nick, content)
|
self.db.recordMessage(channel, nick, content)
|
||||||
doNotice = doPrivmsg
|
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
|
Class = WebStats
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,10 @@ def progressbar(item, max_):
|
||||||
<div class="text">%i</div>
|
<div class="text">%i</div>
|
||||||
<div style="width: %ipx" class="color"></div>
|
<div style="width: %ipx" class="color"></div>
|
||||||
</td>"""
|
</td>"""
|
||||||
template %= (item, round(float(item)/float(max_)*100))
|
try:
|
||||||
|
template %= (item, round(float(item)/float(max_)*100))
|
||||||
|
except ZeroDivisionError:
|
||||||
|
template %= (item, 0)
|
||||||
return template
|
return template
|
||||||
|
|
||||||
def get(useSkeleton, channel, db):
|
def get(useSkeleton, channel, db):
|
||||||
|
@ -34,10 +37,13 @@ def get(useSkeleton, channel, db):
|
||||||
<th>%s</th>
|
<th>%s</th>
|
||||||
<th style="width: 100px;">%s</th>
|
<th style="width: 100px;">%s</th>
|
||||||
<th style="width: 100px;">%s</th>
|
<th style="width: 100px;">%s</th>
|
||||||
|
<th style="width: 100px;">%s</th>
|
||||||
|
<th style="width: 100px;">%s</th>
|
||||||
|
<th style="width: 100px;">%s</th>
|
||||||
</tr>"""
|
</tr>"""
|
||||||
output %= (_('Hour'), _('Lines'), _('Words'))
|
output %= (_('Hour'), _('Lines'), _('Words'), _('Joins'), _('Parts'), _('Quits'))
|
||||||
items = db.getChanXXlyData(channel, 'hour')
|
items = db.getChanXXlyData(channel, 'hour')
|
||||||
max_ = [0, 0]
|
max_ = [0, 0, 0, 0, 0, 0]
|
||||||
for hour in items:
|
for hour in items:
|
||||||
for index in range(0, len(max_)):
|
for index in range(0, len(max_)):
|
||||||
max_[index] = max(max_[index], items[hour][index])
|
max_[index] = max(max_[index], items[hour][index])
|
||||||
|
@ -46,10 +52,16 @@ def get(useSkeleton, channel, db):
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
</tr>""" % \
|
</tr>""" % \
|
||||||
(hour,
|
(hour,
|
||||||
progressbar(items[hour][0], max_[0]),
|
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 += '</table>'
|
output += '</table>'
|
||||||
if useSkeleton:
|
if useSkeleton:
|
||||||
|
|
Loading…
Reference in New Issue