mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Fixed error when losing connection and segfaulting on notify_remind()
This commit is contained in:
parent
3d8d5214bb
commit
78ff58cf77
@ -62,6 +62,7 @@ prof_run(const int disable_tls, char *log_level)
|
|||||||
inp_non_block();
|
inp_non_block();
|
||||||
GTimer *timer = g_timer_new();
|
GTimer *timer = g_timer_new();
|
||||||
gboolean cmd_result = TRUE;
|
gboolean cmd_result = TRUE;
|
||||||
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
|
||||||
char inp[INP_WIN_MAX];
|
char inp[INP_WIN_MAX];
|
||||||
int size = 0;
|
int size = 0;
|
||||||
@ -71,7 +72,7 @@ prof_run(const int disable_tls, char *log_level)
|
|||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
while(ch != '\n') {
|
while(ch != '\n') {
|
||||||
if (jabber_get_connection_status() == JABBER_CONNECTED) {
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
_handle_idle_time();
|
_handle_idle_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,13 @@ autocomplete_free(Autocomplete ac)
|
|||||||
gint
|
gint
|
||||||
autocomplete_length(Autocomplete ac)
|
autocomplete_length(Autocomplete ac)
|
||||||
{
|
{
|
||||||
|
if (ac == NULL) {
|
||||||
|
return 0;
|
||||||
|
} else if (ac->items == NULL) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
return g_slist_length(ac->items);
|
return g_slist_length(ac->items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -100,7 +100,7 @@ jabber_init(const int disable_tls)
|
|||||||
jabber_conn.ctx = NULL;
|
jabber_conn.ctx = NULL;
|
||||||
jabber_conn.tls_disabled = disable_tls;
|
jabber_conn.tls_disabled = disable_tls;
|
||||||
jabber_conn.domain = NULL;
|
jabber_conn.domain = NULL;
|
||||||
presence_init();
|
presence_sub_requests_init();
|
||||||
caps_init();
|
caps_init();
|
||||||
available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free,
|
available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free,
|
||||||
(GDestroyNotify)resource_destroy);
|
(GDestroyNotify)resource_destroy);
|
||||||
@ -327,7 +327,7 @@ _connection_free_session_data(void)
|
|||||||
{
|
{
|
||||||
g_hash_table_remove_all(available_resources);
|
g_hash_table_remove_all(available_resources);
|
||||||
chat_sessions_clear();
|
chat_sessions_clear();
|
||||||
presence_free_sub_requests();
|
presence_clear_sub_requests();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -61,7 +61,7 @@ static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);
|
|||||||
void _send_caps_request(char *node, char *caps_key, char *id, char *from);
|
void _send_caps_request(char *node, char *caps_key, char *id, char *from);
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_init(void)
|
presence_sub_requests_init(void)
|
||||||
{
|
{
|
||||||
sub_requests_ac = autocomplete_new();
|
sub_requests_ac = autocomplete_new();
|
||||||
}
|
}
|
||||||
@ -141,6 +141,12 @@ presence_free_sub_requests(void)
|
|||||||
autocomplete_free(sub_requests_ac);
|
autocomplete_free(sub_requests_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
presence_clear_sub_requests(void)
|
||||||
|
{
|
||||||
|
autocomplete_clear(sub_requests_ac);
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
presence_sub_request_find(char * search_str)
|
presence_sub_request_find(char * search_str)
|
||||||
{
|
{
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
#ifndef PRESENCE_H
|
#ifndef PRESENCE_H
|
||||||
#define PRESENCE_H
|
#define PRESENCE_H
|
||||||
|
|
||||||
|
void presence_sub_requests_init(void);
|
||||||
void presence_add_handlers(void);
|
void presence_add_handlers(void);
|
||||||
void presence_init(void);
|
|
||||||
void presence_free_sub_requests(void);
|
void presence_free_sub_requests(void);
|
||||||
|
void presence_clear_sub_requests(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user