about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-04-27 23:17:38 +0100
committerJames Booth <boothj5@gmail.com>2015-04-27 23:17:38 +0100
commiteb177ccbefe24732dc1c0a127d1720f1809e53e5 (patch)
tree517a295c87f24ae0f1f68782df898892f268fe2a /src/event
parentf219302f069e1db38ae656f1d8cca931756f388c (diff)
downloadprofani-tty-eb177ccbefe24732dc1c0a127d1720f1809e53e5.tar.gz
Removed server_events dependency on libotr headers
Diffstat (limited to 'src/event')
-rw-r--r--src/event/server_events.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index cc76ed17..514835ba 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -46,7 +46,6 @@
 
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
-#include <libotr/proto.h>
 #endif
 
 #include "ui/ui.h"
@@ -321,45 +320,7 @@ void
 srv_incoming_message(char *barejid, char *resource, char *message)
 {
 #ifdef HAVE_LIBOTR
-    gboolean was_decrypted = FALSE;
-    char *otr_message;
-
-    prof_otrpolicy_t policy = otr_get_policy(barejid);
-    char *whitespace_base = strstr(message,OTRL_MESSAGE_TAG_BASE);
-
-    //check for OTR whitespace (opportunistic or always)
-    if (policy == PROF_OTRPOLICY_OPPORTUNISTIC || policy == PROF_OTRPOLICY_ALWAYS) {
-        if (whitespace_base) {
-            if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) {
-                // Remove whitespace pattern for proper display in UI
-                // Handle both BASE+TAGV1/2(16+8) and BASE+TAGV1+TAGV2(16+8+8)
-                int tag_length	=	24;
-                if (strstr(message, OTRL_MESSAGE_TAG_V2) && strstr(message, OTRL_MESSAGE_TAG_V1)) {
-                    tag_length = 32;
-                }
-                memmove(whitespace_base, whitespace_base+tag_length, tag_length);
-                char *otr_query_message = otr_start_query();
-                cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
-                message_send_chat_encrypted(barejid, otr_query_message);
-            }
-        }
-    }
-    otr_message = otr_decrypt_message(barejid, message, &was_decrypted);
-
-    // internal OTR message
-    if (otr_message == NULL) {
-        return;
-    }
-
-    if (policy == PROF_OTRPOLICY_ALWAYS && !was_decrypted && !whitespace_base) {
-        char *otr_query_message = otr_start_query();
-        cons_show("Attempting to start OTR session...");
-        message_send_chat_encrypted(barejid, otr_query_message);
-    }
-
-    ui_incoming_msg(barejid, resource, otr_message, NULL);
-    chat_log_otr_msg_in(barejid, otr_message, was_decrypted);
-    otr_free_message(otr_message);
+    otr_on_message_recv(barejid, resource, message);
 #else
     ui_incoming_msg(barejid, resource, message, NULL);
     chat_log_msg_in(barejid, message);