OperUp: write tried_oper flag to irc.state, as attributes under irc are not persistant

This commit is contained in:
James Lu 2017-11-22 23:57:40 -08:00
parent 8c0b8d91a1
commit 06e00beea6

View File

@ -55,7 +55,7 @@ class OperUp(callbacks.Plugin):
# Don't try to oper more than once per network: otherwise we can hit # Don't try to oper more than once per network: otherwise we can hit
# infinite loops if OPERMOTDs also use the regular MOTD numerics # infinite loops if OPERMOTDs also use the regular MOTD numerics
# (e.g. InspIRCd) # (e.g. InspIRCd)
if hasattr(irc, '_operup_tried_oper'): if hasattr(irc.state, '_operup_tried_oper'):
return return
if irc.network in self.registryValue('operNets'): if irc.network in self.registryValue('operNets'):
if self.registryValue("operName") and \ if self.registryValue("operName") and \
@ -63,7 +63,7 @@ class OperUp(callbacks.Plugin):
irc.sendMsg(ircmsgs.IrcMsg(command="OPER", irc.sendMsg(ircmsgs.IrcMsg(command="OPER",
args=[self.registryValue("operName"), args=[self.registryValue("operName"),
self.registryValue("operPass")])) self.registryValue("operPass")]))
irc._operup_tried_oper = True irc.state._operup_tried_oper = True
else: else:
self.log.warning("OperUp: Bot is set to oper on network %s, but" self.log.warning("OperUp: Bot is set to oper on network %s, but"
" operName and/or operPass are not defined!", irc.network) " operName and/or operPass are not defined!", irc.network)
@ -109,7 +109,7 @@ class OperUp(callbacks.Plugin):
irc.sendMsg(ircmsgs.IrcMsg(command="OPER", irc.sendMsg(ircmsgs.IrcMsg(command="OPER",
args=[self.registryValue("operName"), args=[self.registryValue("operName"),
self.registryValue("operPass")])) self.registryValue("operPass")]))
irc._operup_tried_oper = True irc.state._operup_tried_oper = True
irc.replySuccess() irc.replySuccess()
else: else:
irc.error(_("Either the operName or the operPass " irc.error(_("Either the operName or the operPass "