summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-10-12 22:23:45 +0200
committermathieui <mathieui@mathieui.net>2014-10-12 22:23:45 +0200
commit25e91b0c9453cc235b539c39caf33853d618a51d (patch)
treeda20357ee534e7b2f47b8b07f72d13397df54b1d /plugins
parenta0c5f958819444035894b665a1ef10ddab91dd0b (diff)
downloadpoezio-25e91b0c9453cc235b539c39caf33853d618a51d.tar.gz
poezio-25e91b0c9453cc235b539c39caf33853d618a51d.tar.bz2
poezio-25e91b0c9453cc235b539c39caf33853d618a51d.tar.xz
poezio-25e91b0c9453cc235b539c39caf33853d618a51d.zip
Give feedback on the OTR commands in the current tab
instead of the global info buffer
Diffstat (limited to 'plugins')
-rw-r--r--plugins/otr.py27
1 files changed, 24 insertions, 3 deletions
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():