diff options
-rw-r--r-- | src/otr/otrlibv3.c | 5 | ||||
-rw-r--r-- | src/otr/otrlibv4.c | 4 | ||||
-rw-r--r-- | src/ui/chatwin.c | 10 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/src/otr/otrlibv3.c b/src/otr/otrlibv3.c index de388b8f..3fb85e0e 100644 --- a/src/otr/otrlibv3.c +++ b/src/otr/otrlibv3.c @@ -206,7 +206,10 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext ui_smp_successful(context->username); ui_trust(context->username); } else { - ui_smp_unsuccessful_receiver(context->username); + ProfChatWin *chatwin = wins_get_chat(context->username); + if (chatwin) { + ui_smp_unsuccessful_receiver(chatwin); + } ui_untrust(context->username); } } diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c index ebdc2996..acce648e 100644 --- a/src/otr/otrlibv4.c +++ b/src/otr/otrlibv4.c @@ -210,7 +210,9 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event, ui_smp_unsuccessful_sender(chatwin); } } else if (nextMsg == OTRL_SMP_EXPECT4) { - ui_smp_unsuccessful_receiver(context->username); + if (chatwin) { + ui_smp_unsuccessful_receiver(chatwin); + } } ui_untrust(context->username); } else { diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index e782c0bc..35e50af1 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -131,12 +131,12 @@ ui_smp_unsuccessful_sender(ProfChatWin *chatwin) } void -ui_smp_unsuccessful_receiver(const char *const barejid) +ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) { - ProfChatWin *chatwin = wins_get_chat(barejid); - if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication failed, the secret entered by %s does not match yours.", barejid); - } + assert(chatwin != NULL); + + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", + "Authentication failed, the secret entered by %s does not match yours.", chatwin->barejid); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index c1efb9ea..140d3426 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -71,7 +71,7 @@ void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question); void ui_smp_successful(const char *const barejid); void ui_smp_unsuccessful_sender(ProfChatWin *chatwin); -void ui_smp_unsuccessful_receiver(const char *const barejid); +void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin); void ui_smp_aborted(const char *const barejid); void ui_smp_answer_success(const char *const barejid); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 93dd1ca5..719b51e9 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -75,7 +75,7 @@ void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {} void ui_smp_successful(const char * const barejid) {} void ui_smp_unsuccessful_sender(ProfChatWin *chatwin) {} -void ui_smp_unsuccessful_receiver(const char * const barejid) {} +void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {} void ui_smp_aborted(const char * const barejid) {} void ui_smp_answer_success(const char * const barejid) {} |