about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-05-27 19:29:43 +0100
committerJames Booth <boothj5@gmail.com>2012-05-27 19:29:43 +0100
commit9ccb58468a25b5e5caf52c31abd34e058c38590d (patch)
tree07a28a608ac753f1ef4f94a8409ad95cc57454a9
parent619496f5dde61cccec8e5234ebe5ce34788e934c (diff)
downloadprofani-tty-9ccb58468a25b5e5caf52c31abd34e058c38590d.tar.gz
Added jabber_presence_t
-rw-r--r--jabber.c5
-rw-r--r--jabber.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/jabber.c b/jabber.c
index e657bc29..d361b049 100644
--- a/jabber.c
+++ b/jabber.c
@@ -40,6 +40,7 @@ static struct _jabber_conn_t {
     xmpp_ctx_t *ctx;
     xmpp_conn_t *conn;
     jabber_conn_status_t conn_status;
+    jabber_presence_t presence;
     int tls_disabled;
 } jabber_conn;
 
@@ -78,6 +79,7 @@ static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata);
 void jabber_init(const int disable_tls)
 {
     jabber_conn.conn_status = JABBER_STARTED;
+    jabber_conn.presence = PRESENCE_OFFLINE;
     jabber_conn.tls_disabled = disable_tls;
 }
 
@@ -124,6 +126,7 @@ void jabber_disconnect(void)
         xmpp_ctx_free(jabber_conn.ctx);
         xmpp_shutdown();
         jabber_conn.conn_status = JABBER_DISCONNECTED;
+        jabber_conn.presence = PRESENCE_OFFLINE;
     }
 }
 
@@ -227,6 +230,7 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn,
         prefs_add_login(jid);
 
         jabber_conn.conn_status = JABBER_CONNECTED;
+        jabber_conn.presence = PRESENCE_ONLINE;
     }
     else {
         if (jabber_conn.conn_status == JABBER_CONNECTED) {
@@ -239,6 +243,7 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn,
         log_msg(CONN, "disconnected");
         xmpp_stop(ctx);
         jabber_conn.conn_status = JABBER_DISCONNECTED;
+        jabber_conn.presence = PRESENCE_OFFLINE;
     }
 }
 
diff --git a/jabber.h b/jabber.h
index 5de93a84..51d0cada 100644
--- a/jabber.h
+++ b/jabber.h
@@ -30,6 +30,12 @@ typedef enum {
     JABBER_DISCONNECTED
 } jabber_conn_status_t;
 
+typedef enum {
+    PRESENCE_OFFLINE,
+    PRESENCE_ONLINE,
+    PRESENCE_AWAY
+} jabber_presence_t;
+
 void jabber_init(const int disable_tls);
 jabber_conn_status_t jabber_connection_status(void);
 jabber_conn_status_t jabber_connect(const char * const user,