about summary refs log tree commit diff stats
path: root/src/otr/otrlibv4.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-05-07 21:15:28 +0100
committerJames Booth <boothj5@gmail.com>2014-05-07 21:15:28 +0100
commitc6ba84096dacde5b9639e3c984507c01cc278380 (patch)
tree8a30e1fe7404d73b39eb7c4d709d307e48246fb6 /src/otr/otrlibv4.c
parent1e4fc2ce793a418317b8adc929fc4a349d79fb15 (diff)
downloadprofani-tty-c6ba84096dacde5b9639e3c984507c01cc278380.tar.gz
Added question answer messages for libotr 4.0.0
Diffstat (limited to 'src/otr/otrlibv4.c')
-rw-r--r--src/otr/otrlibv4.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c
index d9e7ce01..0bcd779c 100644
--- a/src/otr/otrlibv4.c
+++ b/src/otr/otrlibv4.c
@@ -127,18 +127,29 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
             g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username));
             break;
 
+        case OTRL_SMPEVENT_ASK_FOR_ANSWER:
+            ui_smp_recipient_initiated_q(context->username, question);
+            break;
+
         case OTRL_SMPEVENT_SUCCESS:
-            ui_smp_successful(context->username);
-            ui_trust(context->username);
+            if (context->smstate->received_question == 0) {
+                ui_smp_successful(context->username);
+                ui_trust(context->username);
+            } else {
+                ui_smp_answer_success(context->username);
+            }
             break;
             
         case OTRL_SMPEVENT_FAILURE:
-            if (nextMsg == OTRL_SMP_EXPECT3) {
-                ui_smp_unsuccessful_sender(context->username);
-                ui_untrust(context->username);
-            } else if (nextMsg == OTRL_SMP_EXPECT4) {
-                ui_smp_unsuccessful_receiver(context->username);
+            if (context->smstate->received_question == 0) {
+                if (nextMsg == OTRL_SMP_EXPECT3) {
+                    ui_smp_unsuccessful_sender(context->username);
+                } else if (nextMsg == OTRL_SMP_EXPECT4) {
+                    ui_smp_unsuccessful_receiver(context->username);
+                }
                 ui_untrust(context->username);
+            } else {
+                ui_smp_answer_failure(context->username);
             }
             break;
 
@@ -155,9 +166,6 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
             ui_untrust(context->username);
             break;
 
-        case OTRL_SMPEVENT_ASK_FOR_ANSWER:
-            break;
-
         case OTRL_SMPEVENT_IN_PROGRESS:
             break;