mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 01:19:26 +01:00
Added a few more asserts and clarified an already existing one.
This commit is contained in:
parent
3a0d71c15a
commit
27656e5fef
@ -124,6 +124,8 @@ class Owner(callbacks.Plugin):
|
|||||||
# This plugin must be first; its priority must be lowest; otherwise odd
|
# This plugin must be first; its priority must be lowest; otherwise odd
|
||||||
# things will happen when adding callbacks.
|
# things will happen when adding callbacks.
|
||||||
def __init__(self, irc=None):
|
def __init__(self, irc=None):
|
||||||
|
if irc is not None:
|
||||||
|
assert not irc.getCallback(self.name())
|
||||||
self.__parent = super(Owner, self)
|
self.__parent = super(Owner, self)
|
||||||
self.__parent.__init__(irc)
|
self.__parent.__init__(irc)
|
||||||
# Setup log object/command.
|
# Setup log object/command.
|
||||||
@ -254,7 +256,8 @@ class Owner(callbacks.Plugin):
|
|||||||
do422 = do377 = do376
|
do422 = do377 = do376
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
assert self is irc.callbacks[0], 'Owner isn\'t first callback.'
|
assert self is irc.callbacks[0], \
|
||||||
|
'Owner isn\'t first callback: %r' % irc.callbacks
|
||||||
if ircmsgs.isCtcp(msg):
|
if ircmsgs.isCtcp(msg):
|
||||||
return
|
return
|
||||||
s = callbacks.addressed(irc.nick, msg)
|
s = callbacks.addressed(irc.nick, msg)
|
||||||
|
@ -629,6 +629,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
# This *isn't* threadsafe!
|
# This *isn't* threadsafe!
|
||||||
def addCallback(self, callback):
|
def addCallback(self, callback):
|
||||||
"""Adds a callback to the callbacks list."""
|
"""Adds a callback to the callbacks list."""
|
||||||
|
assert not self.getCallback(callback.name())
|
||||||
self.callbacks.append(callback)
|
self.callbacks.append(callback)
|
||||||
# This is the new list we're building, which will be tsorted.
|
# This is the new list we're building, which will be tsorted.
|
||||||
cbs = []
|
cbs = []
|
||||||
|
Loading…
Reference in New Issue
Block a user