From 56b7d3ebd6b413beb848b54dfcfed19843eb027e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 23 Nov 2011 19:53:02 +0100 Subject: /quote can now be used by specifiying only the seconds, then completing. --- plugins/quote.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins/quote.py') diff --git a/plugins/quote.py b/plugins/quote.py index 10ebba0c..788d4027 100644 --- a/plugins/quote.py +++ b/plugins/quote.py @@ -5,6 +5,7 @@ import common import re timestamp_re = re.compile(r'^(\d\d\d\d-\d\d-\d\d )?\d\d:\d\d:\d\d$') +seconds_re = re.compile(r'^:\d\d$') import logging log = logging.getLogger(__name__) @@ -49,6 +50,8 @@ class Plugin(BasePlugin): if not msg.nickname: return nick == '' return msg.nickname.lower().startswith(nick.lower()) + def time_match(msg): + return msg.str_time.endswith(time) messages = self.core.get_conversation_messages() if not messages: return @@ -57,7 +60,12 @@ class Plugin(BasePlugin): n = len(args) if text.endswith(' '): n += 1 - if n == 2: + time = args[-1] + if re.match(seconds_re, time) is not None: + messages = list(filter(time_match, messages)) + for i in range(3): + the_input.key_backspace(False) + elif n == 2: try: if args[1][0] not in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'): return False -- cgit v1.2.3