1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Moved handle_lost_connection and handle_failed_login to server_events

This commit is contained in:
James Booth 2014-01-05 21:04:30 +00:00
parent da03617e8b
commit 42fd1fb13e
5 changed files with 25 additions and 25 deletions

View File

@ -249,25 +249,6 @@ prof_handle_gone(const char * const from)
ui_current_page_off(); 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 void
prof_handle_disconnect(const char * const jid) prof_handle_disconnect(const char * const jid)
{ {

View File

@ -29,10 +29,7 @@
void prof_run(const int disable_tls, char *log_level, char *account_name); 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_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_disconnect(const char * const jid);
void prof_handle_failed_login(void);
void prof_handle_typing(char *from); void prof_handle_typing(char *from);
void prof_handle_contact_online(char *contact, Resource *resource, void prof_handle_contact_online(char *contact, Resource *resource,
GDateTime *last_activity); 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_incoming_message(char *from, char *message, gboolean priv);
void prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp, void prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp,
gboolean priv); 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_subscription(const char *from, jabber_subscr_t type);
void prof_handle_roster(GSList *roster); void prof_handle_roster(GSList *roster);
void prof_handle_gone(const char * const from); void prof_handle_gone(const char * const from);

View File

@ -20,8 +20,10 @@
* *
*/ */
#include "chat_session.h"
#include "log.h" #include "log.h"
#include "muc.h" #include "muc.h"
#include "roster_list.h"
#include "ui/ui.h" #include "ui/ui.h"
void void
@ -55,3 +57,22 @@ handle_login_account_success(char *account_name)
accounts_free_account(account); 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();
}

View File

@ -25,5 +25,7 @@
void handle_error_message(const char *from, const char *err_msg); void handle_error_message(const char *from, const char *err_msg);
void handle_login_account_success(char *account_name); void handle_login_account_success(char *account_name);
void handle_lost_connection(void);
void handle_failed_login(void);
#endif #endif

View File

@ -512,7 +512,7 @@ _connection_handler(xmpp_conn_t * const conn,
// lost connection for unkown reason // lost connection for unkown reason
if (jabber_conn.conn_status == JABBER_CONNECTED) { if (jabber_conn.conn_status == JABBER_CONNECTED) {
log_debug("Connection handler: Lost connection for unknown reason"); log_debug("Connection handler: Lost connection for unknown reason");
prof_handle_lost_connection(); handle_lost_connection();
if (prefs_get_reconnect() != 0) { if (prefs_get_reconnect() != 0) {
assert(reconnect_timer == NULL); assert(reconnect_timer == NULL);
reconnect_timer = g_timer_new(); reconnect_timer = g_timer_new();
@ -529,7 +529,7 @@ _connection_handler(xmpp_conn_t * const conn,
log_debug("Connection handler: Login failed"); log_debug("Connection handler: Login failed");
if (reconnect_timer == NULL) { if (reconnect_timer == NULL) {
log_debug("Connection handler: No reconnect timer"); log_debug("Connection handler: No reconnect timer");
prof_handle_failed_login(); handle_failed_login();
_connection_free_saved_account(); _connection_free_saved_account();
_connection_free_saved_details(); _connection_free_saved_details();
_connection_free_session_data(); _connection_free_session_data();