mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 02:49: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
|
registry.Integer(120, """Determines the number of seconds between sending
|
||||||
pings to the server, if pings are being sent to the server."""))
|
pings to the server, if pings are being sent to the server."""))
|
||||||
|
|
||||||
registerGlobalValue(supybot.protocols.irc, 'queueDuplicateMessages',
|
registerGlobalValue(supybot.protocols.irc, 'refuseToQueueDuplicateMessages',
|
||||||
registry.Boolean(False, """Determines whether the bot will allow duplicate
|
registry.Boolean(False, """Determines whether the bot will refuse duplicate
|
||||||
messages to be queued for delivery to the server. This is a safety
|
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
|
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,
|
multiple times; most of the time it doesn't matter, unless you're doing
|
||||||
you'll probably want it to disallowed."""))
|
certain kinds of plugin hacking."""))
|
||||||
|
|
||||||
###
|
###
|
||||||
# supybot.protocols.http
|
# supybot.protocols.http
|
||||||
|
@ -166,7 +166,7 @@ class IrcMsgQueue(object):
|
|||||||
def enqueue(self, msg):
|
def enqueue(self, msg):
|
||||||
"""Enqueues a given message."""
|
"""Enqueues a given message."""
|
||||||
if msg in self.msgs and \
|
if msg in self.msgs and \
|
||||||
not conf.supybot.protocols.irc.queueDuplicateMessages():
|
conf.supybot.protocols.irc.refuseToQueueDuplicateMessages():
|
||||||
s = str(msg).strip()
|
s = str(msg).strip()
|
||||||
log.info('Not adding message %q to queue, already added.', s)
|
log.info('Not adding message %q to queue, already added.', s)
|
||||||
return False
|
return False
|
||||||
|
@ -127,11 +127,17 @@ class IrcMsgQueueTestCase(SupyTestCase):
|
|||||||
self.assertEqual(self.msgs[1], q.dequeue())
|
self.assertEqual(self.msgs[1], q.dequeue())
|
||||||
|
|
||||||
def testNoIdenticals(self):
|
def testNoIdenticals(self):
|
||||||
q = irclib.IrcMsgQueue()
|
configVar = conf.supybot.protocols.irc.refuseToQueueDuplicateMessages
|
||||||
q.enqueue(self.msg)
|
original = configVar()
|
||||||
q.enqueue(self.msg)
|
try:
|
||||||
self.assertEqual(self.msg, q.dequeue())
|
configVar.setValue(True)
|
||||||
self.failIf(q)
|
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):
|
def testJoinBeforeWho(self):
|
||||||
q = irclib.IrcMsgQueue()
|
q = irclib.IrcMsgQueue()
|
||||||
|
Loading…
Reference in New Issue
Block a user