Permalink
Browse files

AutoMode: Prevent traceback if a unregistered user joins.

  • Loading branch information...
1 parent ae2f813 commit dfbf74ba62ab8ff10ad43128a4f6fa64b332fddb @ProgVal committed Sep 22, 2012
Showing with 14 additions and 9 deletions.
  1. +14 −9 plugins/AutoMode/plugin.py
View
@@ -87,15 +87,11 @@ def f():
schedule.addEvent(f, time.time() + delay)
else:
f()
- try:
- do('op')
- if 'h' in irc.state.supported['prefix']:
- do('halfop')
- do('voice')
- except Continue:
- return
- finally:
- user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
+ def extra_modes():
+ try:
+ user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
+ except KeyError:
+ return
pattern = re.compile('-|\+')
for item in self.registryValue('extra', channel):
try:
@@ -114,6 +110,15 @@ def f():
([msg.nick]*len(pattern.sub('', modes)))
schedule_msg(ircmsgs.mode(channel, modes), lambda :False)
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)
if c.checkBan(msg.prefix) and self.registryValue('ban', channel):
period = self.registryValue('ban.period', channel)

0 comments on commit dfbf74b

Please sign in to comment.