check for channel with is_channel in a couple places where it's relevant

This commit is contained in:
Brian S. Stephan 2010-07-25 07:58:52 -05:00
parent f170743837
commit 934e8e3fe8
1 changed files with 16 additions and 12 deletions

View File

@ -15,6 +15,7 @@ import irclib
def sub_join_channel(connection, event, nick, userhost, replypath, what, admin_unlocked):
if what.split(' ')[0] == 'join' and admin_unlocked:
channel = what.split(' ')[1]
if irclib.is_channel(channel):
connection.join(channel)
connection.privmsg(replypath, 'joined ' + channel + '.')
@ -27,6 +28,7 @@ def sub_join_channel(connection, event, nick, userhost, replypath, what, admin_u
def sub_part_channel(connection, event, nick, userhost, replypath, what, admin_unlocked):
if what.split(' ')[0] == 'part' and admin_unlocked:
channel = what.split(' ')[1]
if irclib.is_channel(channel):
connection.part(channel, ' '.join(what.split(' ')[2:]))
connection.privmsg(replypath, 'parted ' + channel + '.')
@ -55,6 +57,7 @@ def sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what,
try:
# get existing list
channel = what.split(' ')[2]
if irclib.is_channel(channel):
channelset = set(config.get('channels', 'autojoin').split(','))
channelset.add(channel)
config.set('channels', 'autojoin', ','.join(channelset))
@ -64,6 +67,7 @@ def sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what,
try:
# get existing list
channel = what.split(' ')[2]
if irclib.is_channel(channel):
channelset = set(config.get('channels', 'autojoin').split(','))
channelset.discard(channel)
config.set('channels', 'autojoin', ','.join(channelset))