OperUp: add option to toggle autooper

This commit is contained in:
GLolol 2014-01-29 11:09:55 -08:00
parent b232a14687
commit 82d9d73e0b
2 changed files with 10 additions and 6 deletions

View File

@ -59,5 +59,7 @@ conf.registerGlobalValue(OperUp, 'operNets',
conf.registerGlobalValue(OperUp, 'operModes',
registry.SpaceSeparatedListOfStrings("", _("""Specifies the mode(s) the
bot will set on itself when it Opers up."""), private=True))
conf.registerGlobalValue(OperUp, 'autoOper',
registry.Boolean(True, _("""Specifies whether the bot should automatically
oper up on connect.""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -48,6 +48,8 @@ class OperUp(callbacks.Plugin):
def do005(self, irc, msg):
"""Oper up on connect."""
if not self.registryValue('autoOper'):
return
if irc.network in self.registryValue('operNets'):
if self.registryValue("operName") and \
self.registryValue("operPass"):
@ -55,7 +57,7 @@ class OperUp(callbacks.Plugin):
args=[self.registryValue("operName"),
self.registryValue("operPass")]))
else:
self.log.error("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!")
def do381(self, irc, msg):
@ -102,15 +104,15 @@ class OperUp(callbacks.Plugin):
else:
irc.error(_("Either the operName or the operPass "
"configuration values were not properly defined. Please "
"check to see these values are correct!"))
"check to see if these values are correct!"))
else:
irc.error(_("This network is not configured for opering up! (see"
irc.error(_("This network is not configured for opering! (see"
" @config plugins.OperUp.opernets)"))
operup = wrap(operup, ['owner'])
def deoper(self, irc, msg, args):
"""takes no arguments.
Deopers the bot. (set user modes -Oo)
Makes the bot deoper by setting user modes -Oo on itself.
"""
irc.sendMsg(ircmsgs.mode(irc.nick, "-Oo"))
irc.replySuccess()