about summary refs log tree commit diff stats
path: root/src/otr/otrlibv4.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-10-27 00:19:22 +0000
committerJames Booth <boothj5@gmail.com>2015-10-27 00:19:22 +0000
commit124aaa9809ee13b382f47f6f3e175bd7fdb98dc5 (patch)
tree8346aecaa20402dc9ac3c84b5fee8573d5341741 /src/otr/otrlibv4.c
parent8bd74cefcf73772a52b40c919a1e70da90be8a33 (diff)
downloadprofani-tty-124aaa9809ee13b382f47f6f3e175bd7fdb98dc5.tar.gz
remaining otr functions take ProfChatWin
Diffstat (limited to 'src/otr/otrlibv4.c')
-rw-r--r--src/otr/otrlibv4.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c
index 29d6d57a..a82a98a8 100644
--- a/src/otr/otrlibv4.c
+++ b/src/otr/otrlibv4.c
@@ -195,30 +195,28 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
             break;
 
         case OTRL_SMPEVENT_SUCCESS:
-            if (context->smstate->received_question == 0) {
-                if (chatwin) {
+            if (chatwin) {
+                if (context->smstate->received_question == 0) {
                     ui_smp_successful(chatwin);
+                    ui_trust(chatwin);
+                } else {
+                    ui_smp_answer_success(chatwin);
                 }
-                ui_trust(context->username);
-            } else {
-                ui_smp_answer_success(context->username);
             }
             break;
 
         case OTRL_SMPEVENT_FAILURE:
-            if (context->smstate->received_question == 0) {
-                if (nextMsg == OTRL_SMP_EXPECT3) {
-                    if (chatwin) {
+            if (chatwin) {
+                if (context->smstate->received_question == 0) {
+                    if (nextMsg == OTRL_SMP_EXPECT3) {
                         ui_smp_unsuccessful_sender(chatwin);
-                    }
-                } else if (nextMsg == OTRL_SMP_EXPECT4) {
-                    if (chatwin) {
+                    } else if (nextMsg == OTRL_SMP_EXPECT4) {
                         ui_smp_unsuccessful_receiver(chatwin);
                     }
+                    ui_untrust(chatwin);
+                } else {
+                    ui_smp_answer_failure(chatwin);
                 }
-                ui_untrust(context->username);
-            } else {
-                ui_smp_answer_failure(context->username);
             }
             break;
 
@@ -233,8 +231,8 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
         case OTRL_SMPEVENT_ABORT:
             if (chatwin) {
                 ui_smp_aborted(chatwin);
+                ui_untrust(chatwin);
             }
-            ui_untrust(context->username);
             break;
 
         case OTRL_SMPEVENT_IN_PROGRESS: