Seen: Fix any to work with wildcards when protocols.irc.strictRfc is true

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2013-10-13 10:00:33 -04:00
parent cfe71c4f55
commit 4d677dbcf5
2 changed files with 23 additions and 6 deletions

View File

@ -1,6 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010-2011, James McCoy
# Copyright (c) 2010-2011, 2013, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -243,7 +243,7 @@ class Seen(callbacks.Plugin):
else:
self._last(irc, channel, any=True)
any = wrap(any, ['channel', getopts({'user': 'otherUser'}),
additional('nick')])
additional('something')])
def _last(self, irc, channel, any=False):
if any:

View File

@ -1,5 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2013, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -55,6 +56,16 @@ class ChannelDBTestCase(ChannelPluginTestCase):
prefix=self.prefix))
self.assertRegexp('seen any %s' % self.nick,
'^%s was last seen' % self.nick)
orig = conf.supybot.protocols.irc.strictRfc()
try:
for state in (True, False):
conf.supybot.protocols.irc.strictRfc.setValue(state)
for wildcard in self.wildcardTest:
self.assertRegexp('seen any %s' % wildcard,
'^%s was last seen' % self.nick)
self.assertRegexp('seen any bar*', '^I haven\'t seen anyone matching')
finally:
conf.supybot.protocols.irc.strictRfc.setValue(orig)
def testSeen(self):
self.assertNotError('seen last')
@ -64,10 +75,16 @@ class ChannelDBTestCase(ChannelPluginTestCase):
self.failUnless(self.nick.upper() in m.args[1])
self.assertRegexp('seen user %s' % self.nick,
'^%s was last seen' % self.nick)
orig = conf.supybot.protocols.irc.strictRfc()
try:
for state in (True, False):
conf.supybot.protocols.irc.strictRfc.setValue(state)
for wildcard in self.wildcardTest:
self.assertRegexp('seen %s' % wildcard,
'^%s was last seen' % self.nick)
self.assertRegexp('seen bar*', '^I haven\'t seen anyone matching')
finally:
conf.supybot.protocols.irc.strictRfc.setValue(orig)
def testSeenNoUser(self):
self.assertNotRegexp('seen user alsdkfjalsdfkj', 'KeyError')