diff options
author | mathieui <mathieui@mathieui.net> | 2021-02-11 18:45:32 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-02-12 18:43:37 +0100 |
commit | 67c5bee9dac6f4547cfedf1019581c72f6e83cd4 (patch) | |
tree | 5c80956e4b796340e497565d0e3f8ded016d5ac7 /plugins | |
parent | 5c6b2adeb2858fd957c19f1f36ac8aee211d1640 (diff) | |
download | poezio-67c5bee9dac6f4547cfedf1019581c72f6e83cd4.tar.gz poezio-67c5bee9dac6f4547cfedf1019581c72f6e83cd4.tar.bz2 poezio-67c5bee9dac6f4547cfedf1019581c72f6e83cd4.tar.xz poezio-67c5bee9dac6f4547cfedf1019581c72f6e83cd4.zip |
Fix the quote plugin
(broken when refactoring messages)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/quote.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/quote.py b/plugins/quote.py index 20bd9133..d7bc1e2a 100644 --- a/plugins/quote.py +++ b/plugins/quote.py @@ -45,8 +45,10 @@ Options """ from poezio.core.structs import Completion +from poezio.ui.types import Message from poezio.plugin import BasePlugin from poezio.xhtml import clean_text +from poezio.theming import get_theme from poezio import common from poezio import tabs @@ -74,13 +76,14 @@ class Plugin(BasePlugin): return self.api.run_command('/help quote') message = self.find_message(message) if message: + str_time = message.time.strftime(get_theme().SHORT_TIME_FORMAT) before = self.config.get('before_quote', '') % { 'nick': message.nickname or '', - 'time': message.str_time + 'time': str_time, } after = self.config.get('after_quote', '') % { 'nick': message.nickname or '', - 'time': message.str_time + 'time': str_time, } self.core.insert_input_text( '%(before)s%(quote)s%(after)s' % { @@ -96,7 +99,7 @@ class Plugin(BasePlugin): if not messages: return None for message in messages[::-1]: - if clean_text(message.txt) == txt: + if isinstance(message, Message) and clean_text(message.txt) == txt: return message return None @@ -114,5 +117,8 @@ class Plugin(BasePlugin): messages = list(filter(message_match, messages)) elif len(args) > 1: return False - return Completion(the_input.auto_completion, - [clean_text(msg.txt) for msg in messages[::-1]], '') + return Completion( + the_input.auto_completion, + [clean_text(msg.txt) for msg in messages[::-1] if isinstance(msg, Message)], + '' + ) |