about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-06 01:12:54 +0100
committerJames Booth <boothj5@gmail.com>2016-05-06 01:12:54 +0100
commitd1c71e98f4f6b5271e97bc2a5274c92491bfdbd3 (patch)
treeb1427ee5d49a1a1246a124fa2de9a9fd5aef841f /src/xmpp
parentcc485ed338c854489f08e95dafdb8503093e5150 (diff)
downloadprofani-tty-d1c71e98f4f6b5271e97bc2a5274c92491bfdbd3.tar.gz
Move connection fulljid function
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/bookmark.c2
-rw-r--r--src/xmpp/connection.c6
-rw-r--r--src/xmpp/message.c2
-rw-r--r--src/xmpp/presence.c2
-rw-r--r--src/xmpp/roster.c2
-rw-r--r--src/xmpp/session.c12
-rw-r--r--src/xmpp/xmpp.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c
index 47f59299..0f88a129 100644
--- a/src/xmpp/bookmark.c
+++ b/src/xmpp/bookmark.c
@@ -276,7 +276,7 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
     if (bookmark_ac == NULL) {
         bookmark_ac = autocomplete_new();
     }
-    my_jid = jid_create(session_get_fulljid());
+    my_jid = jid_create(connection_get_fulljid());
 
     ptr = xmpp_stanza_get_children(ptr);
     while (ptr) {
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 9c2f371e..313d056c 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -170,6 +170,12 @@ connection_get_ctx(void)
     return conn.ctx;
 }
 
+const char*
+connection_get_fulljid(void)
+{
+    return xmpp_conn_get_jid(conn.conn);
+}
+
 char *
 connection_get_domain(void)
 {
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index f75520e1..4d49ba98 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -740,7 +740,7 @@ _handle_carbons(xmpp_stanza_t *const stanza)
 
         Jid *jid_from = jid_create(from);
         Jid *jid_to = jid_create(to);
-        Jid *my_jid = jid_create(session_get_fulljid());
+        Jid *my_jid = jid_create(connection_get_fulljid());
 
         // check for and deal with message
         xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(message, STANZA_NAME_BODY);
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 377b1b9a..ad6699ac 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -721,7 +721,7 @@ _muc_user_handler(xmpp_stanza_t *const stanza)
     }
 
     // handle self presence
-    if (stanza_is_muc_self_presence(stanza, session_get_fulljid())) {
+    if (stanza_is_muc_self_presence(stanza, connection_get_fulljid())) {
         log_debug("Room self presence received from %s", from_jid->fulljid);
 
         // self unavailable
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 28812596..95d4223e 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -218,7 +218,7 @@ roster_set_handler(xmpp_stanza_t *const stanza)
     }
 
     // if from attribute exists and it is not current users barejid, ignore push
-    Jid *my_jid = jid_create(session_get_fulljid());
+    Jid *my_jid = jid_create(connection_get_fulljid());
     const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
     if (from && (strcmp(from, my_jid->barejid) != 0)) {
         jid_destroy(my_jid);
diff --git a/src/xmpp/session.c b/src/xmpp/session.c
index 1e52cee2..809e77ee 100644
--- a/src/xmpp/session.c
+++ b/src/xmpp/session.c
@@ -189,7 +189,7 @@ session_autoping_fail(void)
     if (connection_get_status() == JABBER_CONNECTED) {
         log_info("Closing connection");
         char *account_name = session_get_account_name();
-        const char *fulljid = session_get_fulljid();
+        const char *fulljid = connection_get_fulljid();
         plugins_on_disconnect(account_name, fulljid);
         accounts_set_last_activity(session_get_account_name());
         connection_set_status(JABBER_DISCONNECTING);
@@ -217,7 +217,7 @@ session_disconnect(void)
     // if connected, send end stream and wait for response
     if (connection_get_status() == JABBER_CONNECTED) {
         char *account_name = session_get_account_name();
-        const char *fulljid = session_get_fulljid();
+        const char *fulljid = connection_get_fulljid();
         plugins_on_disconnect(account_name, fulljid);
         log_info("Closing connection");
         accounts_set_last_activity(session_get_account_name());
@@ -311,12 +311,6 @@ session_set_disco_items(GSList *_disco_items)
     disco_items = _disco_items;
 }
 
-const char*
-session_get_fulljid(void)
-{
-    return xmpp_conn_get_jid(connection_get_conn());
-}
-
 char*
 session_get_account_name(void)
 {
@@ -370,7 +364,7 @@ session_login_success(int secured)
         _session_free_saved_details();
     }
 
-    Jid *my_jid = jid_create(session_get_fulljid());
+    Jid *my_jid = jid_create(connection_get_fulljid());
     connection_set_domain(my_jid->domainpart);
     jid_destroy(my_jid);
 
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index bc7d5c7e..9651f7d9 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -117,7 +117,6 @@ jabber_conn_status_t session_connect_with_account(const ProfAccount *const accou
 void session_disconnect(void);
 void session_shutdown(void);
 void session_process_events(int millis);
-const char* session_get_fulljid(void);
 char* session_get_account_name(void);
 GList* session_get_available_resources(void);
 char* session_create_uuid(void);
@@ -133,6 +132,7 @@ gboolean session_service_supports(const char *const feature);
 
 jabber_conn_status_t connection_get_status(void);
 char *connection_get_presence_msg(void);
+const char* connection_get_fulljid(void);
 
 char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url);
 char* message_send_chat_otr(const char *const barejid, const char *const msg);