mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Seen: Add supybot.plugins.Seen.minimumNonWildcard.
This commit is contained in:
parent
32b0b12c1f
commit
d05506ee22
@ -45,6 +45,10 @@ Seen = conf.registerPlugin('Seen')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(Seen, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
conf.registerChannelValue(Seen, 'minimumNonWildcard',
|
||||
registry.NonNegativeInteger(2, _("""The minimum non-wildcard characters
|
||||
required to perform a 'seen' request. Of course, it only applies if there
|
||||
is a wildcard in the request.""")))
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
@ -192,6 +192,10 @@ class Seen(callbacks.Plugin):
|
||||
try:
|
||||
results = []
|
||||
if '*' in name:
|
||||
if (len(name.replace('*', '')) <
|
||||
self.registryValue('minimumNonWildcard', channel)):
|
||||
irc.error(_('Not enough non-wildcard characters.'),
|
||||
Raise=True)
|
||||
results = db.seenWildcard(channel, name)
|
||||
else:
|
||||
results = [[name, db.seen(channel, name)]]
|
||||
|
@ -66,11 +66,13 @@ class ChannelDBTestCase(ChannelPluginTestCase):
|
||||
prefix=self.prefix))
|
||||
self.assertNotError('seen last')
|
||||
self.assertNotError('list')
|
||||
self.assertError('seen *')
|
||||
self.assertNotError('seen %s' % self.nick)
|
||||
m = self.assertNotError('seen %s' % self.nick.upper())
|
||||
self.failUnless(self.nick.upper() in m.args[1])
|
||||
self.assertRegexp('seen user %s' % self.nick,
|
||||
'^%s was last seen' % self.nick)
|
||||
self.assertNotError('config plugins.Seen.minimumNonWildcard 0')
|
||||
for wildcard in self.wildcardTest:
|
||||
self.assertRegexp('seen %s' % wildcard,
|
||||
'^%s was last seen' % self.nick)
|
||||
|
Loading…
Reference in New Issue
Block a user