about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-30 22:01:37 +0100
committerJames Booth <boothj5@gmail.com>2014-04-30 22:01:37 +0100
commit8994b3769c4b1af94b557e443339f845f8b9a9fd (patch)
tree104fdf553764c1ddd56851ba6ccd90845306c773
parent1155ceabbc4424db8de19b8f540e514a90696bab (diff)
downloadprofani-tty-8994b3769c4b1af94b557e443339f845f8b9a9fd.tar.gz
Removed debug
-rwxr-xr-xinstall-all.sh6
-rw-r--r--src/otr/otr.c4
-rw-r--r--src/otr/otrlibv4.c66
3 files changed, 12 insertions, 64 deletions
diff --git a/install-all.sh b/install-all.sh
index 940703fa..64eb89dd 100755
--- a/install-all.sh
+++ b/install-all.sh
@@ -24,7 +24,7 @@ debian_prepare()
     echo
     echo Profanity installer... installing dependencies
     echo
-    sudo apt-get -y install git automake autoconf libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev
+    sudo apt-get -y install git automake autoconf libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev
 
 }
 
@@ -73,7 +73,9 @@ install_lib_strophe()
     echo
     echo Profanity installer... installing libstrophe
     echo
-    git clone git://github.com/strophe/libstrophe.git
+    #clone fork so as to not pick up any breaking changes
+    #git clone git://github.com/strophe/libstrophe.git
+    git clone git://github.com/boothj5/libstrophe.git
     cd libstrophe
     ./bootstrap.sh
     ./configure
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 72dded2a..7fe3757f 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -154,9 +154,7 @@ _otr_init(void)
     ops.gone_secure = cb_gone_secure;
 
     otrlib_init_ops(&ops);
-
     otrlib_init_timer();
-
     smp_initiators = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
     data_loaded = FALSE;
@@ -491,7 +489,7 @@ _otr_encrypt_message(const char * const to, const char * const message)
     char *newmessage = NULL;
     gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage);
 
-    if (!err == GPG_ERR_NO_ERROR) {
+    if (err != 0) {
         return NULL;
     } else {
         return newmessage;
diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c
index bd007dbd..d9e7ce01 100644
--- a/src/otr/otrlibv4.c
+++ b/src/otr/otrlibv4.c
@@ -25,6 +25,7 @@
 #include <libotr/message.h>
 
 #include "ui/ui.h"
+#include "log.h"
 #include "otr/otr.h"
 #include "otr/otrlib.h"
 
@@ -100,59 +101,12 @@ cb_handle_msg_event(void *opdata, OtrlMessageEvent msg_event,
     ConnContext *context, const char *message,
     gcry_error_t err)
 {
-    switch(msg_event)
-    {
-        case OTRL_MSGEVENT_ENCRYPTION_REQUIRED:
-            cons_show_error("Our policy requires encryption but we are trying to send an unencrypted message out.");
-            break;
-        case OTRL_MSGEVENT_ENCRYPTION_ERROR:
-            cons_show_error("An error occured while encrypting a message and the message was not sent.");
-            break;
-        case OTRL_MSGEVENT_CONNECTION_ENDED:
-            cons_show_error("Message has not been sent because our buddy has ended the private conversation. We should either close the connection, or refresh it.");
-            break;
-        case OTRL_MSGEVENT_SETUP_ERROR:
-            cons_show_error("A private conversation could not be set up. A gcry_error_t will be passed.");
-            break;
-        case OTRL_MSGEVENT_MSG_REFLECTED:
-            cons_show_error("Received our own OTR messages.");
-            break;
-        case OTRL_MSGEVENT_MSG_RESENT:
-            cons_show_error("The previous message was resent.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE:
-            cons_show_error("Received an encrypted message but cannot read it because no private connection is established yet.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_UNREADABLE:
-            cons_show_error("Cannot read the received message.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_MALFORMED:
-            cons_show_error("The message received contains malformed data.");
-            break;
-        case OTRL_MSGEVENT_LOG_HEARTBEAT_RCVD:
-            cons_show_error("Received a heartbeat.");
-            break;
-        case OTRL_MSGEVENT_LOG_HEARTBEAT_SENT:
-            cons_show_error("Sent a heartbeat.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:
-            cons_show_error("Received a general OTR error. The argument 'message' will also be passed and it will contain the OTR error message.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:
-            cons_show_error("Received an unencrypted message. The argument 'smessage' will also be passed and it will contain the plaintext message.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED:
-            cons_show_error("Cannot recognize the type of OTR message received.");
-            break;
-        case OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE:
-            cons_show_error("Received and discarded a message intended for another instance.");
-            break;
-        default:
-            break;
-    }
-
-    if (message != NULL) {
-        cons_show_error("Message: %s", message);
+    if (err != 0) {
+        if (message != NULL) {
+            cons_show_error("%s", message);
+        } else {
+            cons_show_error("OTR error event with no message.");
+        }
     }
 }
 
@@ -162,7 +116,6 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
     char *question)
 {
     NextExpectedSMP nextMsg = context->smstate->nextExpected;
-    context->smstate->sm_prog_state = OTRL_SMP_PROG_OK;
     OtrlUserState user_state = otr_userstate();
     OtrlMessageAppOps *ops = otr_messageops();
     GHashTable *smp_initiators = otr_smpinitators();
@@ -177,18 +130,15 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
         case OTRL_SMPEVENT_SUCCESS:
             ui_smp_successful(context->username);
             ui_trust(context->username);
-//            otr_trust(context->username);
             break;
             
         case OTRL_SMPEVENT_FAILURE:
             if (nextMsg == OTRL_SMP_EXPECT3) {
                 ui_smp_unsuccessful_sender(context->username);
                 ui_untrust(context->username);
-//                otr_untrust(context->username);
             } else if (nextMsg == OTRL_SMP_EXPECT4) {
                 ui_smp_unsuccessful_receiver(context->username);
                 ui_untrust(context->username);
-//                otr_untrust(context->username);
             }
             break;
 
@@ -203,14 +153,12 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
         case OTRL_SMPEVENT_ABORT:
             ui_smp_aborted(context->username);
             ui_untrust(context->username);
-//            otr_untrust(context->username);
             break;
 
         case OTRL_SMPEVENT_ASK_FOR_ANSWER:
             break;
 
         case OTRL_SMPEVENT_IN_PROGRESS:
-            ui_current_print_line("OTRL_SMPEVENT_IN_PROGRESS: %d", progress_percent);
             break;
 
         default: