mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 09:29:24 +01:00
plugins/Misc: Make sure Misc.last only skips the first message if last is being performed on the channel the user is currently in.
This commit is contained in:
parent
9df805c568
commit
d4d165ea40
@ -278,9 +278,12 @@ class Misc(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
predicates = {}
|
predicates = {}
|
||||||
nolimit = False
|
nolimit = False
|
||||||
|
skipfirst = True
|
||||||
if ircutils.isChannel(msg.args[0]):
|
if ircutils.isChannel(msg.args[0]):
|
||||||
predicates['in'] = lambda m: ircutils.strEqual(m.args[0],
|
predicates['in'] = lambda m: ircutils.strEqual(m.args[0],
|
||||||
msg.args[0])
|
msg.args[0])
|
||||||
|
else:
|
||||||
|
skipfirst = False
|
||||||
for (option, arg) in optlist:
|
for (option, arg) in optlist:
|
||||||
if option == 'from':
|
if option == 'from':
|
||||||
def f(m, arg=arg):
|
def f(m, arg=arg):
|
||||||
@ -290,6 +293,8 @@ class Misc(callbacks.Plugin):
|
|||||||
def f(m, arg=arg):
|
def f(m, arg=arg):
|
||||||
return ircutils.strEqual(m.args[0], arg)
|
return ircutils.strEqual(m.args[0], arg)
|
||||||
predicates['in'] = f
|
predicates['in'] = f
|
||||||
|
if arg != msg.args[0]:
|
||||||
|
skipfirst = False
|
||||||
elif option == 'on':
|
elif option == 'on':
|
||||||
def f(m, arg=arg):
|
def f(m, arg=arg):
|
||||||
return m.receivedOn == arg
|
return m.receivedOn == arg
|
||||||
@ -312,7 +317,10 @@ class Misc(callbacks.Plugin):
|
|||||||
elif option == 'nolimit':
|
elif option == 'nolimit':
|
||||||
nolimit = True
|
nolimit = True
|
||||||
iterable = ifilter(self._validLastMsg, reversed(irc.state.history))
|
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()))
|
predicates = list(utils.iter.flatten(predicates.itervalues()))
|
||||||
resp = []
|
resp = []
|
||||||
if irc.nested and not \
|
if irc.nested and not \
|
||||||
|
Loading…
Reference in New Issue
Block a user