]> jfr.im git - erebus.git/blobdiff - erebus.py
added ability to hook all messages to a certain channel
[erebus.git] / erebus.py
index d96ae0becb650b4a93cca93c7b99aa247362ee0c..3091760f473cc9115d98d576c33d7487c531cdd2 100644 (file)
--- a/erebus.py
+++ b/erebus.py
@@ -201,6 +201,18 @@ class Erebus(object):
        def getnumhook(self, word):
                return self.numhandlers[word]
 
+       def hookchan(self, chan, handler):
+               try:
+                       self.chanhandlers[word].append(handler)
+               except:
+                       self.chanhandlers[word] = [handler]
+       def unhookchan(self, chan, handler):
+               if chan in self.chanhandlers and handler in self.chanhandlers[chan]:
+                       self.chanhandlers[chan].remove(handler)
+       def haschanhook(self, chan):
+               return chan in self.chanhandlers and len(self.chanhandlers[chan]) != 0
+       def getchanhook(self, chan):
+               return self.chanhandlers[chan]
 
 
 class MyCursor(MySQLdb.cursors.DictCursor):