mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added SMP secret authentication success message
This commit is contained in:
parent
c39c093fa5
commit
2bc19f4669
@ -2801,7 +2801,6 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
|||||||
} else {
|
} else {
|
||||||
char *recipient = ui_current_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
otr_smp_secret(recipient, secret);
|
otr_smp_secret(recipient, secret);
|
||||||
ui_current_print_formatted_line('!', 0, "OTR secret entered");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -407,9 +407,13 @@ _otr_smp_secret(const char * const recipient, const char *secret)
|
|||||||
// if recipient initiated SMP, send response, else initialise
|
// if recipient initiated SMP, send response, else initialise
|
||||||
if (g_hash_table_contains(smp_initiators, recipient)) {
|
if (g_hash_table_contains(smp_initiators, recipient)) {
|
||||||
otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
||||||
|
ui_current_print_formatted_line('!', 0, "Authenticating %s...", recipient);
|
||||||
|
ui_current_page_off();
|
||||||
g_hash_table_remove(smp_initiators, context->username);
|
g_hash_table_remove(smp_initiators, context->username);
|
||||||
} else {
|
} else {
|
||||||
otrl_message_initiate_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
otrl_message_initiate_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
||||||
|
ui_current_print_formatted_line('!', 0, "Awaiting authentication from %s...", recipient);
|
||||||
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
|
|||||||
} else {
|
} else {
|
||||||
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
||||||
if ((context->active_fingerprint->trust != NULL) && (context->active_fingerprint->trust[0] != '\0')) {
|
if ((context->active_fingerprint->trust != NULL) && (context->active_fingerprint->trust[0] != '\0')) {
|
||||||
|
ui_smp_successful(context->username);
|
||||||
ui_trust(context->username);
|
ui_trust(context->username);
|
||||||
otr_trust(context->username);
|
otr_trust(context->username);
|
||||||
} else {
|
} else {
|
||||||
@ -153,6 +154,7 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
|
|||||||
} else {
|
} else {
|
||||||
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
||||||
if ((context->active_fingerprint->trust != NULL) && (context->active_fingerprint->trust[0] != '\0')) {
|
if ((context->active_fingerprint->trust != NULL) && (context->active_fingerprint->trust[0] != '\0')) {
|
||||||
|
ui_smp_successful(context->username);
|
||||||
ui_trust(context->username);
|
ui_trust(context->username);
|
||||||
otr_trust(context->username);
|
otr_trust(context->username);
|
||||||
} else {
|
} else {
|
||||||
|
@ -767,6 +767,7 @@ _ui_gone_secure(const char * const recipient, gboolean trusted)
|
|||||||
title_bar_set_recipient(recipient_str->str);
|
title_bar_set_recipient(recipient_str->str);
|
||||||
g_string_free(recipient_str, TRUE);
|
g_string_free(recipient_str, TRUE);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
ui_current_page_off();
|
||||||
} else {
|
} else {
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
status_bar_new(num);
|
status_bar_new(num);
|
||||||
@ -793,6 +794,9 @@ _ui_smp_recipient_initiated(const char * const recipient)
|
|||||||
} else {
|
} else {
|
||||||
win_vprint_line(window, '!', 0, "%s wants to authenticate your identity, use '/otr secret <secret>'.", recipient);
|
win_vprint_line(window, '!', 0, "%s wants to authenticate your identity, use '/otr secret <secret>'.", recipient);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
if (wins_is_current(window)) {
|
||||||
|
ui_current_page_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,6 +809,9 @@ _ui_smp_unsuccessful_sender(const char * const recipient)
|
|||||||
} else {
|
} else {
|
||||||
win_vprint_line(window, '!', 0, "Authentication failed, the secret you entered does not match the secret entered by %s.", recipient);
|
win_vprint_line(window, '!', 0, "Authentication failed, the secret you entered does not match the secret entered by %s.", recipient);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
if (wins_is_current(window)) {
|
||||||
|
ui_current_page_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,6 +824,9 @@ _ui_smp_unsuccessful_receiver(const char * const recipient)
|
|||||||
} else {
|
} else {
|
||||||
win_vprint_line(window, '!', 0, "Authentication failed, the secret entered by %s does not match yours.", recipient);
|
win_vprint_line(window, '!', 0, "Authentication failed, the secret entered by %s does not match yours.", recipient);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
if (wins_is_current(window)) {
|
||||||
|
ui_current_page_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,6 +839,24 @@ _ui_smp_aborted(const char * const recipient)
|
|||||||
} else {
|
} else {
|
||||||
win_vprint_line(window, '!', 0, "SMP session aborted.");
|
win_vprint_line(window, '!', 0, "SMP session aborted.");
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
if (wins_is_current(window)) {
|
||||||
|
ui_current_page_off();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ui_smp_successful(const char * const recipient)
|
||||||
|
{
|
||||||
|
ProfWin *window = wins_get_by_recipient(recipient);
|
||||||
|
if (window == NULL) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
win_vprint_line(window, '!', 0, "Authentication successful.");
|
||||||
|
win_update_virtual(window);
|
||||||
|
if (wins_is_current(window)) {
|
||||||
|
ui_current_page_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,6 +874,7 @@ _ui_gone_insecure(const char * const recipient)
|
|||||||
title_bar_set_recipient(recipient_str->str);
|
title_bar_set_recipient(recipient_str->str);
|
||||||
g_string_free(recipient_str, TRUE);
|
g_string_free(recipient_str, TRUE);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -864,6 +893,7 @@ _ui_trust(const char * const recipient)
|
|||||||
title_bar_set_recipient(recipient_str->str);
|
title_bar_set_recipient(recipient_str->str);
|
||||||
g_string_free(recipient_str, TRUE);
|
g_string_free(recipient_str, TRUE);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -882,6 +912,7 @@ _ui_untrust(const char * const recipient)
|
|||||||
title_bar_set_recipient(recipient_str->str);
|
title_bar_set_recipient(recipient_str->str);
|
||||||
g_string_free(recipient_str, TRUE);
|
g_string_free(recipient_str, TRUE);
|
||||||
win_update_virtual(window);
|
win_update_virtual(window);
|
||||||
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2027,6 +2058,7 @@ ui_init_module(void)
|
|||||||
ui_trust = _ui_trust;
|
ui_trust = _ui_trust;
|
||||||
ui_untrust = _ui_untrust;
|
ui_untrust = _ui_untrust;
|
||||||
ui_smp_recipient_initiated = _ui_smp_recipient_initiated;
|
ui_smp_recipient_initiated = _ui_smp_recipient_initiated;
|
||||||
|
ui_smp_successful = _ui_smp_successful;
|
||||||
ui_smp_unsuccessful_sender = _ui_smp_unsuccessful_sender;
|
ui_smp_unsuccessful_sender = _ui_smp_unsuccessful_sender;
|
||||||
ui_smp_unsuccessful_receiver = _ui_smp_unsuccessful_receiver;
|
ui_smp_unsuccessful_receiver = _ui_smp_unsuccessful_receiver;
|
||||||
ui_smp_aborted = _ui_smp_aborted;
|
ui_smp_aborted = _ui_smp_aborted;
|
||||||
|
@ -64,6 +64,7 @@ void (*ui_gone_insecure)(const char * const recipient);
|
|||||||
void (*ui_trust)(const char * const recipient);
|
void (*ui_trust)(const char * const recipient);
|
||||||
void (*ui_untrust)(const char * const recipient);
|
void (*ui_untrust)(const char * const recipient);
|
||||||
void (*ui_smp_recipient_initiated)(const char * const recipient);
|
void (*ui_smp_recipient_initiated)(const char * const recipient);
|
||||||
|
void (*ui_smp_successful)(const char * const recipient);
|
||||||
void (*ui_smp_unsuccessful_sender)(const char * const recipient);
|
void (*ui_smp_unsuccessful_sender)(const char * const recipient);
|
||||||
void (*ui_smp_unsuccessful_receiver)(const char * const recipient);
|
void (*ui_smp_unsuccessful_receiver)(const char * const recipient);
|
||||||
void (*ui_smp_aborted)(const char * const recipient);
|
void (*ui_smp_aborted)(const char * const recipient);
|
||||||
|
Loading…
Reference in New Issue
Block a user