diff options
author | mathieui <mathieui@mathieui.net> | 2016-08-21 15:27:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-08-21 15:39:30 +0200 |
commit | 84e59b05ff0a17178da9ecdb6c5d084e48b42763 (patch) | |
tree | 224948d7c3d49a0005bff9390260357b3ec9c60e /plugins/otr.py | |
parent | 6c270b363ac018dfd4d66b23af95efcc35610da0 (diff) | |
download | poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.gz poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.bz2 poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.xz poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.zip |
Don’t call input completion() functions inside completion methods
Use a placeholder object that can run it afterwards, so that we don’t
have side effects inside those functions.
Diffstat (limited to 'plugins/otr.py')
-rw-r--r-- | plugins/otr.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/otr.py b/plugins/otr.py index 562bc197..1f41cf71 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -194,6 +194,7 @@ from poezio.plugin import BasePlugin from poezio.tabs import ConversationTab, DynamicConversationTab, PrivateTab from poezio.theming import get_theme, dump_tuple from poezio.decorators import command_args_parser +from poezio.core.structs import Completion OTR_DIR = os.path.join(os.getenv('XDG_DATA_HOME') or '~/.local/share', 'poezio', 'otr') @@ -912,7 +913,7 @@ class Plugin(BasePlugin): Completion for /otr """ comp = ['start', 'fpr', 'ourfpr', 'refresh', 'end', 'trust', 'untrust'] - return the_input.new_completion(comp, 1, quotify=False) + return Completion(the_input.new_completion, comp, 1, quotify=False) @command_args_parser.quoted(1, 2) def command_smp(self, args): @@ -972,7 +973,7 @@ class Plugin(BasePlugin): def completion_smp(the_input): """Completion for /otrsmp""" if the_input.get_argument_position() == 1: - return the_input.new_completion(['ask', 'answer', 'abort'], 1, quotify=False) + return Completion(the_input.new_completion, ['ask', 'answer', 'abort'], 1, quotify=False) def get_tlv(tlvs, cls): """Find the instance of a class in a list""" |