about summary refs log tree commit diff stats
path: root/src/omemo/omemo.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-12-06 13:49:04 +0100
committerGitHub <noreply@github.com>2021-12-06 13:49:04 +0100
commitb67054aa39702276d1dd7cd5a469fffed5a72144 (patch)
tree5918025b5577c86a77168013b1aaeff92abd0c7f /src/omemo/omemo.c
parent6c3e6a5262c6009f43dddb6fd5a2fc8204520eef (diff)
parent5355c9b856824cbe63d5fcfeb35ec83f8fe804f7 (diff)
downloadprofani-tty-b67054aa39702276d1dd7cd5a469fffed5a72144.tar.gz
Merge branch 'master' into xep/xep0107-user-mood
Diffstat (limited to 'src/omemo/omemo.c')
-rw-r--r--src/omemo/omemo.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c
index e1126e62..4d53ad0c 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 _acquire_sender_devices_list(void);
 
 typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list);
 
@@ -384,21 +385,26 @@ omemo_publish_crypto_materials(void)
         return;
     }
 
+    omemo_bundle_publish(true);
+}
+
+static void _acquire_sender_devices_list(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);
 }
 
 void
 omemo_start_sessions(void)
 {
+    // before any session may be started, a list on
+    // available sender devices must be acquired
+    log_debug("[OMEMO] Acquiring sender devices list");
+    _acquire_sender_devices_list();
+
     GSList* contacts = roster_get_contacts(ROSTER_ORD_NAME);
     if (contacts) {
         GSList* curr;