mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Shutdown now correctly handles connection
This commit is contained in:
parent
d136298f96
commit
6d329343dc
@ -42,7 +42,7 @@ PKG_CHECK_MODULES([DEPS], [openssl glib-2.0 libcurl])
|
|||||||
PKG_CHECK_MODULES([NOTIFY], [libnotify], [],
|
PKG_CHECK_MODULES([NOTIFY], [libnotify], [],
|
||||||
[AC_MSG_NOTICE([libnotify module not found])])
|
[AC_MSG_NOTICE([libnotify module not found])])
|
||||||
|
|
||||||
AM_CFLAGS="-O3 -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings "
|
AM_CFLAGS="-Wall "
|
||||||
AM_CFLAGS="$AM_CFLAGS -lstrophe -lxml2 -lexpat -lncurses -lcurl -lresolv "
|
AM_CFLAGS="$AM_CFLAGS -lstrophe -lxml2 -lexpat -lncurses -lcurl -lresolv "
|
||||||
AM_CFLAGS="$AM_CFLAGS $DEPS_LIBS $NOTIFY_LIBS"
|
AM_CFLAGS="$AM_CFLAGS $DEPS_LIBS $NOTIFY_LIBS"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -f valgrind.out
|
rm -f valgrind.out
|
||||||
#valgrind --log-file=valgrind.out --leak-check=full --track-origins=yes --show-reachable=yes ./profanity
|
#valgrind --log-file=valgrind.out --leak-check=full --track-origins=yes --show-reachable=yes ./profanity
|
||||||
valgrind --log-file=valgrind.out --leak-check=full --track-origins=yes ./profanity
|
valgrind --log-file=valgrind.out --leak-check=full --track-origins=yes ./profanity -l DEBUG
|
||||||
|
@ -87,7 +87,6 @@ chat_log_chat(const gchar * const login, gchar *other,
|
|||||||
void
|
void
|
||||||
chat_log_close(void)
|
chat_log_close(void)
|
||||||
{
|
{
|
||||||
log_info("Closing down chat logs");
|
|
||||||
g_hash_table_foreach(logs, (GHFunc) _close_file, NULL);
|
g_hash_table_foreach(logs, (GHFunc) _close_file, NULL);
|
||||||
g_time_zone_unref(tz);
|
g_time_zone_unref(tz);
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,8 @@ _cmd_connect(const char * const inp, struct cmd_help_t help)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cmd_quit(const char * const inp, struct cmd_help_t help)
|
_cmd_quit(const char * const inp, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
log_info("Profanity is shutting down.");
|
log_info("Profanity is shutting down...");
|
||||||
profanity_shutdown_init();
|
exit(0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +390,6 @@ _jabber_conn_handler(xmpp_conn_t * const conn,
|
|||||||
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
||||||
jabber_conn.presence = PRESENCE_OFFLINE;
|
jabber_conn.presence = PRESENCE_OFFLINE;
|
||||||
|
|
||||||
profanity_shutdown();
|
|
||||||
|
|
||||||
// lost connection for unkown reason
|
// lost connection for unkown reason
|
||||||
} else if (jabber_conn.conn_status == JABBER_CONNECTED) {
|
} else if (jabber_conn.conn_status == JABBER_CONNECTED) {
|
||||||
cons_bad_show("Lost connection.");
|
cons_bad_show("Lost connection.");
|
||||||
|
@ -121,6 +121,7 @@ log_msg(log_level_t level, const char * const area, const char * const msg)
|
|||||||
g_date_time_unref(dt);
|
g_date_time_unref(dt);
|
||||||
|
|
||||||
fflush(logp);
|
fflush(logp);
|
||||||
|
g_free(date_fmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,6 @@ prefs_load(void)
|
|||||||
void
|
void
|
||||||
prefs_close(void)
|
prefs_close(void)
|
||||||
{
|
{
|
||||||
log_info("Closing down preferences");
|
|
||||||
g_key_file_free(prefs);
|
g_key_file_free(prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ profanity_run(void)
|
|||||||
inp[size++] = '\0';
|
inp[size++] = '\0';
|
||||||
cmd_result = _process_input(inp);
|
cmd_result = _process_input(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -91,11 +90,10 @@ profanity_init(const int disable_tls, char *log_level)
|
|||||||
void
|
void
|
||||||
profanity_shutdown_init(void)
|
profanity_shutdown_init(void)
|
||||||
{
|
{
|
||||||
log_info("Profanity is shutting down.");
|
|
||||||
gboolean wait_response = jabber_disconnect();
|
gboolean wait_response = jabber_disconnect();
|
||||||
|
|
||||||
if (wait_response) {
|
if (wait_response) {
|
||||||
while (TRUE) {
|
while (jabber_connection_status() == JABBER_DISCONNECTING) {
|
||||||
jabber_process_events();
|
jabber_process_events();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +107,6 @@ profanity_shutdown(void)
|
|||||||
gui_close();
|
gui_close();
|
||||||
chat_log_close();
|
chat_log_close();
|
||||||
prefs_close();
|
prefs_close();
|
||||||
log_info("Shutdown complete");
|
|
||||||
log_close();
|
log_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,6 @@ gui_refresh(void)
|
|||||||
void
|
void
|
||||||
gui_close(void)
|
gui_close(void)
|
||||||
{
|
{
|
||||||
log_info("Closing UI");
|
|
||||||
endwin();
|
endwin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,6 +798,7 @@ _win_show_time(WINDOW *win)
|
|||||||
gchar *date_fmt = g_date_time_format(time, "%H:%M");
|
gchar *date_fmt = g_date_time_format(time, "%H:%M");
|
||||||
wprintw(win, "%s - ", date_fmt);
|
wprintw(win, "%s - ", date_fmt);
|
||||||
g_date_time_unref(time);
|
g_date_time_unref(time);
|
||||||
|
g_free(date_fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user