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

Free features on disconnect

This commit is contained in:
James Booth 2016-05-08 03:14:22 +01:00
parent ac3ab39e23
commit ec51ae689c
3 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,7 @@ void connection_init(void)
conn.xmpp_conn = NULL;
conn.xmpp_ctx = NULL;
conn.domain = NULL;
conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy);
conn.features_by_jid = NULL;
conn.available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)resource_destroy);
}
@ -434,6 +434,7 @@ _connection_handler(xmpp_conn_t *const xmpp_conn, const xmpp_conn_event_t status
conn.domain = strdup(my_jid->domainpart);
jid_destroy(my_jid);
conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy);
g_hash_table_insert(conn.features_by_jid, strdup(conn.domain), g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL));
session_login_success(connection_is_secured());

View File

@ -59,6 +59,7 @@ xmpp_ctx_t* connection_get_ctx(void);
char *connection_get_domain(void);
char* connection_jid_for_feature(const char *const feature);
GHashTable* connection_get_features(const char *const jid);
void connection_disco_items_free(void);
void connection_add_available_resource(Resource *resource);
void connection_remove_available_resource(const char *const resource);

View File

@ -388,6 +388,7 @@ _session_free_saved_details(void)
static void
_session_free_session_data(void)
{
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();