From a3efcb7e05cc22754d0c5551f08c2125f658abea Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Jul 2012 22:59:05 +0100 Subject: [PATCH] Created log dir for each login --- src/chat_log.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/chat_log.c b/src/chat_log.c index 01e3735f..becaee5e 100644 --- a/src/chat_log.c +++ b/src/chat_log.c @@ -31,7 +31,7 @@ static GHashTable *logs; static GTimeZone *tz; -static void _close_file(gpointer key, gpointer value, gpointer user_data); +//static void _close_file(gpointer key, gpointer value, gpointer user_data); void chat_log_init(void) { @@ -47,10 +47,16 @@ void chat_log_chat(const char * const login, char *other, if (logpp == NULL) { GString *log_file = g_string_new(getenv("HOME")); + g_string_append(log_file, "/.profanity/log"); create_dir(log_file->str); + + g_string_append_printf(log_file, "/%s", login); + create_dir(log_file->str); + g_string_append_printf(log_file, "/%s.log", other); logp = fopen(log_file->str, "a"); + g_string_free(log_file, TRUE); g_hash_table_insert(logs, other, &logp); } else { @@ -72,11 +78,11 @@ void chat_log_chat(const char * const login, char *other, void chat_log_close(void) { - g_hash_table_foreach(logs, (GHFunc) _close_file, NULL); +// g_hash_table_foreach(logs, (GHFunc) _close_file, NULL); g_time_zone_unref(tz); } -static void _close_file(gpointer key, gpointer value, gpointer user_data) -{ - fclose(value); -} +//static void _close_file(gpointer key, gpointer value, gpointer user_data) +//{ +// fclose(value); +//}