diff options
author | nandesu-utils <70854931+nandesu-utils@users.noreply.github.com> | 2021-10-28 04:01:07 +0900 |
---|---|---|
committer | nandesu-utils <70854931+nandesu-utils@users.noreply.github.com> | 2021-10-28 04:23:41 +0900 |
commit | 17d62921e9d2cfa8ade544c64a69d14d8ea66377 (patch) | |
tree | e782e8cde2896cad3588aa8e8e856d600e5bacbc | |
parent | b4d65335f63351c551f27a6e59edbb11e0dd5f52 (diff) | |
download | profani-tty-17d62921e9d2cfa8ade544c64a69d14d8ea66377.tar.gz |
Acquire sender's device list on connection
After generation of an identity we observe that `omemo_ctx.device_list` has an entry for sender's jid. But on application restart it is absent thus messages are not encrypted for the rest set of sender devices. This commit fixes this by applying code for acquiring the aforementioned device list after the connection.
-rw-r--r-- | src/omemo/omemo.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index e1126e62..273bbd21 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -84,6 +84,7 @@ static unsigned char* _omemo_fingerprint_decode(const char* const fingerprint, s static char* _omemo_unformat_fingerprint(const char* const fingerprint_formatted); static void _cache_device_identity(const char* const jid, uint32_t device_id, ec_public_key* identity); static void _g_hash_table_free(GHashTable* hash_table); +static void _omemo_sender_devices(void); typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list); @@ -303,6 +304,9 @@ omemo_on_connect(ProfAccount* account) log_warning("[OMEMO] no such file: %s", omemo_ctx.trust_filename->str); g_error_free(error); } + + log_debug("[OMEMO] Acquiring sender devices for current account"); + _omemo_sender_devices(); } void @@ -384,15 +388,15 @@ omemo_publish_crypto_materials(void) return; } + omemo_bundle_publish(true); +} + +static void _omemo_sender_devices(void) { char* barejid = connection_get_barejid(); - /* Ensure we get our current device list, and it gets updated with our - * device_id */ g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list); omemo_devicelist_request(barejid); - omemo_bundle_publish(true); - free(barejid); } |