+ self.numhooks[str(num)] = func
+ if self.parent is not None:
+ self.parent.hooknum(str(num), func)
+ return func
+ return realhook
+
+ def hookchan(self, chan, glevel=ANYONE, clevel=PUBLIC):
+ def realhook(func):
+ self.chanhooks[chan] = func
+ if self.parent is not None:
+ self.parent.hookchan(chan, func)
+ return func
+ return realhook
+
+ def hook(self, cmd=None, needchan=True, glevel=ANYONE, clevel=PUBLIC):
+ _cmd = cmd #save this since it gets wiped out...
+ def realhook(func):
+ cmd = _cmd #...and restore it
+ if cmd is None:
+ cmd = func.__name__ # default to function name
+