about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-09-23 19:26:07 +0100
committerJames Booth <boothj5@gmail.com>2012-09-23 19:26:07 +0100
commit6d329343dc2d8ff048a57783ff0e3bdc5094824f (patch)
treebbee626d9bd0fb1fa28fee1144c663f1381dec13 /src
parentd136298f969dbaef39e0e7d74d396d84cdc23a6a (diff)
downloadprofani-tty-6d329343dc2d8ff048a57783ff0e3bdc5094824f.tar.gz
Shutdown now correctly handles connection
Diffstat (limited to 'src')
-rw-r--r--src/chat_log.c1
-rw-r--r--src/command.c4
-rw-r--r--src/jabber.c2
-rw-r--r--src/log.c1
-rw-r--r--src/preferences.c1
-rw-r--r--src/profanity.c5
-rw-r--r--src/windows.c2
7 files changed, 5 insertions, 11 deletions
diff --git a/src/chat_log.c b/src/chat_log.c
index afb60491..5ddfcec9 100644
--- a/src/chat_log.c
+++ b/src/chat_log.c
@@ -87,7 +87,6 @@ chat_log_chat(const gchar * const login, gchar *other,
 void
 chat_log_close(void)
 {
-    log_info("Closing down chat logs");
     g_hash_table_foreach(logs, (GHFunc) _close_file, NULL);
     g_time_zone_unref(tz);
 }
diff --git a/src/command.c b/src/command.c
index eae52ae9..ec165ca1 100644
--- a/src/command.c
+++ b/src/command.c
@@ -494,8 +494,8 @@ _cmd_connect(const char * const inp, struct cmd_help_t help)
 static gboolean
 _cmd_quit(const char * const inp, struct cmd_help_t help)
 {
-    log_info("Profanity is shutting down.");
-    profanity_shutdown_init();
+    log_info("Profanity is shutting down...");
+    exit(0);
     return FALSE;
 }
 
diff --git a/src/jabber.c b/src/jabber.c
index c8ef4a55..3cdad108 100644
--- a/src/jabber.c
+++ b/src/jabber.c
@@ -389,8 +389,6 @@ _jabber_conn_handler(xmpp_conn_t * const conn,
 
             jabber_conn.conn_status = JABBER_DISCONNECTED;
             jabber_conn.presence = PRESENCE_OFFLINE;
-
-            profanity_shutdown();
             
         // lost connection for unkown reason
         } else if (jabber_conn.conn_status == JABBER_CONNECTED) {
diff --git a/src/log.c b/src/log.c
index 3c172dea..20dc0b4e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -121,6 +121,7 @@ log_msg(log_level_t level, const char * const area, const char * const msg)
         g_date_time_unref(dt);
     
         fflush(logp);
+        g_free(date_fmt);
     }
 }
 
diff --git a/src/preferences.c b/src/preferences.c
index 898d8f46..cb575313 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -117,7 +117,6 @@ prefs_load(void)
 void
 prefs_close(void)
 {
-    log_info("Closing down preferences");
     g_key_file_free(prefs);
 }
 
diff --git a/src/profanity.c b/src/profanity.c
index ab5f2285..0c4bc49e 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -68,7 +68,6 @@ profanity_run(void)
         inp[size++] = '\0';
         cmd_result = _process_input(inp);
     }
-
 }
 
 void
@@ -91,11 +90,10 @@ profanity_init(const int disable_tls, char *log_level)
 void
 profanity_shutdown_init(void)
 {
-    log_info("Profanity is shutting down.");
     gboolean wait_response = jabber_disconnect();
 
     if (wait_response) {
-        while (TRUE) {
+        while (jabber_connection_status() == JABBER_DISCONNECTING) {
             jabber_process_events();
         }
     }
@@ -109,7 +107,6 @@ profanity_shutdown(void)
     gui_close();                                                          
     chat_log_close();                                                    
     prefs_close();                                                       
-    log_info("Shutdown complete");                                       
     log_close();   
 }
 
diff --git a/src/windows.c b/src/windows.c
index 099c62d7..29bbd3dd 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -141,7 +141,6 @@ gui_refresh(void)
 void
 gui_close(void)
 {
-    log_info("Closing UI");
     endwin();
 }
 
@@ -799,6 +798,7 @@ _win_show_time(WINDOW *win)
     gchar *date_fmt = g_date_time_format(time, "%H:%M");
     wprintw(win, "%s - ", date_fmt);
     g_date_time_unref(time);
+    g_free(date_fmt);
 }
 
 static void