summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-23 19:53:02 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-23 19:53:02 +0100
commit56b7d3ebd6b413beb848b54dfcfed19843eb027e (patch)
treeb80b0036a5a39dce397979a47429be7c0655a39d /plugins
parente23d905daa6ed78ba124d81c1782effc341322db (diff)
downloadpoezio-56b7d3ebd6b413beb848b54dfcfed19843eb027e.tar.gz
poezio-56b7d3ebd6b413beb848b54dfcfed19843eb027e.tar.bz2
poezio-56b7d3ebd6b413beb848b54dfcfed19843eb027e.tar.xz
poezio-56b7d3ebd6b413beb848b54dfcfed19843eb027e.zip
/quote can now be used by specifiying only the seconds, then completing.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/quote.py10
1 files changed, 9 insertions, 1 deletions
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