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
try:
length = int(length or 0)
if length < 0:
irc.error('Ban length must be a non-negative integer.')
return
except ValueError:
if reason:
reason = ' '.join((length, reason))
length = 0
else:
irc.error('Ban length must be a valid integer.')
irc.error('Ban length must be a non-negative integer.')
return
if not reason:
reason = msg.nick

View File

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