mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Moved handle_login_account_success to server_events
This commit is contained in:
parent
87cdbe015a
commit
da03617e8b
@ -23,6 +23,8 @@
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
|
||||
#include "glib.h"
|
||||
|
||||
// log levels
|
||||
typedef enum {
|
||||
PROF_LEVEL_DEBUG,
|
||||
|
@ -242,22 +242,6 @@ prof_handle_roster_remove(const char * const barejid)
|
||||
ui_current_page_off();
|
||||
}
|
||||
|
||||
void
|
||||
prof_handle_login_account_success(char *account_name)
|
||||
{
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
resource_presence_t resource_presence = accounts_get_login_presence(account->name);
|
||||
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
||||
cons_show_login_success(account);
|
||||
title_bar_set_status(contact_presence);
|
||||
log_info("%s logged in successfully", account->jid);
|
||||
ui_current_page_off();
|
||||
status_bar_print_message(account->jid);
|
||||
status_bar_refresh();
|
||||
|
||||
accounts_free_account(account);
|
||||
}
|
||||
|
||||
void
|
||||
prof_handle_gone(const char * const from)
|
||||
{
|
||||
|
@ -20,8 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "log.h"
|
||||
#include "muc.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
void
|
||||
handle_error_message(const char *from, const char *err_msg)
|
||||
@ -38,3 +39,19 @@ handle_error_message(const char *from, const char *err_msg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_login_account_success(char *account_name)
|
||||
{
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
resource_presence_t resource_presence = accounts_get_login_presence(account->name);
|
||||
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
||||
cons_show_login_success(account);
|
||||
title_bar_set_status(contact_presence);
|
||||
log_info("%s logged in successfully", account->jid);
|
||||
ui_current_page_off();
|
||||
status_bar_print_message(account->jid);
|
||||
status_bar_refresh();
|
||||
|
||||
accounts_free_account(account);
|
||||
}
|
||||
|
||||
|
@ -24,5 +24,6 @@
|
||||
#define SERVER_EVENTS_H
|
||||
|
||||
void handle_error_message(const char *from, const char *err_msg);
|
||||
void handle_login_account_success(char *account_name);
|
||||
|
||||
#endif
|
||||
|
@ -463,7 +463,7 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
// logged in with account
|
||||
if (saved_account.name != NULL) {
|
||||
log_debug("Connection handler: logged in with account name: %s", saved_account.name);
|
||||
prof_handle_login_account_success(saved_account.name);
|
||||
handle_login_account_success(saved_account.name);
|
||||
|
||||
// logged in without account, use details to create new account
|
||||
} else {
|
||||
@ -471,7 +471,7 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
accounts_add(saved_details.name, saved_details.altdomain);
|
||||
accounts_set_jid(saved_details.name, saved_details.jid);
|
||||
|
||||
prof_handle_login_account_success(saved_details.name);
|
||||
handle_login_account_success(saved_details.name);
|
||||
saved_account.name = strdup(saved_details.name);
|
||||
saved_account.passwd = strdup(saved_details.passwd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user