From 81e95966cfd4313606d9b45ec1565f1e1a63a497 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 6 May 2016 02:18:31 +0100 Subject: [PATCH] Remove redundant tls secured function --- src/command/commands.c | 4 ++-- src/event/server_events.c | 2 +- src/event/server_events.h | 2 +- src/ui/console.c | 2 +- src/ui/core.c | 4 ++-- src/ui/ui.h | 4 ++-- src/xmpp/connection.c | 8 +------- src/xmpp/connection.h | 2 -- src/xmpp/session.c | 2 +- src/xmpp/session.h | 2 +- src/xmpp/xmpp.h | 2 +- tests/unittests/xmpp/stub_xmpp.c | 2 +- 12 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index 47a3982f..d3e0fc92 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -232,7 +232,7 @@ cmd_tls_trust(ProfWin *window, const char *const command, gchar **args) cons_show("You are not currently connected."); return TRUE; } - if (!connection_conn_is_secured()) { + if (!connection_is_secured()) { cons_show("No TLS connection established"); return TRUE; } @@ -330,7 +330,7 @@ cmd_tls_cert(ProfWin *window, const char *const command, gchar **args) cons_show("You are not currently connected."); return TRUE; } - if (!connection_conn_is_secured()) { + if (!connection_is_secured()) { cons_show("No TLS connection established"); return TRUE; } diff --git a/src/event/server_events.c b/src/event/server_events.c index 76084d48..5a04a885 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -61,7 +61,7 @@ #include "ui/ui.h" void -sv_ev_login_account_success(char *account_name, int secured) +sv_ev_login_account_success(char *account_name, gboolean secured) { ProfAccount *account = accounts_get_account(account_name); diff --git a/src/event/server_events.h b/src/event/server_events.h index 7dc0107f..8c66f6de 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -37,7 +37,7 @@ #include "xmpp/xmpp.h" -void sv_ev_login_account_success(char *account_name, int secured); +void sv_ev_login_account_success(char *account_name, gboolean secured); void sv_ev_lost_connection(void); void sv_ev_failed_login(void); void sv_ev_room_invite(jabber_invite_t invite_type, diff --git a/src/ui/console.c b/src/ui/console.c index d7db79c7..472cd587 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -472,7 +472,7 @@ cons_check_version(gboolean not_available_msg) } void -cons_show_login_success(ProfAccount *account, int secured) +cons_show_login_success(ProfAccount *account, gboolean secured) { ProfWin *console = wins_get_console(); win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", "%s logged in successfully, ", account->jid); diff --git a/src/ui/core.c b/src/ui/core.c index aa7fdc09..0b761274 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -352,7 +352,7 @@ ui_group_removed(const char *const contact, const char *const group) } void -ui_handle_login_account_success(ProfAccount *account, int secured) +ui_handle_login_account_success(ProfAccount *account, gboolean secured) { if (account->theme) { if (theme_load(account->theme)) { @@ -378,7 +378,7 @@ ui_handle_login_account_success(ProfAccount *account, int secured) cons_show_login_success(account, secured); title_bar_set_presence(contact_presence); title_bar_set_connected(TRUE); - title_bar_set_tls(secured ? TRUE : FALSE); + title_bar_set_tls(secured); GString *fulljid = g_string_new(account->jid); g_string_append(fulljid, "/"); diff --git a/src/ui/ui.h b/src/ui/ui.h index 36a70618..a4b9e8ec 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -118,7 +118,7 @@ void ui_show_software_version(const char *const jid, const char *const presence const char *const version, const char *const os); void ui_prune_wins(void); void ui_auto_away(char *message, gint time, resource_presence_t res_presence); -void ui_handle_login_account_success(ProfAccount *account, int secured); +void ui_handle_login_account_success(ProfAccount *account, gboolean secured); void ui_update_presence(const resource_presence_t resource_presence, const char *const message, const char *const show); void ui_write(char *line, int offset); void ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void)); @@ -260,7 +260,7 @@ void cons_show_themes(GSList *themes); void cons_show_scripts(GSList *scripts); void cons_show_script(const char *const script, GSList *commands); void cons_show_aliases(GList *aliases); -void cons_show_login_success(ProfAccount *account, int secured); +void cons_show_login_success(ProfAccount *account, gboolean secured); void cons_show_software_version(const char *const jid, const char *const presence, const char *const name, const char *const version, const char *const os); void cons_show_account_list(gchar **accounts); diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 98d241f6..26968797 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -281,12 +281,6 @@ connection_set_domain(char *domain) conn.domain = strdup(domain); } -int -connection_is_secured(void) -{ - return xmpp_conn_is_secured(conn.conn); -} - #ifdef HAVE_LIBMESODE TLSCertificate* connection_get_tls_peer_cert(void) @@ -312,7 +306,7 @@ connection_get_tls_peer_cert(void) #endif gboolean -connection_conn_is_secured(void) +connection_is_secured(void) { if (conn.conn_status == JABBER_CONNECTED) { return xmpp_conn_is_secured(conn.conn) == 0 ? FALSE : TRUE; diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 50ef82f8..9a731c2c 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -49,8 +49,6 @@ void connection_set_presence_msg(const char *const message); void connection_set_priority(const int priority); void connection_set_domain(char *domain); -int connection_is_secured(void); - void connection_free_conn(void); void connection_free_ctx(void); void connection_free_presence_msg(void); diff --git a/src/xmpp/session.c b/src/xmpp/session.c index 3381baab..c513b233 100644 --- a/src/xmpp/session.c +++ b/src/xmpp/session.c @@ -327,7 +327,7 @@ session_remove_available_resource(const char *const resource) } void -session_login_success(int secured) +session_login_success(gboolean secured) { // logged in with account if (saved_account.name) { diff --git a/src/xmpp/session.h b/src/xmpp/session.h index cc1d4829..d9ec7b8d 100644 --- a/src/xmpp/session.h +++ b/src/xmpp/session.h @@ -46,7 +46,7 @@ #include "resource.h" -void session_login_success(int secured); +void session_login_success(gboolean secured); void session_login_failed(void); void session_lost_connection(void); GSList* session_get_disco_items(void); diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index dbea4e40..ff75ab58 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -130,7 +130,7 @@ void connection_free_uuid(char *uuid); #ifdef HAVE_LIBMESODE TLSCertificate* connection_get_tls_peer_cert(void); #endif -gboolean connection_conn_is_secured(void); +gboolean connection_is_secured(void); gboolean connection_send_stanza(const char *const stanza); char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url); diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index 45fbf0ef..9bd91efc 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -37,7 +37,7 @@ const char * session_get_domain(void) return NULL; } -gboolean connection_conn_is_secured(void) +gboolean connection_is_secured(void) { return 1; }