mirror of https://github.com/Mikaela/Limnoria.git
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."""))
|
services."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.Services, 'password',
|
conf.registerChannelValue(conf.supybot.plugins.Services, 'password',
|
||||||
registry.String('', """Determines what password the bot will use with
|
registry.String('', """Determines what password the bot will use with
|
||||||
services."""))
|
services.""", private=True))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.Services, 'NickServ',
|
conf.registerChannelValue(conf.supybot.plugins.Services, 'NickServ',
|
||||||
ValidNickOrEmptyString('', """Determines what nick the 'NickServ' service
|
ValidNickOrEmptyString('', """Determines what nick the 'NickServ' service
|
||||||
has."""))
|
has."""))
|
||||||
|
|
|
@ -162,7 +162,14 @@ class Config(callbacks.Privmsg):
|
||||||
name = self._canonicalizeName(name)
|
name = self._canonicalizeName(name)
|
||||||
wrapper = getWrapper(name)
|
wrapper = getWrapper(name)
|
||||||
if hasattr(wrapper, 'value'):
|
if hasattr(wrapper, 'value'):
|
||||||
|
if not wrapper.private:
|
||||||
irc.reply(str(wrapper))
|
irc.reply(str(wrapper))
|
||||||
|
else:
|
||||||
|
capability = getCapability(name)
|
||||||
|
if ircdb.checkCapability(msg.prefix, capability):
|
||||||
|
irc.reply(str(wrapper))
|
||||||
|
else:
|
||||||
|
irc.errorNoCapability(capability)
|
||||||
else:
|
else:
|
||||||
irc.error('That registry variable has no value. Use the list '
|
irc.error('That registry variable has no value. Use the list '
|
||||||
'command in this plugin to see what values are '
|
'command in this plugin to see what values are '
|
||||||
|
|
|
@ -191,9 +191,11 @@ class Group(object):
|
||||||
|
|
||||||
|
|
||||||
class Value(Group):
|
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)
|
Group.__init__(self, **kwargs)
|
||||||
self.default = default
|
self.default = default
|
||||||
|
self.private = private
|
||||||
self.showDefault = showDefault
|
self.showDefault = showDefault
|
||||||
self.help = utils.normalizeWhitespace(help.strip())
|
self.help = utils.normalizeWhitespace(help.strip())
|
||||||
self.setValue(default)
|
self.setValue(default)
|
||||||
|
|
Loading…
Reference in New Issue