summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/admin.py3
-rw-r--r--plugins/alias.py3
-rw-r--r--plugins/bob.py3
-rw-r--r--plugins/irc.py5
-rw-r--r--plugins/mpd_client.py3
-rw-r--r--plugins/otr.py5
-rw-r--r--plugins/ping.py5
-rw-r--r--plugins/quote.py3
-rw-r--r--plugins/reminder.py9
-rw-r--r--plugins/send_delayed.py3
-rw-r--r--plugins/tell.py5
11 files changed, 29 insertions, 18 deletions
diff --git a/plugins/admin.py b/plugins/admin.py
index 01672014..8c632532 100644
--- a/plugins/admin.py
+++ b/plugins/admin.py
@@ -53,6 +53,7 @@ For affiliations
from poezio.plugin import BasePlugin
from poezio.tabs import MucTab
+from poezio.core.structs import Completion
class Plugin(BasePlugin):
"""
@@ -113,7 +114,7 @@ class Plugin(BasePlugin):
compare_users = lambda x: x.last_talked
word_list = [user.nick for user in sorted(tab.users, key=compare_users, reverse=True)\
if user.nick != tab.own_nick]
- return the_input.auto_completion(word_list, '')
+ return Completion(the_input.auto_completion, word_list, '')
diff --git a/plugins/alias.py b/plugins/alias.py
index 839fa3d8..108fde54 100644
--- a/plugins/alias.py
+++ b/plugins/alias.py
@@ -66,6 +66,7 @@ Example of the syntax:
from poezio.plugin import BasePlugin
from poezio.common import shell_split
+from poezio.core.structs import Completion
class Plugin(BasePlugin):
@@ -140,7 +141,7 @@ class Plugin(BasePlugin):
"Completion for /unalias"
aliases = [alias for alias in self.commands]
aliases.sort()
- return the_input.auto_completion(aliases, '', quotify=False)
+ return Completion(the_input.auto_completion, aliases, '', quotify=False)
def get_command(self, name):
"""Returns the function associated with a command"""
diff --git a/plugins/bob.py b/plugins/bob.py
index b2a6441e..527692b3 100644
--- a/plugins/bob.py
+++ b/plugins/bob.py
@@ -22,6 +22,7 @@ Configuration options
The time during which the file should stay in cache on the receiving side.
"""
+from poezio.core.structs import Completion
from poezio.plugin import BasePlugin
from poezio import tabs
@@ -72,4 +73,4 @@ class Plugin(BasePlugin):
mime_type = guess_type(filename)[0]
if mime_type is not None and mime_type.startswith('image/'):
images.append(filename)
- return the_input.auto_completion(images, quotify=False)
+ return Completion(the_input.auto_completion, images, quotify=False)
diff --git a/plugins/irc.py b/plugins/irc.py
index 56ce5c9c..263d7d22 100644
--- a/plugins/irc.py
+++ b/plugins/irc.py
@@ -131,6 +131,7 @@ Example configuration
from poezio.plugin import BasePlugin
from poezio.decorators import command_args_parser
+from poezio.core.structs import Completion
from poezio import common
from poezio import tabs
@@ -270,7 +271,7 @@ class Plugin(BasePlugin):
sections.remove(section)
except:
pass
- return the_input.new_completion(sections, pos)
+ return Completion(the_input.new_completion, sections, pos)
@command_args_parser.quoted(1, 1)
def command_irc_join(self, args):
@@ -375,6 +376,6 @@ class Plugin(BasePlugin):
sections = self.config.sections()
if 'irc' in sections:
sections.remove('irc')
- return the_input.new_completion(sections, 1)
+ return Completion(the_input.new_completion, sections, 1)
diff --git a/plugins/mpd_client.py b/plugins/mpd_client.py
index 82e94ad1..6115c0da 100644
--- a/plugins/mpd_client.py
+++ b/plugins/mpd_client.py
@@ -49,6 +49,7 @@ Usage
from poezio.plugin import BasePlugin
from poezio.common import shell_split
+from poezio.core.structs import Completion
from os.path import basename as base
from poezio import tabs
import mpd
@@ -84,4 +85,4 @@ class Plugin(BasePlugin):
self.api.information('Cannot send result (%s)' % s, 'Error')
def completion_mpd(self, the_input):
- return the_input.auto_completion(['full'], quotify=False)
+ return Completion(the_input.auto_completion, ['full'], quotify=False)
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"""
diff --git a/plugins/ping.py b/plugins/ping.py
index 066ad1f6..533053b7 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -27,6 +27,7 @@ from poezio.plugin import BasePlugin
from poezio.roster import roster
from poezio.common import safeJID
from poezio.contact import Contact, Resource
+from poezio.core.structs import Completion
from poezio import tabs
import time
@@ -74,7 +75,7 @@ class Plugin(BasePlugin):
users = [user.nick for user in self.api.current_tab().users]
l = self.resources()
users.extend(l)
- return the_input.auto_completion(users, '', quotify=False)
+ return Completion(the_input.auto_completion, users, '', quotify=False)
@command_args_parser.raw
def command_private_ping(self, arg):
@@ -115,5 +116,5 @@ class Plugin(BasePlugin):
return l
def completion_ping(self, the_input):
- return the_input.auto_completion(self.resources(), '', quotify=False)
+ return Completion(the_input.auto_completion, self.resources(), '', quotify=False)
diff --git a/plugins/quote.py b/plugins/quote.py
index ba7f4ea3..a5ffd193 100644
--- a/plugins/quote.py
+++ b/plugins/quote.py
@@ -44,6 +44,7 @@ Options
time of the message.
"""
+from poezio.core.structs import Completion
from poezio.plugin import BasePlugin
from poezio.xhtml import clean_text
from poezio import common
@@ -101,5 +102,5 @@ class Plugin(BasePlugin):
messages = list(filter(message_match, messages))
elif len(args) > 1:
return False
- return 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]], '')
diff --git a/plugins/reminder.py b/plugins/reminder.py
index a5ab1f00..f8a69f70 100644
--- a/plugins/reminder.py
+++ b/plugins/reminder.py
@@ -47,10 +47,11 @@ Will remind you to get up every 1 hour 23 minutes.
"""
+from poezio.core.structs import Completion
from poezio.plugin import BasePlugin
-import curses
-from poezio import common
from poezio import timed_events
+from poezio import common
+import curses
class Plugin(BasePlugin):
@@ -107,10 +108,10 @@ class Plugin(BasePlugin):
if txt.endswith(' '):
n += 1
if n == 2:
- return the_input.auto_completion(["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
+ return Completion(the_input.auto_completion, ["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
def completion_done(self, the_input):
- return the_input.auto_completion(["%s" % key for key in self.tasks], '')
+ return Completion(the_input.auto_completion, ["%s" % key for key in self.tasks], '')
def command_done(self, arg="0"):
try:
diff --git a/plugins/send_delayed.py b/plugins/send_delayed.py
index 8c536ea8..299de6e2 100644
--- a/plugins/send_delayed.py
+++ b/plugins/send_delayed.py
@@ -19,6 +19,7 @@ This plugin adds a command to the chat tabs.
"""
from poezio.plugin import BasePlugin
+from poezio.core.structs import Completion
from poezio.decorators import command_args_parser
from poezio import tabs
from poezio import common
@@ -54,7 +55,7 @@ class Plugin(BasePlugin):
if txt.endswith(' '):
n += 1
if n == 2:
- return the_input.auto_completion(["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
+ return Completion(the_input.auto_completion, ["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
def say(self, args=None):
if not args:
diff --git a/plugins/tell.py b/plugins/tell.py
index 2b3eb0ce..ba638e82 100644
--- a/plugins/tell.py
+++ b/plugins/tell.py
@@ -20,6 +20,7 @@ This plugin defines two new commands for MUC tabs: :term:`/tell` and :term:`/unt
"""
from poezio.plugin import BasePlugin
+from poezio.core.structs import Completion
from poezio.decorators import command_args_parser
from poezio import tabs
@@ -77,6 +78,6 @@ class Plugin(BasePlugin):
def completion_untell(self, the_input):
tab = self.api.current_tab()
if not tab in self.tabs:
- return the_input.auto_completion([], '')
- return the_input.auto_completion(list(self.tabs[tab]), '', quotify=False)
+ return Completion(the_input.auto_completion, [], '')
+ return Completion(the_input.auto_completion, list(self.tabs[tab]), '', quotify=False)