mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Show contacts fingerprint on /otr theirfp
This commit is contained in:
parent
03086c0384
commit
5a7eba518d
@ -2313,7 +2313,7 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (strcmp(args[0], "myfp") == 0) {
|
} else if (strcmp(args[0], "myfp") == 0) {
|
||||||
char *fingerprint = otr_get_my_fingerprint();
|
char *fingerprint = otr_get_my_fingerprint();
|
||||||
cons_show("Your fingerprint: %s", fingerprint);
|
ui_current_print_line("Your OTR fingerprint: %s", fingerprint);
|
||||||
free(fingerprint);
|
free(fingerprint);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (strcmp(args[0], "theirfp") == 0) {
|
} else if (strcmp(args[0], "theirfp") == 0) {
|
||||||
|
15
src/otr.c
15
src/otr.c
@ -345,8 +345,17 @@ otr_get_my_fingerprint(void)
|
|||||||
char *
|
char *
|
||||||
otr_get_their_fingerprint(char *recipient)
|
otr_get_their_fingerprint(char *recipient)
|
||||||
{
|
{
|
||||||
char *fingerprint = "1234 5678";
|
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
|
||||||
return strdup(fingerprint);
|
0, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
if (context != NULL) {
|
||||||
|
Fingerprint *fingerprint = context->active_fingerprint;
|
||||||
|
char readable[45];
|
||||||
|
otrl_privkey_hash_to_human(readable, fingerprint->fingerprint);
|
||||||
|
return strdup(readable);
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -386,6 +395,7 @@ otr_decrypt_message(const char * const from, const char * const message)
|
|||||||
|
|
||||||
// internal libotr message, ignore
|
// internal libotr message, ignore
|
||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
|
cons_debug("Internal message.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// message was decrypted, return to user
|
// message was decrypted, return to user
|
||||||
@ -395,6 +405,7 @@ otr_decrypt_message(const char * const from, const char * const message)
|
|||||||
|
|
||||||
// normal non OTR message
|
// normal non OTR message
|
||||||
} else {
|
} else {
|
||||||
|
cons_debug("Non OTR message.");
|
||||||
return strdup(message);
|
return strdup(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user