diff options
author | James Booth <boothj5@gmail.com> | 2012-09-11 01:30:48 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-09-11 01:30:48 +0100 |
commit | 1d44a8a3453978bdc42473950a7ed0db6dd4c583 (patch) | |
tree | fabfcc21ac3d326c9d5da9fd046dae4458073a76 /src | |
parent | 07178bf3b2e4e4547df97744ec27097afa6ac97a (diff) | |
download | profani-tty-1d44a8a3453978bdc42473950a7ed0db6dd4c583.tar.gz |
Started work on closing stream on quit
For standards compliance
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 4 | ||||
-rw-r--r-- | src/jabber.c | 27 | ||||
-rw-r--r-- | src/profanity.c | 5 |
3 files changed, 25 insertions, 11 deletions
diff --git a/src/command.c b/src/command.c index a34f6faa..15424362 100644 --- a/src/command.c +++ b/src/command.c @@ -494,7 +494,9 @@ _cmd_connect(const char * const inp, struct cmd_help_t help) static gboolean _cmd_quit(const char * const inp, struct cmd_help_t help) { - return FALSE; + log_info("Profanity is shutting down."); + jabber_disconnect(); + return TRUE; } static gboolean diff --git a/src/jabber.c b/src/jabber.c index 3af7f203..fc76e0e4 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -162,11 +162,9 @@ jabber_disconnect(void) { if (jabber_conn.conn_status == JABBER_CONNECTED) { log_info("Closing connection"); - xmpp_conn_release(jabber_conn.conn); - xmpp_ctx_free(jabber_conn.ctx); - xmpp_shutdown(); - jabber_conn.conn_status = JABBER_DISCONNECTED; - jabber_conn.presence = PRESENCE_OFFLINE; + + // attempt closing the XML stream + xmpp_disconnect(jabber_conn.conn); } } @@ -382,6 +380,25 @@ _jabber_conn_handler(xmpp_conn_t * const conn, jabber_conn.conn_status = JABBER_DISCONNECTED; jabber_conn.presence = PRESENCE_OFFLINE; } +/* TO DO IF END STREAM + + + // free memory for connection object and context + xmpp_conn_release(jabber_conn.conn); + xmpp_ctx_free(jabber_conn.ctx); + + // shutdown libstrophe + xmpp_shutdown(); + + jabber_conn.conn_status = JABBER_DISCONNECTED; + jabber_conn.presence = PRESENCE_OFFLINE; + + gui_close(); + chat_log_close(); + prefs_close(); + log_info("Shutdown complete"); + log_close(); +*/ } static int diff --git a/src/profanity.c b/src/profanity.c index 48f20e6c..88792f86 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -93,11 +93,6 @@ _profanity_shutdown(void) { log_info("Profanity is shutting down."); jabber_disconnect(); - gui_close(); - chat_log_close(); - prefs_close(); - log_info("Shutdown complete"); - log_close(); } static log_level_t |