From 84e59b05ff0a17178da9ecdb6c5d084e48b42763 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 21 Aug 2016 15:27:53 +0200 Subject: =?UTF-8?q?Don=E2=80=99t=20call=20input=20completion()=20functions?= =?UTF-8?q?=20inside=20completion=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a placeholder object that can run it afterwards, so that we don’t have side effects inside those functions. --- plugins/otr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins/otr.py') 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""" -- cgit v1.2.3