Skip to content

Commit

Permalink
AutoMode: Prevent traceback if a unregistered user joins.
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Sep 22, 2012
1 parent ae2f813 commit dfbf74b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions plugins/AutoMode/plugin.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,15 +87,11 @@ def f():
schedule.addEvent(f, time.time() + delay) schedule.addEvent(f, time.time() + delay)
else: else:
f() f()
try: def extra_modes():
do('op') try:
if 'h' in irc.state.supported['prefix']: user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
do('halfop') except KeyError:
do('voice') return
except Continue:
return
finally:
user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
pattern = re.compile('-|\+') pattern = re.compile('-|\+')
for item in self.registryValue('extra', channel): for item in self.registryValue('extra', channel):
try: try:
Expand All @@ -114,6 +110,15 @@ def f():
([msg.nick]*len(pattern.sub('', modes))) ([msg.nick]*len(pattern.sub('', modes)))
schedule_msg(ircmsgs.mode(channel, modes), lambda :False) schedule_msg(ircmsgs.mode(channel, modes), lambda :False)
break break
try:
do('op')
if 'h' in irc.state.supported['prefix']:
do('halfop')
do('voice')
except Continue:
return
finally:
extra_modes()
c = ircdb.channels.getChannel(channel) c = ircdb.channels.getChannel(channel)
if c.checkBan(msg.prefix) and self.registryValue('ban', channel): if c.checkBan(msg.prefix) and self.registryValue('ban', channel):
period = self.registryValue('ban.period', channel) period = self.registryValue('ban.period', channel)
Expand Down

0 comments on commit dfbf74b

Please sign in to comment.