mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
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.
This commit is contained in:
parent
b4d65335f6
commit
17d62921e9
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user