1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge pull request #1610 from nandesu-utils/master

Fix message encryption for sender devices
This commit is contained in:
Michael Vetter 2021-11-30 15:31:51 +01:00 committed by GitHub
commit 7a8f0e4873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 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 _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 _g_hash_table_free(GHashTable* hash_table);
static void _acquire_sender_devices_list(void);
typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list); typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list);
@ -384,21 +385,26 @@ omemo_publish_crypto_materials(void)
return; return;
} }
omemo_bundle_publish(true);
}
static void _acquire_sender_devices_list(void) {
char* barejid = connection_get_barejid(); 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); g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list);
omemo_devicelist_request(barejid); omemo_devicelist_request(barejid);
omemo_bundle_publish(true);
free(barejid); free(barejid);
} }
void void
omemo_start_sessions(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); GSList* contacts = roster_get_contacts(ROSTER_ORD_NAME);
if (contacts) { if (contacts) {
GSList* curr; GSList* curr;