From f8c1f564ae484b3a994b389188622bbe5e22861e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Sun, 25 Mar 2018 22:01:34 +0200 Subject: [PATCH] olm: Mark one time keys as published and store the account. --- main.py | 4 ++++ matrix/encryption.py | 4 ++++ matrix/events.py | 3 +++ 3 files changed, 11 insertions(+) diff --git a/main.py b/main.py index eab1e41..4e18f7b 100644 --- a/main.py +++ b/main.py @@ -432,6 +432,10 @@ def room_close_cb(data, buffer): @utf8_decode def matrix_unload_cb(): matrix_config_free(matrix.globals.CONFIG) + + for server in SERVERS.values(): + server.store_olm() + W.prnt("", "unloading") return W.WEECHAT_RC_OK diff --git a/matrix/encryption.py b/matrix/encryption.py index aced6ac..23e4156 100644 --- a/matrix/encryption.py +++ b/matrix/encryption.py @@ -199,3 +199,7 @@ class Olm(): )) return signature + + @encrypt_enabled + def mark_keys_as_published(self): + self.account.mark_keys_as_published() diff --git a/matrix/events.py b/matrix/events.py index fb6932c..8cfdf06 100644 --- a/matrix/events.py +++ b/matrix/events.py @@ -74,6 +74,9 @@ class MatrixKeyUploadEvent(MatrixEvent): MatrixEvent.__init__(self, server) def execute(self): + self.server.olm.mark_keys_as_published() + self.server.store_olm() + if not self.device_keys: return