From bec71fe38d76524cdf04866180f5e3eec4f13701 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 17 Sep 2014 18:51:56 +0200 Subject: Fix #2581 (fix /untell completion) --- plugins/tell.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/tell.py b/plugins/tell.py index 6aa8357d..cfa76e9c 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -61,7 +61,7 @@ class Plugin(BasePlugin): if not nick in self.tabs[tab]: self.tabs[tab][nick] = [] self.tabs[tab][nick].append(msg) - self.api.information('Will tell %s' % nick, 'Info') + self.api.information('Message for %s queued' % nick, 'Info') def command_untell(self, args): """/untell """ @@ -72,10 +72,11 @@ class Plugin(BasePlugin): if not nick in self.tabs[tab]: return del self.tabs[tab][nick] + self.api.information('Messages for %s unqueued' % nick, 'Info') 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]), '') + return the_input.auto_completion(list(self.tabs[tab]), '', quotify=False) -- cgit v1.2.3 From 41a89dc2acb98a2aa50d6fd9ab37a2be65f5cfa0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 26 Sep 2014 13:54:50 +0200 Subject: Update OTR documentation --- plugins/otr.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/otr.py b/plugins/otr.py index 74b06cf1..47f1fc11 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -41,8 +41,8 @@ Install the python module: cd pure-python-otr python3 setup.py install --user -You can also use pip with the requirements.txt at the root of -the poezio directory. +You can also use pip in a virtualenv (built-in as pyvenv_ with python since 3.3) +with the requirements.txt at the root of the poezio directory. Usage @@ -148,20 +148,22 @@ Configuration Log conversations (OTR start/end marker, and messages). -The :term:`allow_v1`, :term:`allow_v2`, :term:`decode_html` +The :term:`allow_v1`, :term:`allow_v2`, :term:`decode_xhtml` and :term:`log` configuration parameters are tab-specific. Important details ----------------- -The OTR session is considered for a full jid, but the trust is considered -with a bare JID. This is important to know in the case of Private Chats, since -you cannot always get the real the JID of your contact (or check if the same -nick is used by different people). +The OTR session is considered for a full JID (e.g. toto@example/**client1**), +but the trust is set with a bare JID (e.g. toto@example). This is important +in the case of Private Chats (in a chatroom), since you cannot always get the +real JID of your contact (or check if the same nick is used by different people). .. _Off The Record messaging: http://wiki.xmpp.org/web/OTR +.. _pyvenv: https://docs.python.org/3/using/scripts.html#pyvenv-creating-virtual-environments """ + from gettext import gettext as _ import potr import logging -- cgit v1.2.3 From a0c5f958819444035894b665a1ef10ddab91dd0b Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 12 Oct 2014 22:08:28 +0200 Subject: Add a notification in the OTR plugin if the session isn't established With a timeout option that lets the user choose the timeout and if they want this notification. --- plugins/otr.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'plugins') diff --git a/plugins/otr.py b/plugins/otr.py index 47f1fc11..88967b75 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -143,6 +143,13 @@ Configuration Allow OTRv1 + timeout + **Default:** ``3`` + + The number of seconds poezio will wait until notifying you + that the OTR session was not established. A negative or null + value will disable this notification. + log **Default:** false @@ -599,8 +606,27 @@ class Plugin(BasePlugin): context.disconnect() elif arg == 'start' or arg == 'refresh': otr = self.get_context(name) + secs = self.config.get('timeout', 3) + def notify_otr_timeout(): + if otr.state != STATE_ENCRYPTED: + text = _('%(jid_c)s%(jid)s%(info)s did not enable' + ' OTR after %(sec)s seconds.') % { + 'jid': tab.name, + 'info': color_info, + 'jid_c': color_jid, + 'sec': secs} + tab.add_message(text, typ=0) + self.core.refresh_window() + if secs > 0: + event = self.api.create_delayed_event(secs, notify_otr_timeout) + self.api.add_timed_event(event) self.core.xmpp.send_message(mto=name, mtype='chat', mbody=self.contexts[name].sendMessage(0, b'?OTRv?').decode()) + text = _('%(info)sOTR request to %(jid_c)s%(jid)s%(info)s sent') % { + 'jid': tab.name, + 'info': color_info, + 'jid_c': color_jid} + tab.add_message(text, typ=0) elif arg == 'ourfpr': fpr = self.account.getPrivkey() self.api.information('Your OTR key fingerprint is %s' % fpr, 'OTR') -- cgit v1.2.3 From 25e91b0c9453cc235b539c39caf33853d618a51d Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 12 Oct 2014 22:23:45 +0200 Subject: Give feedback on the OTR commands in the current tab instead of the global info buffer --- plugins/otr.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/otr.py b/plugins/otr.py index 88967b75..c2e5a663 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -597,6 +597,7 @@ class Plugin(BasePlugin): name = tab.name color_jid = '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID) color_info = '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT) + color_normal = '\x19%s}' % dump_tuple(get_theme().COLOR_NORMAL_TEXT) if isinstance(tab, DynamicConversationTab) and tab.locked_resource: name = safeJID(tab.name) name.resource = tab.locked_resource @@ -622,18 +623,38 @@ class Plugin(BasePlugin): self.api.add_timed_event(event) self.core.xmpp.send_message(mto=name, mtype='chat', mbody=self.contexts[name].sendMessage(0, b'?OTRv?').decode()) - text = _('%(info)sOTR request to %(jid_c)s%(jid)s%(info)s sent') % { + text = _('%(info)sOTR request to %(jid_c)s%(jid)s%(info)s sent.') % { 'jid': tab.name, 'info': color_info, 'jid_c': color_jid} tab.add_message(text, typ=0) elif arg == 'ourfpr': fpr = self.account.getPrivkey() - self.api.information('Your OTR key fingerprint is %s' % fpr, 'OTR') + text = _('%(info)sYour OTR key fingerprint is %(norm)s%(fpr)s.') % { + 'jid': tab.name, + 'info': color_info, + 'norm': color_normal, + 'fpr': fpr} + tab.add_message(text, typ=0) elif arg == 'fpr': if name in self.contexts: ctx = self.contexts[name] - self.api.information('The key fingerprint for %s is %s' % (name, ctx.getCurrentKey()) , 'OTR') + if ctx.getCurrentKey() is not None: + text = _('%(info)sThe key fingerprint for %(jid_c)s' + '%(jid)s%(info)s is %(norm)s%(fpr)s%(info)s.') % { + 'jid': tab.name, + 'info': color_info, + 'norm': color_normal, + 'jid_c': color_jid, + 'fpr': ctx.getCurrentKey()} + tab.add_message(text, typ=0) + else: + text = _('%(jid_c)s%(jid)s%(info)s has no' + ' key currently in use.') % { + 'jid': tab.name, + 'info': color_info, + 'jid_c': color_jid} + tab.add_message(text, typ=0) elif arg == 'drop': # drop the privkey (and obviously, end the current conversations before that) for context in self.contexts.values(): -- cgit v1.2.3 From 8305f3bd53412cd694baffadbca645227c9c883f Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 13 Oct 2014 00:39:55 +0200 Subject: Document the before_quote and the after_quote options of the quote plugin --- plugins/quote.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'plugins') diff --git a/plugins/quote.py b/plugins/quote.py index 3236ef4d..8a4fd95c 100644 --- a/plugins/quote.py +++ b/plugins/quote.py @@ -19,6 +19,28 @@ Usage If there is a message at 21:12:23, it will be put in the input. If there isn’t, you will get a warning. + +Options +------- + +.. glossary:: + :sorted: + + before_quote + + **Default value:** ``[empty]`` + + Text to insert before the quote. ``%(nick)s`` and ``%(time)s`` can + be used to insert the nick of the user who sent the message or the + time of the message. + + after_quote + + **Default value:** ``[empty]`` + + Text to insert after the quote. ``%(nick)s`` and ``%(time)s`` can + be used to insert the nick of the user who sent the message or the + time of the message. """ from plugin import BasePlugin from xhtml import clean_text -- cgit v1.2.3