AutoMode: Prevent traceback if a unregistered user joins.

This commit is contained in:
Valentin Lorentz 2012-09-22 17:22:35 +02:00
parent ae2f81356a
commit dfbf74ba62
1 changed files with 14 additions and 9 deletions

View File

@ -87,15 +87,11 @@ class AutoMode(callbacks.Plugin):
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 @@ class AutoMode(callbacks.Plugin):
([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)