about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-10 13:36:11 +0000
committerJames Booth <boothj5@gmail.com>2013-02-10 13:36:11 +0000
commit59e9b10d191881c2cc344616c5b788cf056da616 (patch)
treeb8191fbd28585ddb106acdd897aea0e104952cb8 /src/xmpp
parent4cb77272f34f5259b3621f1ce14b6667a75f2e13 (diff)
downloadprofani-tty-59e9b10d191881c2cc344616c5b788cf056da616.tar.gz
Removed presence from jabber_conn
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/connection.c17
-rw-r--r--src/xmpp/presence.c5
-rw-r--r--src/xmpp/xmpp.h1
3 files changed, 2 insertions, 21 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 7eb84076..5ffaa129 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -47,7 +47,6 @@ static struct _jabber_conn_t {
     xmpp_ctx_t *ctx;
     xmpp_conn_t *conn;
     jabber_conn_status_t conn_status;
-    presence_t presence_type;
     char *presence_message;
     int priority;
     int tls_disabled;
@@ -89,7 +88,6 @@ jabber_init(const int disable_tls)
 {
     log_info("Initialising XMPP");
     jabber_conn.conn_status = JABBER_STARTED;
-    jabber_conn.presence_type = PRESENCE_OFFLINE;
     jabber_conn.presence_message = NULL;
     jabber_conn.tls_disabled = disable_tls;
     presence_init();
@@ -165,7 +163,6 @@ jabber_disconnect(void)
     }
 
     jabber_conn.conn_status = JABBER_STARTED;
-    jabber_conn.presence_type = PRESENCE_OFFLINE;
     FREE_SET_NULL(jabber_conn.presence_message);
 }
 
@@ -228,12 +225,6 @@ jabber_get_jid(void)
     return xmpp_conn_get_jid(jabber_conn.conn);
 }
 
-presence_t
-jabber_get_presence_type(void)
-{
-    return jabber_conn.presence_type;
-}
-
 char *
 jabber_get_presence_message(void)
 {
@@ -247,12 +238,6 @@ jabber_get_account_name(void)
 }
 
 void
-connection_set_presence_type(const presence_t presence_type)
-{
-    jabber_conn.presence_type = presence_type;
-}
-
-void
 connection_set_presence_message(const char * const message)
 {
     FREE_SET_NULL(jabber_conn.presence_message);
@@ -424,7 +409,6 @@ _connection_handler(xmpp_conn_t * const conn,
 
         iq_roster_request();
         jabber_conn.conn_status = JABBER_CONNECTED;
-        jabber_conn.presence_type = PRESENCE_ONLINE;
 
         if (prefs_get_reconnect() != 0) {
             if (reconnect_timer != NULL) {
@@ -461,7 +445,6 @@ _connection_handler(xmpp_conn_t * const conn,
 
         // close stream response from server after disconnect is handled too
         jabber_conn.conn_status = JABBER_DISCONNECTED;
-        jabber_conn.presence_type = PRESENCE_OFFLINE;
     }
 }
 
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index bc2bc056..ffc1cddf 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -119,7 +119,6 @@ presence_update(presence_t presence_type, const char * const msg,
     if (jabber_get_connection_status() != JABBER_CONNECTED)
         return;
 
-    connection_set_presence_type(presence_type);
     connection_set_presence_message(msg);
     connection_set_priority(pri);
 
@@ -161,7 +160,7 @@ presence_join_room(Jid *jid)
 {
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_conn_t *conn = connection_get_conn();
-    presence_t presence_type = jabber_get_presence_type();
+    presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
     const char *show = stanza_get_presence_string_from_type(presence_type);
     char *status = jabber_get_presence_message();
     int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
@@ -184,7 +183,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
 {
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_conn_t *conn = connection_get_conn();
-    presence_t presence_type = jabber_get_presence_type();
+    presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
     const char *show = stanza_get_presence_string_from_type(presence_type);
     char *status = jabber_get_presence_message();
     int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 5bb3bc4a..4e857ad2 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -66,7 +66,6 @@ void jabber_disconnect(void);
 void jabber_process_events(void);
 const char * jabber_get_jid(void);
 jabber_conn_status_t jabber_get_connection_status(void);
-presence_t jabber_get_presence_type(void);
 char * jabber_get_presence_message(void);
 void jabber_set_autoping(int seconds);
 char* jabber_get_account_name(void);