about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorlightb <lightb@bigfoot>2014-04-22 18:53:48 -0400
committerlightb <lightb@bigfoot>2014-04-22 18:53:48 -0400
commite08ee67f5f5e1edbd533b61c6460bda6f40ec8dd (patch)
treec9ba28cc8128fbeffef36f0a0bb880a2bb5c626e
parent5a5ad31edf137e62ee5678f9845c155811d9e2e1 (diff)
downloadprofani-tty-e08ee67f5f5e1edbd533b61c6460bda6f40ec8dd.tar.gz
Bugfix: Because whitespace was removed, last check OTR always, didn't work, now it works.
-rw-r--r--src/server_events.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/server_events.c b/src/server_events.c
index 7797b4f4..39aebedf 100644
--- a/src/server_events.c
+++ b/src/server_events.c
@@ -209,11 +209,13 @@ handle_incoming_message(char *from, char *message, gboolean priv)
     gboolean was_decrypted = FALSE;
     char *newmessage;
 
+    char *policy = prefs_get_string(PREF_OTR_POLICY);
+    char *whitespace_base = strstr(message,OTRL_MESSAGE_TAG_BASE);
+
+
    if (!priv) {
 //check for OTR whitespace (opportunistic or always)
-    char *policy = prefs_get_string(PREF_OTR_POLICY);
     if (strcmp(policy, "opportunistic") == 0 || strcmp(policy, "always") == 0) {
-	char *whitespace_base	=	strstr(message,OTRL_MESSAGE_TAG_BASE);
 	if (whitespace_base) {
 		if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) {
 			// Remove whitespace pattern for proper display in UI
@@ -236,11 +238,10 @@ handle_incoming_message(char *from, char *message, gboolean priv)
     } else {
         newmessage = message;
     }
-    char *policy = prefs_get_string(PREF_OTR_POLICY);
-    if (strcmp(policy, "always") == 0 && !was_decrypted)
+    if (strcmp(policy, "always") == 0 && !was_decrypted && !whitespace_base)
                 {
                         char *otr_query_message = otr_start_query();
-                        cons_show("Attempting to start OTR session..");
+                        cons_show("Attempting to start OTR session...");
                         message_send(otr_query_message, from);
                 }