1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

ui_smp_successful takes ProfChatWin

This commit is contained in:
James Booth 2015-10-26 23:50:56 +00:00
parent 3cea2bc4f4
commit 8bd74cefcf
5 changed files with 17 additions and 12 deletions

View File

@ -177,11 +177,13 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
} else {
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
if (context->smstate->received_question == 0) {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
ui_smp_successful(context->username);
if (chatwin) {
ui_smp_successful(chatwin);
}
ui_trust(context->username);
} else {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) {
ui_smp_unsuccessful_sender(chatwin);
}
@ -202,11 +204,13 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
otrl_message_abort_smp(user_state, ops, NULL, context);
} else {
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
ProfChatWin *chatwin = wins_get_chat(context->username);
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
ui_smp_successful(context->username);
if (chatwin) {
ui_smp_successful(chatwin);
}
ui_trust(context->username);
} else {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) {
ui_smp_unsuccessful_receiver(chatwin);
}

View File

@ -196,7 +196,9 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
case OTRL_SMPEVENT_SUCCESS:
if (context->smstate->received_question == 0) {
ui_smp_successful(context->username);
if (chatwin) {
ui_smp_successful(chatwin);
}
ui_trust(context->username);
} else {
ui_smp_answer_success(context->username);

View File

@ -148,12 +148,11 @@ ui_smp_aborted(ProfChatWin *chatwin)
}
void
ui_smp_successful(const char *const barejid)
ui_smp_successful(ProfChatWin *chatwin)
{
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication successful.");
}
assert(chatwin != NULL);
win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication successful.");
}
void

View File

@ -69,7 +69,7 @@ void ui_untrust(const char *const barejid);
void ui_smp_recipient_initiated(ProfChatWin *chatwin);
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question);
void ui_smp_successful(const char *const barejid);
void ui_smp_successful(ProfChatWin *chatwin);
void ui_smp_unsuccessful_sender(ProfChatWin *chatwin);
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin);
void ui_smp_aborted(ProfChatWin *chatwin);

View File

@ -73,7 +73,7 @@ void ui_untrust(const char * const barejid) {}
void ui_smp_recipient_initiated(ProfChatWin *chatwin) {}
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {}
void ui_smp_successful(const char * const barejid) {}
void ui_smp_successful(ProfChatWin *chatwin) {}
void ui_smp_unsuccessful_sender(ProfChatWin *chatwin) {}
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {}
void ui_smp_aborted(ProfChatWin *chatwin) {}