Implement storing analytics on a LIST response

This commit is contained in:
2019-10-08 18:15:23 +01:00
parent 15b394bd79
commit 06d3dd4d7e
3 changed files with 67 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ from copy import deepcopy
from modules import userinfo
from modules import counters
from modules import monitor
from modules import chankeep
from core.relay import sendRelayNotification
from utils.dedup import dedup
@@ -119,6 +120,8 @@ class IRCBot(IRCClient):
self._tempList = ([], []) # Temporary storage for gathering LIST info
self.listOngoing = False
self.chanLimit = 0
def parsen(self, user):
step = user.split("!")
nick = step[0]
@@ -314,13 +317,15 @@ class IRCBot(IRCClient):
d = Deferred()
self._tempList = ([], [])
self._tempList[0].append(d)
self.sendLine("LIST")
self.sendLine("LIST >0")
return d
def list(self):
if not self.listOngoing:
self._list().addCallback(self.got_list)
self.listOngoing = True
def irc_RPL_LISTSTART(self, prefix, params):
self.listOngoing = True
def irc_RPL_LIST(self, prefix, params):
channel = params[1]
@@ -337,7 +342,20 @@ class IRCBot(IRCClient):
self._tempList[1].clear()
def got_list(self, listinfo):
print("have list", listinfo)
chankeep.initialList(self.net, self.num, listinfo, self.chanLimit)
def isupport(self, options):
for i in options:
if i.startswith("CHANLIMIT"):
if "#" in i:
split = i.split("#")
if len(split) >= 2:
chanLimit = split[-1].replace(":", "")
try:
self.chanLimit = int(chanLimit)
return
except TypeError:
error("Invalid CHANLIMIT: %s" % i)
#twisted sucks so i have to do this to actually get the user info
def irc_JOIN(self, prefix, params):
@@ -489,6 +507,7 @@ class IRCBotFactory(ReconnectingClientFactory):
def __init__(self, net, num=None, relayCommands=None, user=None, stage2=None):
if net == None:
self.num = num
self.net = None
self.name = "relay - %i" % num
self.relay = True
else: