numhandlers = {}
msghandlers = {}
chanhandlers = {}
+ exceptionhandlers = [] # list of (Exception_class, handler_function) tuples
users = {}
chans = {}
def getchanhook(self, chan):
return self.chanhandlers[chan]
+ def hookexception(self, exc, handler):
+ self.exceptionhandlers.append((exc, handler))
+ def unhookexception(self, exc, handler):
+ self.exceptionhandlers.remove((exc, handler))
+ def hasexceptionhook(self, exc):
+ return any((True for x,h in self.exceptionhandlers if isinstance(exc, x)))
+ def getexceptionhook(self, exc):
+ return (h for x,h in self.exceptionhandlers if isinstance(exc, x))
+
def dbsetup():
main.db = None