OperUp: listen for 376/422 (end of MOTD) instead of 005

There can be more than one 005 message sent on connect (depending on IRCd), and that would've triggered auto-oper multiple times!
This commit is contained in:
James Lu 2015-09-19 23:13:07 -07:00
parent 97c8238554
commit c581acde08

View File

@ -46,8 +46,9 @@ class OperUp(callbacks.Plugin):
"""Simple plugin that allows Supybot to oper up on configured networks, on
connect and manually."""
def do005(self, irc, msg):
"""Oper up on connect."""
def do376(self, irc, msg):
"""Oper up on connect. This listens on numerics 376 (end of MOTD) and
422 (MOTD not found)."""
if not self.registryValue('autoOper'):
return
if irc.network in self.registryValue('operNets'):
@ -60,6 +61,8 @@ class OperUp(callbacks.Plugin):
self.log.warning("OperUp: Bot is set to oper on network %s, but"
" operName and/or operPass are not defined!", irc.network)
do377 = do422 = do376
def do381(self, irc, msg):
self.log.info("OperUp: Received 381 (successfully opered up) from "
"network %s.", irc.network)