diff options
-rw-r--r-- | src/command/commands.c | 6 | ||||
-rw-r--r-- | src/event/client_events.c | 2 | ||||
-rw-r--r-- | src/event/server_events.c | 4 | ||||
-rw-r--r-- | src/log.c | 12 | ||||
-rw-r--r-- | src/plugins/plugins.c | 2 | ||||
-rw-r--r-- | src/ui/chatwin.c | 2 | ||||
-rw-r--r-- | src/ui/core.c | 2 | ||||
-rw-r--r-- | src/xmpp/bookmark.c | 2 | ||||
-rw-r--r-- | src/xmpp/connection.c | 6 | ||||
-rw-r--r-- | src/xmpp/message.c | 2 | ||||
-rw-r--r-- | src/xmpp/presence.c | 2 | ||||
-rw-r--r-- | src/xmpp/roster.c | 2 | ||||
-rw-r--r-- | src/xmpp/session.c | 12 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 2 | ||||
-rw-r--r-- | tests/unittests/test_cmd_disconnect.c | 2 | ||||
-rw-r--r-- | tests/unittests/xmpp/stub_xmpp.c | 2 |
16 files changed, 31 insertions, 31 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 3e8fa0f2..cf89b39a 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -3419,7 +3419,7 @@ cmd_software(ProfWin *window, const char *const command, gchar **args) break; case WIN_CONSOLE: if (args[0]) { - Jid *myJid = jid_create(session_get_fulljid()); + Jid *myJid = jid_create(connection_get_fulljid()); Jid *jid = jid_create(args[0]); if (jid == NULL || jid->fulljid == NULL) { @@ -4481,7 +4481,7 @@ cmd_disco(ProfWin *window, const char *const command, gchar **args) if (args[1]) { jid = g_string_append(jid, args[1]); } else { - Jid *jidp = jid_create(session_get_fulljid()); + Jid *jidp = jid_create(connection_get_fulljid()); jid = g_string_append(jid, jidp->domainpart); jid_destroy(jidp); } @@ -4564,7 +4564,7 @@ cmd_lastactivity(ProfWin *window, const char *const command, gchar **args) } if (args[0] == NULL) { - Jid *jidp = jid_create(session_get_fulljid()); + Jid *jidp = jid_create(connection_get_fulljid()); GString *jid = g_string_new(jidp->domainpart); iq_last_activity_request(jid->str); diff --git a/src/event/client_events.c b/src/event/client_events.c index a156fd62..a1a7408a 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -71,7 +71,7 @@ cl_ev_connect_account(ProfAccount *account) void cl_ev_disconnect(void) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); cons_show("%s logged out successfully.", jid); ui_disconnected(); diff --git a/src/event/server_events.c b/src/event/server_events.c index 5093f54a..76084d48 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -148,7 +148,7 @@ sv_ev_roster_received(void) cl_ev_presence_send(conn_presence, NULL, 0); } - const char *fulljid = session_get_fulljid(); + const char *fulljid = connection_get_fulljid(); plugins_on_connect(account_name, fulljid); } @@ -238,7 +238,7 @@ void sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message) { if (prefs_get_boolean(PREF_GRLOG)) { - Jid *jid = jid_create(session_get_fulljid()); + Jid *jid = jid_create(connection_get_fulljid()); groupchat_log_chat(jid->barejid, room_jid, nick, message); jid_destroy(jid); } diff --git a/src/log.c b/src/log.c index a7fbcbee..56aeec2b 100644 --- a/src/log.c +++ b/src/log.c @@ -265,7 +265,7 @@ void chat_log_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); _chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL); jid_destroy(jidp); @@ -276,7 +276,7 @@ void chat_log_otr_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); char *pref_otr_log = prefs_get_string(PREF_OTR_LOG); if (strcmp(pref_otr_log, "on") == 0) { @@ -293,7 +293,7 @@ void chat_log_pgp_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG); if (strcmp(pref_pgp_log, "on") == 0) { @@ -310,7 +310,7 @@ void chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); char *pref_otr_log = prefs_get_string(PREF_OTR_LOG); if (!was_decrypted || (strcmp(pref_otr_log, "on") == 0)) { @@ -327,7 +327,7 @@ void chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG); if (strcmp(pref_pgp_log, "on") == 0) { @@ -344,7 +344,7 @@ void chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { - const char *jid = session_get_fulljid(); + const char *jid = connection_get_fulljid(); Jid *jidp = jid_create(jid); _chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, timestamp); jid_destroy(jidp); diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 41d5a8fc..5757a174 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -159,7 +159,7 @@ plugins_load(const char *const name) plugins = g_slist_append(plugins, plugin); if (connection_get_status() == JABBER_CONNECTED) { const char *account_name = session_get_account_name(); - const char *fulljid = session_get_fulljid(); + const char *fulljid = connection_get_fulljid(); plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, account_name, fulljid); } else { plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, NULL, NULL); diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index cf7fb663..d4336c09 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -388,7 +388,7 @@ static void _chatwin_history(ProfChatWin *chatwin, const char *const contact) { if (!chatwin->history_shown) { - Jid *jid = jid_create(session_get_fulljid()); + Jid *jid = jid_create(connection_get_fulljid()); GSList *history = chat_log_get_previous(jid->barejid, contact); jid_destroy(jid); GSList *curr = history; diff --git a/src/ui/core.c b/src/ui/core.c index df8d252f..aa7fdc09 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1107,7 +1107,7 @@ _ui_draw_term_title(void) jabber_conn_status_t status = connection_get_status(); if (status == JABBER_CONNECTED) { - const char * const jid = session_get_fulljid(); + const char * const jid = connection_get_fulljid(); gint unread = wins_get_total_unread(); if (unread != 0) { 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); diff --git a/tests/unittests/test_cmd_disconnect.c b/tests/unittests/test_cmd_disconnect.c index d9690d9e..ba73adf5 100644 --- a/tests/unittests/test_cmd_disconnect.c +++ b/tests/unittests/test_cmd_disconnect.c @@ -22,7 +22,7 @@ void clears_chat_sessions(void **state) chat_session_recipient_active("mike@server.org", "work", FALSE); will_return(connection_get_status, JABBER_CONNECTED); - will_return(session_get_fulljid, "myjid@myserver.com"); + will_return(connection_get_fulljid, "myjid@myserver.com"); expect_any_cons_show(); gboolean result = cmd_disconnect(NULL, CMD_DISCONNECT, NULL); diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index 87fbeb70..8e33ff79 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -27,7 +27,7 @@ jabber_conn_status_t session_connect_with_account(const ProfAccount * const acco void session_disconnect(void) {} void session_shutdown(void) {} void session_process_events(int millis) {} -const char * session_get_fulljid(void) +const char * connection_get_fulljid(void) { return (char *)mock(); } |