about summary refs log tree commit diff stats
path: root/src/otr4.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-02-11 21:21:33 +0000
committerJames Booth <boothj5@gmail.com>2014-02-11 21:21:33 +0000
commite07209ec4952b79ae4b0f7db4f273bc75bc93669 (patch)
tree385cb576587b90e41c4e169c167bce43c97c2346 /src/otr4.c
parent5b260af999a61b1ce9929543dc03fe9c0295fad7 (diff)
downloadprofani-tty-e07209ec4952b79ae4b0f7db4f273bc75bc93669.tar.gz
Allow V3, use OTRL_INSTAG_BEST, output error event when no message
Diffstat (limited to 'src/otr4.c')
-rw-r--r--src/otr4.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/otr4.c b/src/otr4.c
index 6114d3db..80a0cdcb 100644
--- a/src/otr4.c
+++ b/src/otr4.c
@@ -40,7 +40,7 @@ static gboolean data_loaded;
 static OtrlPolicy
 cb_policy(void *opdata, ConnContext *context)
 {
-    return OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2 ;
+    return OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2 | OTRL_POLICY_ALLOW_V3;
 }
 
 static int
@@ -92,7 +92,11 @@ cb_handle_msg_event(void *opdata, OtrlMessageEvent msg_event,
     ConnContext *context, const char *message,
     gcry_error_t err)
 {
-    cons_show_error("%s", message);
+    if (message != NULL) {
+        cons_show_error("%s", message);
+    } else {
+        cons_show_error("OTR error event with no message.");
+    }
 }
 
 static void
@@ -317,7 +321,7 @@ gboolean
 otr_is_secure(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context == NULL) {
         return FALSE;
@@ -334,7 +338,7 @@ gboolean
 otr_is_trusted(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context == NULL) {
         return FALSE;
@@ -356,7 +360,7 @@ void
 otr_trust(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context == NULL) {
         return;
@@ -378,7 +382,7 @@ void
 otr_untrust(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context == NULL) {
         return;
@@ -400,7 +404,7 @@ void
 otr_end_session(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context != NULL) {
         otrl_message_disconnect(user_state, &ops, NULL, jid, "xmpp", recipient, 0);
@@ -421,7 +425,7 @@ char *
 otr_get_their_fingerprint(const char * const recipient)
 {
     ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
-        0, 0, NULL, NULL, NULL);
+        OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
     if (context != NULL) {
         Fingerprint *fingerprint = context->active_fingerprint;
@@ -446,7 +450,7 @@ otr_encrypt_message(const char * const to, const char * const message)
         jid,
         "xmpp",
         to,
-        0,
+        OTRL_INSTAG_BEST,
         message,
         0,
         &newmessage,
@@ -487,7 +491,7 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
         tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
         if (tlv) {
             ConnContext *context = otrl_context_find(user_state, from, jid, "xmpp",
-                0, 0, NULL, NULL, NULL);
+                OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
 
             if (context != NULL) {
                 otrl_context_force_plaintext(context);