From 42fd1fb13e6273050226204a125919acfa92be4f Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 21:04:30 +0000 Subject: [PATCH] Moved handle_lost_connection and handle_failed_login to server_events --- src/profanity.c | 19 ------------------- src/profanity.h | 4 ---- src/server_events.c | 21 +++++++++++++++++++++ src/server_events.h | 2 ++ src/xmpp/connection.c | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/profanity.c b/src/profanity.c index 55f325f9..23beb1e1 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -249,25 +249,6 @@ prof_handle_gone(const char * const from) ui_current_page_off(); } -void -prof_handle_failed_login(void) -{ - cons_show_error("Login failed."); - log_info("Login failed"); - ui_current_page_off(); -} - -void -prof_handle_lost_connection(void) -{ - cons_show_error("Lost connection."); - roster_clear(); - muc_clear_invites(); - chat_sessions_clear(); - ui_disconnected(); - ui_current_page_off(); -} - void prof_handle_disconnect(const char * const jid) { diff --git a/src/profanity.h b/src/profanity.h index 3dac6c3e..7db0171d 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -29,10 +29,7 @@ void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_login_success(const char *jid, const char *altdomain); -void prof_handle_login_account_success(char *account_name); -void prof_handle_lost_connection(void); void prof_handle_disconnect(const char * const jid); -void prof_handle_failed_login(void); void prof_handle_typing(char *from); void prof_handle_contact_online(char *contact, Resource *resource, GDateTime *last_activity); @@ -40,7 +37,6 @@ void prof_handle_contact_offline(char *contact, char *show, char *status); void prof_handle_incoming_message(char *from, char *message, gboolean priv); void prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp, gboolean priv); -void prof_handle_error_message(const char *from, const char *err_msg); void prof_handle_subscription(const char *from, jabber_subscr_t type); void prof_handle_roster(GSList *roster); void prof_handle_gone(const char * const from); diff --git a/src/server_events.c b/src/server_events.c index aecfbccb..5bf605c3 100644 --- a/src/server_events.c +++ b/src/server_events.c @@ -20,8 +20,10 @@ * */ +#include "chat_session.h" #include "log.h" #include "muc.h" +#include "roster_list.h" #include "ui/ui.h" void @@ -55,3 +57,22 @@ handle_login_account_success(char *account_name) accounts_free_account(account); } +void +handle_lost_connection(void) +{ + cons_show_error("Lost connection."); + roster_clear(); + muc_clear_invites(); + chat_sessions_clear(); + ui_disconnected(); + ui_current_page_off(); +} + +void +handle_failed_login(void) +{ + cons_show_error("Login failed."); + log_info("Login failed"); + ui_current_page_off(); +} + diff --git a/src/server_events.h b/src/server_events.h index e566e9c8..4a61a6a0 100644 --- a/src/server_events.h +++ b/src/server_events.h @@ -25,5 +25,7 @@ void handle_error_message(const char *from, const char *err_msg); void handle_login_account_success(char *account_name); +void handle_lost_connection(void); +void handle_failed_login(void); #endif diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index a60b20cc..ad447767 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -512,7 +512,7 @@ _connection_handler(xmpp_conn_t * const conn, // lost connection for unkown reason if (jabber_conn.conn_status == JABBER_CONNECTED) { log_debug("Connection handler: Lost connection for unknown reason"); - prof_handle_lost_connection(); + handle_lost_connection(); if (prefs_get_reconnect() != 0) { assert(reconnect_timer == NULL); reconnect_timer = g_timer_new(); @@ -529,7 +529,7 @@ _connection_handler(xmpp_conn_t * const conn, log_debug("Connection handler: Login failed"); if (reconnect_timer == NULL) { log_debug("Connection handler: No reconnect timer"); - prof_handle_failed_login(); + handle_failed_login(); _connection_free_saved_account(); _connection_free_saved_details(); _connection_free_session_data();