From d4d165ea407d4a3edb0eab21de8e2865a2462a18 Mon Sep 17 00:00:00 2001 From: James Vega Date: Fri, 10 Jun 2005 12:19:10 +0000 Subject: [PATCH] plugins/Misc: Make sure Misc.last only skips the first message if last is being performed on the channel the user is currently in. --- plugins/Misc/plugin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 31c1beff6..61dc8549a 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -278,9 +278,12 @@ class Misc(callbacks.Plugin): """ predicates = {} nolimit = False + skipfirst = True if ircutils.isChannel(msg.args[0]): predicates['in'] = lambda m: ircutils.strEqual(m.args[0], msg.args[0]) + else: + skipfirst = False for (option, arg) in optlist: if option == 'from': def f(m, arg=arg): @@ -290,6 +293,8 @@ class Misc(callbacks.Plugin): def f(m, arg=arg): return ircutils.strEqual(m.args[0], arg) predicates['in'] = f + if arg != msg.args[0]: + skipfirst = False elif option == 'on': def f(m, arg=arg): return m.receivedOn == arg @@ -312,7 +317,10 @@ class Misc(callbacks.Plugin): elif option == 'nolimit': nolimit = True iterable = ifilter(self._validLastMsg, reversed(irc.state.history)) - iterable.next() # Drop the first message. + if skipfirst: + # Drop the first message only if our current channel is the same as + # the channel we've been instructed to look at. + iterable.next() predicates = list(utils.iter.flatten(predicates.itervalues())) resp = [] if irc.nested and not \