about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-08 22:52:54 +0100
committerJames Booth <boothj5@gmail.com>2012-10-08 22:52:54 +0100
commit48936c0a95627e6813f2cb9266ed9240ee4f5ea6 (patch)
tree3090c13f1476f05a5a24dcd2475db5e4d655dee9 /src
parent2294d908f6927ca98e7e6ee68020f870d1556d59 (diff)
downloadprofani-tty-48936c0a95627e6813f2cb9266ed9240ee4f5ea6.tar.gz
Added datestamped logs
Diffstat (limited to 'src')
-rw-r--r--src/chat_log.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/chat_log.c b/src/chat_log.c
index 5ddfcec9..60062f38 100644
--- a/src/chat_log.c
+++ b/src/chat_log.c
@@ -51,7 +51,6 @@ chat_log_chat(const gchar * const login, gchar *other,
     
     if (logpp == NULL) {
         GString *log_file = g_string_new(getenv("HOME"));
-    
         g_string_append(log_file, "/.profanity/log");
         create_dir(log_file->str);
     
@@ -59,13 +58,20 @@ chat_log_chat(const gchar * const login, gchar *other,
         g_string_append_printf(log_file, "/%s", login_dir);
         create_dir(log_file->str);
         free(login_dir);
-
+    
         gchar *other_file = str_replace(other, "@", "_at_");
-        g_string_append_printf(log_file, "/%s.log", other_file);
+        g_string_append_printf(log_file, "/%s", other_file);
+
+        GDateTime *dt = g_date_time_new_now_local();
+        gchar *date = g_date_time_format(dt, "_%d_%m_%Y.log");
+        g_string_append_printf(log_file, date);
+
         logp = fopen(log_file->str, "a");
+        
         free(other_file);
-    
+        g_date_time_unref(dt);
         g_string_free(log_file, TRUE);
+        
         g_hash_table_insert(logs, other, logp);
     } else {
         logp = (FILE *) logpp;