I didn't like the idea of supybot being able to time travel

This commit is contained in:
James Vega 2004-06-04 06:18:33 +00:00
parent d508b19347
commit 34555c51ff
2 changed files with 5 additions and 1 deletions

View File

@ -230,12 +230,15 @@ class Channel(callbacks.Privmsg):
return return
try: try:
length = int(length or 0) length = int(length or 0)
if length < 0:
irc.error('Ban length must be a non-negative integer.')
return
except ValueError: except ValueError:
if reason: if reason:
reason = ' '.join((length, reason)) reason = ' '.join((length, reason))
length = 0 length = 0
else: else:
irc.error('Ban length must be a valid integer.') irc.error('Ban length must be a non-negative integer.')
return return
if not reason: if not reason:
reason = msg.nick reason = msg.nick

View File

@ -123,6 +123,7 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
prefix='foobar!user@host.domain.tld')) prefix='foobar!user@host.domain.tld'))
self.assertError('kban foobar') self.assertError('kban foobar')
self.irc.feedMsg(ircmsgs.op(self.channel, self.irc.nick)) self.irc.feedMsg(ircmsgs.op(self.channel, self.irc.nick))
self.assertError('kban foobar -1')
self.assertBan('kban foobar', '*!*@*.domain.tld') self.assertBan('kban foobar', '*!*@*.domain.tld')
self.assertBan('kban --exact foobar', 'foobar!user@host.domain.tld') self.assertBan('kban --exact foobar', 'foobar!user@host.domain.tld')
self.assertBan('kban --host foobar', '*!*@host.domain.tld') self.assertBan('kban --host foobar', '*!*@host.domain.tld')