about summary refs log tree commit diff stats
path: root/src/otr
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-18 23:29:22 +0100
committerJames Booth <boothj5@gmail.com>2014-04-18 23:29:22 +0100
commitfadad0aeba3258677d1eefa303be5a54fafdda03 (patch)
tree9ccb14261201cf42f17861f4300eb3c557735b1e /src/otr
parent2451b7b1ca805c863dfb58b9925f21cb2d51ab58 (diff)
downloadprofani-tty-fadad0aeba3258677d1eefa303be5a54fafdda03.tar.gz
OTR end messages are now send to recipients not in the roster.
fixes #333
Diffstat (limited to 'src/otr')
-rw-r--r--src/otr/otr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c
index af43854c..2cb86695 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -32,6 +32,10 @@
 #include "contact.h"
 #include "ui/ui.h"
 
+#define PRESENCE_ONLINE 1
+#define PRESENCE_OFFLINE 0
+#define PRESENCE_UNKNOWN -1
+
 static OtrlUserState user_state;
 static OtrlMessageAppOps ops;
 static char *jid;
@@ -49,10 +53,14 @@ cb_is_logged_in(void *opdata, const char *accountname,
     const char *protocol, const char *recipient)
 {
     PContact contact = roster_get_contact(recipient);
+    if (contact == NULL) {
+        return PRESENCE_ONLINE;
+    }
+
     if (g_strcmp0(p_contact_presence(contact), "offline") == 0) {
-        return 0;
+        return PRESENCE_OFFLINE;
     } else {
-        return 1;
+        return PRESENCE_ONLINE;
     }
 }