mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Seen: require caller to be in target channel when using commands in this plugin.
This fixes information leakage from private channels. Conflicts: plugins/Seen/plugin.py
This commit is contained in:
parent
e557541de1
commit
38ff1a1137
@ -221,6 +221,9 @@ class Seen(callbacks.Plugin):
|
|||||||
saying. <channel> is only necessary if the message isn't sent on the
|
saying. <channel> is only necessary if the message isn't sent on the
|
||||||
channel itself. <nick> may contain * as a wildcard.
|
channel itself. <nick> may contain * as a wildcard.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._seen(irc, channel, name)
|
self._seen(irc, channel, name)
|
||||||
seen = wrap(seen, ['channel', 'something'])
|
seen = wrap(seen, ['channel', 'something'])
|
||||||
|
|
||||||
@ -235,6 +238,9 @@ class Seen(callbacks.Plugin):
|
|||||||
and returns the last time user was active in <channel>. <channel> is
|
and returns the last time user was active in <channel>. <channel> is
|
||||||
only necessary if the message isn't sent on the channel itself.
|
only necessary if the message isn't sent on the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
if name and optlist:
|
if name and optlist:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
elif name:
|
elif name:
|
||||||
@ -269,6 +275,9 @@ class Seen(callbacks.Plugin):
|
|||||||
Returns the last thing said in <channel>. <channel> is only necessary
|
Returns the last thing said in <channel>. <channel> is only necessary
|
||||||
if the message isn't sent in the channel itself.
|
if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._last(irc, channel)
|
self._last(irc, channel)
|
||||||
last = wrap(last, ['channel'])
|
last = wrap(last, ['channel'])
|
||||||
|
|
||||||
@ -295,6 +304,9 @@ class Seen(callbacks.Plugin):
|
|||||||
<channel> is only necessary if the message isn't sent in the channel
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
itself.
|
itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._user(irc, channel, user)
|
self._user(irc, channel, user)
|
||||||
user = wrap(user, ['channel', 'otherUser'])
|
user = wrap(user, ['channel', 'otherUser'])
|
||||||
|
|
||||||
@ -313,6 +325,8 @@ class Seen(callbacks.Plugin):
|
|||||||
irc.error(format(_('%s must be in %s to use this command.'),
|
irc.error(format(_('%s must be in %s to use this command.'),
|
||||||
('You' if nick == msg.nick else nick), channel))
|
('You' if nick == msg.nick else nick), channel))
|
||||||
return
|
return
|
||||||
|
if nick is None:
|
||||||
|
nick = msg.nick
|
||||||
end = None # By default, up until the most recent message.
|
end = None # By default, up until the most recent message.
|
||||||
for (i, m) in utils.seq.renumerate(irc.state.history):
|
for (i, m) in utils.seq.renumerate(irc.state.history):
|
||||||
if end is None and m.command == 'JOIN' and \
|
if end is None and m.command == 'JOIN' and \
|
||||||
|
Loading…
Reference in New Issue
Block a user