about summary refs log tree commit diff stats
path: root/src/otr
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-27 00:52:34 +0000
committerJames Booth <boothj5@gmail.com>2014-12-27 00:52:34 +0000
commite602c2909e250e8f1dd9e6420585232113fb9ded (patch)
tree47b705ae3c1c17f7d51a2b6ce9a0a92180d6bd1e /src/otr
parent676ed1cbae17f7fff6435db58f20b7dfd8a28552 (diff)
downloadprofani-tty-e602c2909e250e8f1dd9e6420585232113fb9ded.tar.gz
Moved chat states out of xmpp module for message send chat
Diffstat (limited to 'src/otr')
-rw-r--r--src/otr/otr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c
index b6625d1b..3c0fe990 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -45,6 +45,7 @@
 #include "contact.h"
 #include "ui/ui.h"
 #include "config/preferences.h"
+#include "chat_session.h"
 
 #define PRESENCE_ONLINE 1
 #define PRESENCE_OFFLINE 0
@@ -109,7 +110,17 @@ static void
 cb_inject_message(void *opdata, const char *accountname,
     const char *protocol, const char *recipient, const char *message)
 {
-    message_send_chat(recipient, message);
+    gboolean send_state = FALSE;
+    if (prefs_get_boolean(PREF_STATES)) {
+        if (!chat_session_exists(recipient)) {
+            chat_session_start(recipient, TRUE);
+        }
+        if (chat_session_get_recipient_supports(recipient)) {
+            chat_session_set_active(recipient);
+            send_state = TRUE;
+        }
+    }
+    message_send_chat(recipient, NULL, message, send_state);
 }
 
 static void