Added a registry variable for disallowed list --private.

This commit is contained in:
Jeremy Fincher 2004-08-06 06:57:54 +00:00
parent b207baf9d3
commit daf81b1b90
1 changed files with 12 additions and 0 deletions

View File

@ -51,8 +51,16 @@ import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs import supybot.privmsgs as privmsgs
import supybot.webutils as webutils import supybot.webutils as webutils
import supybot.registry as registry
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
conf.registerPlugin('Misc')
conf.registerGlobalValue(conf.supybot.plugins.Misc, 'listPrivatePlugins',
registry.Boolean(True, """Determines whether the bot will list private
plugins with the list command if given the --private switch. If this is
disabled, non-owner users should be unable to see what private plugins
are loaded."""))
class Misc(callbacks.Privmsg): class Misc(callbacks.Privmsg):
priority = sys.maxint priority = sys.maxint
def invalidCommand(self, irc, msg, tokens): def invalidCommand(self, irc, msg, tokens):
@ -81,6 +89,10 @@ class Misc(callbacks.Privmsg):
for (option, argument) in optlist: for (option, argument) in optlist:
if option == '--private': if option == '--private':
private = True private = True
if not self.registryValue('listPrivatePlugins') and \
not ircdb.checkCapability(msg.prefix, 'owner'):
irc.errorNoCapability('owner')
return
name = privmsgs.getArgs(rest, required=0, optional=1) name = privmsgs.getArgs(rest, required=0, optional=1)
name = callbacks.canonicalName(name) name = callbacks.canonicalName(name)
if not name: if not name: