mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Move conneciton initialisation to _connection_handler
This commit is contained in:
parent
2f61f8d646
commit
f1cf444e05
@ -316,12 +316,6 @@ connection_set_priority(const int priority)
|
||||
conn.priority = priority;
|
||||
}
|
||||
|
||||
void
|
||||
connection_set_domain(char *domain)
|
||||
{
|
||||
conn.domain = strdup(domain);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBMESODE
|
||||
TLSCertificate*
|
||||
connection_get_tls_peer_cert(void)
|
||||
@ -367,16 +361,7 @@ connection_send_stanza(const char *const stanza)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
connection_disco_on_login(void)
|
||||
{
|
||||
DiscoInfo *info = malloc(sizeof(struct disco_info_t));
|
||||
info->item = strdup(conn.domain);
|
||||
info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
|
||||
conn.disco_items = g_slist_append(conn.disco_items, info);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
_disco_item_destroy(DiscoInfo *info)
|
||||
{
|
||||
if (info) {
|
||||
@ -418,8 +403,18 @@ _connection_handler(xmpp_conn_t *const xmpp_conn, const xmpp_conn_event_t status
|
||||
// login success
|
||||
if (status == XMPP_CONN_CONNECT) {
|
||||
log_debug("Connection handler: XMPP_CONN_CONNECT");
|
||||
|
||||
conn.conn_status = JABBER_CONNECTED;
|
||||
|
||||
Jid *my_jid = jid_create(xmpp_conn_get_jid(conn.xmpp_conn));
|
||||
conn.domain = strdup(my_jid->domainpart);
|
||||
jid_destroy(my_jid);
|
||||
|
||||
DiscoInfo *info = malloc(sizeof(struct disco_info_t));
|
||||
info->item = strdup(conn.domain);
|
||||
info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
|
||||
conn.disco_items = g_slist_append(conn.disco_items, info);
|
||||
|
||||
session_login_success(connection_is_secured());
|
||||
|
||||
} else if (status == XMPP_CONN_DISCONNECT) {
|
||||
|
@ -41,12 +41,10 @@ void connection_init(void);
|
||||
|
||||
jabber_conn_status_t connection_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
|
||||
const char *const tls_policy);
|
||||
void connection_disco_on_login(void);
|
||||
|
||||
void connection_set_status(jabber_conn_status_t status);
|
||||
void connection_set_presence_msg(const char *const message);
|
||||
void connection_set_priority(const int priority);
|
||||
void connection_set_domain(char *domain);
|
||||
void connection_set_priority(int priority);
|
||||
void connection_set_disco_items(GSList *disco_items);
|
||||
|
||||
|
@ -294,10 +294,6 @@ session_login_success(gboolean secured)
|
||||
_session_free_saved_details();
|
||||
}
|
||||
|
||||
Jid *my_jid = jid_create(connection_get_fulljid());
|
||||
connection_set_domain(my_jid->domainpart);
|
||||
jid_destroy(my_jid);
|
||||
|
||||
chat_sessions_init();
|
||||
|
||||
message_handlers_init();
|
||||
@ -309,7 +305,6 @@ session_login_success(gboolean secured)
|
||||
blocking_request();
|
||||
|
||||
// items discovery
|
||||
connection_disco_on_login();
|
||||
iq_disco_info_request_onconnect(connection_get_domain());
|
||||
iq_disco_items_request_onconnect(connection_get_domain());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user