From bc2731364b13427355fb5188138be89ec7ad7bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:18:39 +0100 Subject: [PATCH 1/5] [omemo] Only publish own deviceid if request fails --- omemo/omemoplugin.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/omemo/omemoplugin.py b/omemo/omemoplugin.py index 49fc0125..45ce5bba 100644 --- a/omemo/omemoplugin.py +++ b/omemo/omemoplugin.py @@ -764,19 +764,25 @@ class OmemoPlugin(GajimPlugin): return True @log_calls('OmemoPlugin') - def publish_own_devices_list(self, account): - """ Check if the passed event is a device list update and store the new - device ids. + def publish_own_devices_list(self, account, new=False): + """ Get all currently known own active device ids and publish them Parameters ---------- account : str the account name + + new : bool + if True, a devicelist with only one + (the current id of this instance) device id is pushed """ state = self.get_omemo_state(account) - devices_list = state.own_devices - devices_list.append(state.own_device_id) - devices_list = list(set(devices_list)) + if new: + devices_list = [state.own_device_id] + else: + devices_list = state.own_devices + devices_list.append(state.own_device_id) + devices_list = list(set(devices_list)) state.set_own_devices(devices_list) log.debug(account + ' => Publishing own Devices: ' + str( @@ -1047,7 +1053,7 @@ class OmemoPlugin(GajimPlugin): devices_list = list(set(unpack_device_list_update(stanza, account))) if len(devices_list) == 0: log.error(account + ' => Devicelistquery was NOT successful') - self.publish_own_devices_list(account) + self.publish_own_devices_list(account, new=True) return False contact_jid = stanza.getAttr('from') if contact_jid == my_jid: @@ -1065,7 +1071,7 @@ class OmemoPlugin(GajimPlugin): self.publish_own_devices_list(account) else: log.error(account + ' => Devicelistquery was NOT successful') - self.publish_own_devices_list(account) + self.publish_own_devices_list(account, new=True) @log_calls('OmemoPlugin') def clear_device_list(self, account): -- GitLab From 11fb760a4df23f63a78cb63de565b54ae9a75556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:19:50 +0100 Subject: [PATCH 2/5] [omemo] Dont handle type 'normal' messages --- omemo/omemoplugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/omemo/omemoplugin.py b/omemo/omemoplugin.py index 45ce5bba..8b4a71be 100644 --- a/omemo/omemoplugin.py +++ b/omemo/omemoplugin.py @@ -589,6 +589,9 @@ class OmemoPlugin(GajimPlugin): ------- Return if encryption is not activated """ + if event.type_ == 'normal': + return False + account = event.account if account in self.disabled_accounts: return -- GitLab From 547fda1b667312a2b3d8e201cd42efd30571ddf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:41:05 +0100 Subject: [PATCH 3/5] [omemo] Fix 'Copy to clipboard' --- omemo/fpr_dialog.ui | 2 ++ omemo/ui.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/omemo/fpr_dialog.ui b/omemo/fpr_dialog.ui index 969aebe5..73c18d46 100644 --- a/omemo/fpr_dialog.ui +++ b/omemo/fpr_dialog.ui @@ -292,6 +292,8 @@ True False + Copy to clipboard + True diff --git a/omemo/ui.py b/omemo/ui.py index 464913c8..1da35f08 100644 --- a/omemo/ui.py +++ b/omemo/ui.py @@ -23,7 +23,7 @@ import logging import os import message_control -from gi.repository import GObject, Gtk, GdkPixbuf +from gi.repository import GObject, Gtk, GdkPixbuf, Gdk # pylint: disable=import-error import gtkgui_helpers @@ -539,7 +539,7 @@ class OMEMOConfigDialog(GajimPluginConfigDialog): keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) pop = self.B.get_object('fprclipboard_menu') - pop.popup(None, None, None, event.button, event.time) + pop.popup(None, None, None, None, event.button, event.time) # keep_selection=True -> no further processing of click event # keep_selection=False-> further processing -> GTK usually selects @@ -553,9 +553,9 @@ class OMEMOConfigDialog(GajimPluginConfigDialog): for path in paths: it = mod.get_iter(path) jid, fpr = mod.get(it, 1, 3) - fprs.append('%s: %s' % (jid, fpr[4:-5])) - Gtk.Clipboard().set_text('\n'.join(fprs)) - Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) + fprs.append('%s: %s' % (jid, fpr[31:-12])) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text('\n'.join(fprs), -1) def update_context_list(self): self.fpr_model.clear() @@ -744,7 +744,7 @@ class FingerprintWindow(Gtk.Dialog): keep_selection = tw.get_selection().path_is_selected(pthinfo[0]) pop = self.xml.get_object('fprclipboard_menu') - pop.popup(None, None, None, event.button, event.time) + pop.popup(None, None, None, None, event.button, event.time) # keep_selection=True -> no further processing of click event # keep_selection=False-> further processing -> GTK usually selects @@ -762,8 +762,8 @@ class FingerprintWindow(Gtk.Dialog): it = mod.get_iter(path) jid, fpr = mod.get(it, 1, 3) fprs.append('%s: %s' % (jid, fpr[31:-12])) - Gtk.Clipboard().set_text('\n'.join(fprs)) - Gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs)) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text('\n'.join(fprs), -1) def update_context_list(self, *args): self.fpr_model.clear() -- GitLab From 282f56558325fc14fd7e3a545bf09737c706d559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:43:35 +0100 Subject: [PATCH 4/5] [omemo] Set devices active after receiving a msg Inactive or not known devices are added to the list of possible receiving devices after we receive them with a PreKeyWhisperMessage or WhisperMessage This is so we dont have to rely only on devicelist updates from the server --- omemo/omemo/state.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/omemo/omemo/state.py b/omemo/omemo/state.py index 2a9d5d08..2a899d1c 100644 --- a/omemo/omemo/state.py +++ b/omemo/omemo/state.py @@ -439,6 +439,7 @@ class OmemoState: # Publish new bundle after PreKey has been used # for building a new Session self.plugin.publish_bundle(self.account) + self.add_device(recipient_id, device_id) return key except UntrustedIdentityException as e: log.info(self.account + " => Received WhisperMessage " + @@ -451,6 +452,7 @@ class OmemoState: if self.isTrusted(recipient_id, device_id): sessionCipher = self.get_session_cipher(recipient_id, device_id) key = sessionCipher.decryptMsg(whisperMessage, textMsg=False) + self.add_device(recipient_id, device_id) return key else: raise Exception("Received WhisperMessage " -- GitLab From 18461876c2f468f3cbe28465902e8ac921562f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 28 Feb 2017 22:45:29 +0100 Subject: [PATCH 5/5] [omemo] Update CHANGELOG & manifest.ini --- omemo/CHANGELOG | 112 +++++---------------------------------------- omemo/manifest.ini | 5 +- 2 files changed, 13 insertions(+), 104 deletions(-) diff --git a/omemo/CHANGELOG b/omemo/CHANGELOG index 82c46bdb..e03cdd42 100644 --- a/omemo/CHANGELOG +++ b/omemo/CHANGELOG @@ -1,105 +1,15 @@ -1.0.1 / 2017-01-14 -- Better XEP Compliance -- Bugfixes - -1.0.0 / 2016-12-04 -- Bugfixes - -0.9.9 / 2016-12-01 -- Bugfixes - -0.9.8 / 2016-11-28 -- Fix a Problem where OMEMO wouldnt activate after the plugin is updated -- Add QR Verification Code to Plugin Config - -0.9.7 / 2016-11-12 -- Bugfixes - -0.9.6 / 2016-11-01 -- Bugfixes +2.0.3 / 2017-02-28 +- Set an inactive device active again after receiving a message from it -0.9.5 / 2016-10-10 -- Add GroupChat BETA -- Add Option to delete Fingerprints -- Add Option to deactivate Accounts for OMEMO +2.0.2 / 2017-02-28 +- Fix a bug when publishing devices +- Fix copying fingerprint +- Fix layout issue +- Dont handle type 'normal' messages -0.9.0 / 2016-08-28 -- Send INFO message to resources who dont support OMEMO -- Check dependencys and give correct error message -- Dont process PreKeyWhisperMessages without PreKey -- Dont process PGP messages - -0.8.1 / 2016-08-05 -- Query own Device Bundles on send button press -- Make Fingerprint Window higher and rename Buttons for something more appropriate +2.0.1 / 2017-01-14 +- Better XEP Compliance - Bugfixes -0.8.0 / 2016-08-03 -- Encryption improvements: --- SignedPreKey renews every 24 hours --- New PreKeys are generated and published if less then 80 are available --- If the Python Cryptography package is installed native encryption is now used (faster on old devices) --- Bundle Information is only pulled right before sending a Message (see Business rules of the OMEMO XEP) --- If Contact supports OMEMO, encryption is activated automatically - -- Other Stuff: --- The Fingerprint Window pops up if the Send Button is pressed and there are new Fingerprints in the DB --- Message Correction now works with OMEMO (Press STRG + UP Arrow to correct the last send message) --- SQL Refactoring, so new users dont have to go through DB Migration --- Small bugfixes - -0.7.5 / 2016-07-20 -================ -- Announcing of Support right after Plugin activation -- New Context Menu for Gajim Compact View -- Own Device Fingerprints are now available in the Fingerprint Window -- Small bugfixes - -0.7 / 2016-07-16 -================ -- Reworked publishing Devicelist -- Deactivate Gajim E2E on startup -- Added new OMEMO popup menu -- UI & handling of inactive Devices -- various refactoring - -0.6 / 2016-06-30 -================ -- Add MAM support -- Added Fingerprint Trustmanagment UI -- Added Plugin Config Menu - -0.5 / 2016-05-02 -================ -- Add Windows support -- Fix bugs - -0.4 / 2016-01-21 -================== - - * Update README.md - * Fix #32: Add own devices as possible OMEMO partners. - * Fix one of the errors in #26 - * Fix sqlite db intialization - * Use the standalone python-omemo library - * FIx LOG_DB errors / lost messages - * Move all OMEMO related parts to own dir - * Rename all links from kalkin/.. to omemo/... - * Update archlinux PKGBUILD to 0.3 - -0.3 / 2016-01-10 -================== - * Save if OMEMO is enabled between restarts - #17 - * Disable OMEMO if dependencies are missing - #9 - * Make logging less verbose - * Add Arch Linux PKGBUILD file (Thanks Tommaso Sardelli) - * Extend README - * Fix hiding OMEMO controls in muc - * Fix "'ChatControl' object has no attribute 'lock_image'" bug - #16 - * Ui clearly displays which message is encrypted (and how) - #15 - * Plaintext messages are now always marked - #15 - -# 2015-12-27 -- Fix crash, if jid is not in list (Thanks Mic92) -- Fix clear_device_list, if account is not connected (Thanks Mic92) -- Provide python-axolotl installation instructions in README and manifest.ini +2.0.0 / 2016-12-04 +- Port Plugin from GTK2 diff --git a/omemo/manifest.ini b/omemo/manifest.ini index d8822c56..0990a101 100644 --- a/omemo/manifest.ini +++ b/omemo/manifest.ini @@ -1,11 +1,10 @@ [info] name: OMEMO short_name: omemo -version: 1.0.1 +version: 2.0.3 description: OMEMO is an XMPP Extension Protocol (XEP) for secure multi-client end-to-end encryption based on Axolotl and PEP. You need to install some dependencys, you can find install instructions for your system in the Github Wiki. authors: Bahtiar `kalkin-` Gadimov Daniel Gultsch Philipp Hörist homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/OmemoGajimPlugin -min_gajim_version: 0.16.9 -max_gajim_version: 0.16.11 +min_gajim_version: 0.16.10 -- GitLab