Juggled some parentheses around and added registryValue to callbacks.Privmsg.

This commit is contained in:
Jeremy Fincher 2004-01-20 16:17:12 +00:00
parent da3c0634a9
commit 26c4bcd27d

View File

@ -296,13 +296,13 @@ class RichReplyMethods(object):
return s return s
def replySuccess(self, s='', **kwargs): def replySuccess(self, s='', **kwargs):
v = conf.supybot.replies.success.get(self.msg.args[0]) v = conf.supybot.replies.success.get(self.msg.args[0])()
s = self.__makeReply(v(), s) s = self.__makeReply(v, s)
self.reply(s, **kwargs) self.reply(s, **kwargs)
def replyError(self, s='', **kwargs): def replyError(self, s='', **kwargs):
v = conf.supybot.replies.error.get(self.msg.args[0]) v = conf.supybot.replies.error.get(self.msg.args[0])()
s = self.__makeReply(v(), s) s = self.__makeReply(v, s)
self.reply(s, **kwargs) self.reply(s, **kwargs)
def replies(self, L, prefixer=''.join, def replies(self, L, prefixer=''.join,
@ -332,29 +332,29 @@ class RichReplyMethods(object):
def errorNoCapability(self, capability, s='', **kwargs): def errorNoCapability(self, capability, s='', **kwargs):
log.warning('Denying %s for lacking %r capability', log.warning('Denying %s for lacking %r capability',
self.msg.prefix, capability) self.msg.prefix, capability)
v = conf.supybot.replies.noCapability.get(self.msg.args[0]) v = conf.supybot.replies.noCapability.get(self.msg.args[0])()
s = self.__makeReply(v() % capability, s) s = self.__makeReply(v % capability, s)
self.error(s, **kwargs) self.error(s, **kwargs)
def errorPossibleBug(self, s='', **kwargs): def errorPossibleBug(self, s='', **kwargs):
v = conf.supybot.replies.possibleBug.get(self.msg.args[0]) v = conf.supybot.replies.possibleBug.get(self.msg.args[0])()
if s: if s:
s += ' (%s)' % v() s += ' (%s)' % v
else: else:
s = v() s = v
self.error(s, **kwargs) self.error(s, **kwargs)
def errorNotRegistered(self, s='', **kwargs): def errorNotRegistered(self, s='', **kwargs):
v = conf.supybot.replies.notRegistered.get(self.msg.args[0]) v = conf.supybot.replies.notRegistered.get(self.msg.args[0])()
self.error(self.__makeReply(v(), s), **kwargs) self.error(self.__makeReply(v, s), **kwargs)
def errorNoUser(self, s='', **kwargs): def errorNoUser(self, s='', **kwargs):
v = conf.supybot.replies.noUser.get(self.msg.args[0]) v = conf.supybot.replies.noUser.get(self.msg.args[0])()
self.error(self.__makeReply(v(), s), **kwargs) self.error(self.__makeReply(v, s), **kwargs)
def errorRequiresPrivacy(self, s='', **kwargs): def errorRequiresPrivacy(self, s='', **kwargs):
v = conf.supybot.replies.requiresPrivacy.get(self.msg.args[0]) v = conf.supybot.replies.requiresPrivacy.get(self.msg.args[0])()
self.error(self.__makeReply(v(), s), **kwargs) self.error(self.__makeReply(v, s), **kwargs)
class IrcObjectProxy(RichReplyMethods): class IrcObjectProxy(RichReplyMethods):
@ -734,6 +734,13 @@ class Privmsg(irclib.IrcCallback):
elapsed = time.time() - start elapsed = time.time() - start
self.log.info('%s took %s seconds', name, elapsed) self.log.info('%s took %s seconds', name, elapsed)
def registryValue(name, channel=None):
plugin = self.name()
if channel is None:
return conf.supybot.plugins.get(plugin).get(name)()
else:
return conf.supybot.plugins.get(plugin).get(name).get(channel)()
class IrcObjectProxyRegexp(RichReplyMethods): class IrcObjectProxyRegexp(RichReplyMethods):
def __init__(self, irc, msg): def __init__(self, irc, msg):