Anonymous: Fix handling of allowPrivateTarget (after a629f51).

This commit is contained in:
Valentin Lorentz 2014-09-12 04:53:23 +00:00
parent ae5f33393e
commit 7043e17fb0
1 changed files with 3 additions and 4 deletions

View File

@ -59,7 +59,7 @@ class Anonymous(callbacks.Plugin):
if capability: if capability:
if not ircdb.checkCapability(msg.prefix, capability): if not ircdb.checkCapability(msg.prefix, capability):
irc.errorNoCapability(capability, Raise=True) irc.errorNoCapability(capability, Raise=True)
if irc.isChannel(target): if action != 'tell':
if self.registryValue('requirePresenceInChannel', target) and \ if self.registryValue('requirePresenceInChannel', target) and \
msg.nick not in irc.state.channels[target].users: msg.nick not in irc.state.channels[target].users:
irc.error(format(_('You must be in %s to %q in there.'), irc.error(format(_('You must be in %s to %q in there.'),
@ -71,7 +71,7 @@ class Anonymous(callbacks.Plugin):
if not c._checkCapability(self.name()): if not c._checkCapability(self.name()):
irc.error(_('That channel has set its capabilities so as to ' irc.error(_('That channel has set its capabilities so as to '
'disallow the use of this plugin.'), Raise=True) 'disallow the use of this plugin.'), Raise=True)
elif action == 'say' and not self.registryValue('allowPrivateTarget'): elif not self.registryValue('allowPrivateTarget'):
irc.error(format(_('%q cannot be used to send private messages.'), irc.error(format(_('%q cannot be used to send private messages.'),
action), action),
Raise=True) Raise=True)
@ -80,8 +80,7 @@ class Anonymous(callbacks.Plugin):
def say(self, irc, msg, args, target, text): def say(self, irc, msg, args, target, text):
"""<channel> <text> """<channel> <text>
Sends <text> to <channel>. Can only send to <nick> if Sends <text> to <channel>.
supybot.plugins.Anonymous.allowPrivateTarget is True.
""" """
self._preCheck(irc, msg, target, 'say') self._preCheck(irc, msg, target, 'say')
self.log.info('Saying %q in %s due to %s.', self.log.info('Saying %q in %s due to %s.',