mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-01 07:51:08 -05:00
OperUp: don't try to autooper multiple times
This fixes an infinite loop when receiving OPERMOTDs that use the regular MOTD numerics (e.g. on InspIRCd). (cherry picked from commit 8c0b8d91a17a62cead22553c80b84b6d190df8df)
This commit is contained in:
parent
4a6a13992c
commit
34f7a765cb
@ -52,12 +52,18 @@ class OperUp(callbacks.Plugin):
|
|||||||
422 (MOTD not found)."""
|
422 (MOTD not found)."""
|
||||||
if not self.registryValue('autoOper'):
|
if not self.registryValue('autoOper'):
|
||||||
return
|
return
|
||||||
|
# Don't try to oper more than once per network: otherwise we can hit
|
||||||
|
# infinite loops if OPERMOTDs also use the regular MOTD numerics
|
||||||
|
# (e.g. InspIRCd)
|
||||||
|
if hasattr(irc, '_operup_tried_oper'):
|
||||||
|
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 \
|
||||||
self.registryValue("operPass"):
|
self.registryValue("operPass"):
|
||||||
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
|
||||||
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)
|
||||||
@ -103,6 +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.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
else:
|
||||||
irc.error(_("Either the operName or the operPass "
|
irc.error(_("Either the operName or the operPass "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user