mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
Added the ability for configuration variables to be private so they can't have their values gotten by people who can't change them.
This commit is contained in:
parent
38cf55ebce
commit
fb59b25a63
@ -75,7 +75,7 @@ conf.registerChannelValue(conf.supybot.plugins.Services, 'nick',
|
||||
services."""))
|
||||
conf.registerChannelValue(conf.supybot.plugins.Services, 'password',
|
||||
registry.String('', """Determines what password the bot will use with
|
||||
services."""))
|
||||
services.""", private=True))
|
||||
conf.registerChannelValue(conf.supybot.plugins.Services, 'NickServ',
|
||||
ValidNickOrEmptyString('', """Determines what nick the 'NickServ' service
|
||||
has."""))
|
||||
|
@ -162,7 +162,14 @@ class Config(callbacks.Privmsg):
|
||||
name = self._canonicalizeName(name)
|
||||
wrapper = getWrapper(name)
|
||||
if hasattr(wrapper, 'value'):
|
||||
irc.reply(str(wrapper))
|
||||
if not wrapper.private:
|
||||
irc.reply(str(wrapper))
|
||||
else:
|
||||
capability = getCapability(name)
|
||||
if ircdb.checkCapability(msg.prefix, capability):
|
||||
irc.reply(str(wrapper))
|
||||
else:
|
||||
irc.errorNoCapability(capability)
|
||||
else:
|
||||
irc.error('That registry variable has no value. Use the list '
|
||||
'command in this plugin to see what values are '
|
||||
|
@ -191,9 +191,11 @@ class Group(object):
|
||||
|
||||
|
||||
class Value(Group):
|
||||
def __init__(self, default, help, showDefault=True, **kwargs):
|
||||
def __init__(self, default, help,
|
||||
private=False, showDefault=True, **kwargs):
|
||||
Group.__init__(self, **kwargs)
|
||||
self.default = default
|
||||
self.private = private
|
||||
self.showDefault = showDefault
|
||||
self.help = utils.normalizeWhitespace(help.strip())
|
||||
self.setValue(default)
|
||||
|
Loading…
Reference in New Issue
Block a user