merge/upstream-full #105
@@ -8686,8 +8686,9 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
|
||||
for (GList* fingerprint = fingerprints; fingerprint != NULL; fingerprint = fingerprint->next) {
|
||||
auto_char char* formatted_fingerprint = omemo_format_fingerprint(fingerprint->data);
|
||||
gboolean trusted = omemo_is_trusted_identity(jid->barejid, fingerprint->data);
|
||||
gboolean active = omemo_is_device_active(jid->barejid, fingerprint->data);
|
||||
|
||||
win_println(window, THEME_DEFAULT, "-", "%s's OMEMO fingerprint: %s%s", jid->barejid, formatted_fingerprint, trusted ? " (trusted)" : "");
|
||||
win_println(window, THEME_DEFAULT, "-", "%s's OMEMO fingerprint: %s%s%s", jid->barejid, formatted_fingerprint, trusted ? " (trusted)" : " (untrusted)", active ? " (active)" : " (inactive)");
|
||||
}
|
||||
|
||||
g_list_free(fingerprints);
|
||||
|
||||
@@ -1313,6 +1313,39 @@ omemo_get_jid_untrusted_fingerprints(const char* const jid)
|
||||
return untrusted_fps;
|
||||
}
|
||||
|
||||
gboolean
|
||||
omemo_is_device_active(const char* const jid, const char* const fingerprint)
|
||||
{
|
||||
if (!omemo_loaded()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GList* device_list = g_hash_table_lookup(omemo_ctx.device_list, jid);
|
||||
if (!device_list) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GHashTable* known_identities = g_hash_table_lookup(omemo_ctx.known_devices, jid);
|
||||
if (!known_identities) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void* device_id = g_hash_table_lookup(known_identities, fingerprint);
|
||||
if (!device_id) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint32_t dev_id = GPOINTER_TO_INT(device_id);
|
||||
GList* iter;
|
||||
for (iter = device_list; iter != NULL; iter = iter->next) {
|
||||
if (GPOINTER_TO_INT(iter->data) == dev_id) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char*
|
||||
_omemo_fingerprint(ec_public_key* identity, gboolean formatted)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,7 @@ GList* omemo_known_device_identities(const char* const jid);
|
||||
gboolean omemo_is_trusted_identity(const char* const jid, const char* const fingerprint);
|
||||
gboolean omemo_is_jid_trusted(const char* const jid);
|
||||
GList* omemo_get_jid_untrusted_fingerprints(const char* const jid);
|
||||
gboolean omemo_is_device_active(const char* const jid, const char* const fingerprint);
|
||||
char* omemo_fingerprint_autocomplete(const char* const search_str, gboolean previous, void* context);
|
||||
void omemo_fingerprint_autocomplete_reset(void);
|
||||
gboolean omemo_automatic_start(const char* const recipient);
|
||||
|
||||
@@ -42,12 +42,30 @@ omemo_is_trusted_identity(const char* const jid, const char* const fingerprint)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
omemo_is_jid_trusted(const char* const jid)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GList*
|
||||
omemo_get_jid_untrusted_fingerprints(const char* const jid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GList*
|
||||
omemo_known_device_identities(const char* const jid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
omemo_is_device_active(const char* const jid, const char* const fingerprint)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
omemo_loaded(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user