mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Changed supybot.protocols.irc.queueDuplicateMessages.
Changed supybot.protocols.irc.queueDuplicateMessages to supybot.protocols.irc.refuseToQueueDuplicateMessages, and changed the default to be to allow duplicate messages, rather than to reject them.
This commit is contained in:
parent
f930913b05
commit
6b75be6e60
@ -917,12 +917,12 @@ registerGlobalValue(supybot.protocols.irc.ping, 'interval',
|
||||
registry.Integer(120, """Determines the number of seconds between sending
|
||||
pings to the server, if pings are being sent to the server."""))
|
||||
|
||||
registerGlobalValue(supybot.protocols.irc, 'queueDuplicateMessages',
|
||||
registry.Boolean(False, """Determines whether the bot will allow duplicate
|
||||
registerGlobalValue(supybot.protocols.irc, 'refuseToQueueDuplicateMessages',
|
||||
registry.Boolean(False, """Determines whether the bot will refuse duplicate
|
||||
messages to be queued for delivery to the server. This is a safety
|
||||
mechanism put in place to prevent plugins from sending the same message
|
||||
multiple times; most of the time it doesn't matter, but when it does,
|
||||
you'll probably want it to disallowed."""))
|
||||
multiple times; most of the time it doesn't matter, unless you're doing
|
||||
certain kinds of plugin hacking."""))
|
||||
|
||||
###
|
||||
# supybot.protocols.http
|
||||
|
@ -166,7 +166,7 @@ class IrcMsgQueue(object):
|
||||
def enqueue(self, msg):
|
||||
"""Enqueues a given message."""
|
||||
if msg in self.msgs and \
|
||||
not conf.supybot.protocols.irc.queueDuplicateMessages():
|
||||
conf.supybot.protocols.irc.refuseToQueueDuplicateMessages():
|
||||
s = str(msg).strip()
|
||||
log.info('Not adding message %q to queue, already added.', s)
|
||||
return False
|
||||
|
@ -127,11 +127,17 @@ class IrcMsgQueueTestCase(SupyTestCase):
|
||||
self.assertEqual(self.msgs[1], q.dequeue())
|
||||
|
||||
def testNoIdenticals(self):
|
||||
q = irclib.IrcMsgQueue()
|
||||
q.enqueue(self.msg)
|
||||
q.enqueue(self.msg)
|
||||
self.assertEqual(self.msg, q.dequeue())
|
||||
self.failIf(q)
|
||||
configVar = conf.supybot.protocols.irc.refuseToQueueDuplicateMessages
|
||||
original = configVar()
|
||||
try:
|
||||
configVar.setValue(True)
|
||||
q = irclib.IrcMsgQueue()
|
||||
q.enqueue(self.msg)
|
||||
q.enqueue(self.msg)
|
||||
self.assertEqual(self.msg, q.dequeue())
|
||||
self.failIf(q)
|
||||
finally:
|
||||
configVar.setValue(original)
|
||||
|
||||
def testJoinBeforeWho(self):
|
||||
q = irclib.IrcMsgQueue()
|
||||
|
Loading…
Reference in New Issue
Block a user