X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/6b4ba0b651d53a40629a59d4a5df8767217c7386..56580e4e6b07ddb00b7046e77dc007626ce130fb:/erebus.py diff --git a/erebus.py b/erebus.py index 12be844..fb6fcc8 100644 --- a/erebus.py +++ b/erebus.py @@ -7,7 +7,7 @@ from __future__ import print_function import os, sys, select, time, traceback, random, gc -import bot, config, ctlmod +import bot, config, ctlmod, modlib class Erebus(object): #singleton to pass around APIVERSION = 0 @@ -124,6 +124,8 @@ class Erebus(object): #singleton to pass around self.voices = [] self.ops = [] + self.deleting = False # if true, the bot will remove cached records of this channel when the bot sees that it has left the channel + c = main.query("SELECT user, level FROM chusers WHERE chan = %s", (self.name,)) if c: row = c.fetchone() @@ -239,6 +241,8 @@ class Erebus(object): #singleton to pass around self.bots[nick.lower()] = obj def newfd(self, obj, fileno): + if not isinstance(obj, modlib.Socketlike): + raise Exception('Attempted to hook a socket without a class to process data') self.fds[fileno] = obj if self.potype == "poll": self.po.register(fileno, select.POLLIN) @@ -424,7 +428,7 @@ def loop(): try: data = main.fd(fileno).getdata() except: - main.log('*', '!', 'Super-mega-emergency: getdata raised exception for socket %d' % (fileno)) + main.log('*', '!', 'Error receiving data: getdata raised exception for socket %d, closing' % (fileno)) traceback.print_exc() data = None if data is None: @@ -436,7 +440,7 @@ def loop(): try: main.fd(fileno).parse(line) except: - main.log('*', '!', 'Super-mega-emergency: parse raised exception for socket %d data %r' % (fileno, line)) + main.log('*', '!', 'Error receiving data: parse raised exception for socket %d data %r, ignoring' % (fileno, line)) traceback.print_exc() if main.mustquit is not None: main.log('*', '!', 'Core exiting due to: %s' % (main.mustquit))