From 010da43b29afe1f6d2fff9205d74855c633490ec Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 18 Dec 2016 15:08:51 -0800 Subject: [PATCH] Channel: use msg.prefix instead of nickToHostmask for capability checks Closes #1233. --- plugins/Channel/plugin.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/Channel/plugin.py b/plugins/Channel/plugin.py index 9a4db1c54..1581b65b1 100644 --- a/plugins/Channel/plugin.py +++ b/plugins/Channel/plugin.py @@ -909,10 +909,9 @@ class Channel(callbacks.Plugin): # Make sure we don't elicit information about private channels to # people or channels that shouldn't know capability = ircdb.makeChannelCapability(channel, 'op') - hostmask = irc.state.nickToHostmask(msg.nick) if 's' in irc.state.channels[channel].modes and \ msg.args[0] != channel and \ - not ircdb.checkCapability(hostmask, capability) and \ + not ircdb.checkCapability(msg.prefix, capability) and \ (ircutils.isChannel(msg.args[0]) or \ msg.nick not in irc.state.channels[channel].users): irc.error(_('You don\'t have access to that information.'), @@ -937,8 +936,7 @@ class Channel(callbacks.Plugin): if frm is not None: s += format(_(' (from %s)'), frm) for nick in irc.state.channels[channel].users: - hostmask = irc.state.nickToHostmask(nick) - if ircdb.checkCapability(hostmask, capability): + if ircdb.checkCapability(msg.prefix, capability): irc.reply(s, to=nick, private=True) irc.replySuccess() @@ -969,8 +967,7 @@ class Channel(callbacks.Plugin): else: irc.error(Raise=True) capability = ircdb.makeChannelCapability(channel, 'op') - hostmask = irc.state.nickToHostmask(msg.nick) - if not ircdb.checkCapabilities(hostmask, [capability, 'admin']): + if not ircdb.checkCapabilities(msg.prefix, [capability, 'admin']): irc.errorNoCapability(capability, Raise=True) try: network = conf.supybot.networks.get(irc.network)