Added some error checking to join and part.

This commit is contained in:
Jeremy Fincher 2003-10-30 04:06:46 +00:00
parent bc6f4bd149
commit 3f081ee21c

View File

@ -243,6 +243,9 @@ class Relay(callbacks.Privmsg, plugins.Toggleable):
irc.error(msg, 'You must use the start command first.') irc.error(msg, 'You must use the start command first.')
return return
channel = privmsgs.getArgs(args) channel = privmsgs.getArgs(args)
if not ircutils.isChannel(channel):
irc.error(msg, '%r is not a valid channel.' % channel)
return
self.channels.add(ircutils.toLower(channel)) self.channels.add(ircutils.toLower(channel))
for otherIrc in self.ircs.itervalues(): for otherIrc in self.ircs.itervalues():
if channel not in otherIrc.state.channels: if channel not in otherIrc.state.channels:
@ -261,6 +264,9 @@ class Relay(callbacks.Privmsg, plugins.Toggleable):
irc.error(msg, 'You must use the start command first.') irc.error(msg, 'You must use the start command first.')
return return
channel = privmsgs.getArgs(args) channel = privmsgs.getArgs(args)
if not ircutils.isChannel(channel):
irc.error(msg, '%r is not a valid channel.' % channel)
return
self.channels.remove(ircutils.toLower(channel)) self.channels.remove(ircutils.toLower(channel))
for otherIrc in self.ircs.itervalues(): for otherIrc in self.ircs.itervalues():
if channel in otherIrc.state.channels: if channel in otherIrc.state.channels: