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 { } else {
context->smstate->nextExpected = OTRL_SMP_EXPECT1; context->smstate->nextExpected = OTRL_SMP_EXPECT1;
if (context->smstate->received_question == 0) { if (context->smstate->received_question == 0) {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { 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); ui_trust(context->username);
} else { } else {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) { if (chatwin) {
ui_smp_unsuccessful_sender(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); otrl_message_abort_smp(user_state, ops, NULL, context);
} else { } else {
context->smstate->nextExpected = OTRL_SMP_EXPECT1; context->smstate->nextExpected = OTRL_SMP_EXPECT1;
ProfChatWin *chatwin = wins_get_chat(context->username);
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { 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); ui_trust(context->username);
} else { } else {
ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) { if (chatwin) {
ui_smp_unsuccessful_receiver(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: case OTRL_SMPEVENT_SUCCESS:
if (context->smstate->received_question == 0) { if (context->smstate->received_question == 0) {
ui_smp_successful(context->username); if (chatwin) {
ui_smp_successful(chatwin);
}
ui_trust(context->username); ui_trust(context->username);
} else { } else {
ui_smp_answer_success(context->username); ui_smp_answer_success(context->username);

View File

@ -148,12 +148,11 @@ ui_smp_aborted(ProfChatWin *chatwin)
} }
void void
ui_smp_successful(const char *const barejid) ui_smp_successful(ProfChatWin *chatwin)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); assert(chatwin != NULL);
if (chatwin) {
win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication successful."); win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication successful.");
}
} }
void 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(ProfChatWin *chatwin);
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question); 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_sender(ProfChatWin *chatwin);
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin); void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin);
void ui_smp_aborted(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(ProfChatWin *chatwin) {}
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {} 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_sender(ProfChatWin *chatwin) {}
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {} void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {}
void ui_smp_aborted(ProfChatWin *chatwin) {} void ui_smp_aborted(ProfChatWin *chatwin) {}