1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Refined sender device acquirement

Now the sender devices are acknowledged only after omemo is loaded. That
is, after key generation has been completed or identity has been loaded.
This commit is contained in:
nandesu-utils 2021-10-29 01:15:55 +09:00
parent 17d62921e9
commit fee23b55f0
No known key found for this signature in database
GPG Key ID: EA19BE17F9C938B7

View File

@ -84,7 +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);
static void _acquire_sender_devices_list(void);
typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list);
@ -304,9 +304,6 @@ 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
@ -391,7 +388,7 @@ omemo_publish_crypto_materials(void)
omemo_bundle_publish(true);
}
static void _omemo_sender_devices(void) {
static void _acquire_sender_devices_list(void) {
char* barejid = connection_get_barejid();
g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list);
@ -403,6 +400,11 @@ static void _omemo_sender_devices(void) {
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;