diff options
author | James Booth <boothj5@gmail.com> | 2012-07-22 22:59:05 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-07-22 22:59:05 +0100 |
commit | a3efcb7e05cc22754d0c5551f08c2125f658abea (patch) | |
tree | b0e2d0bfc3b0f357bed9f309008433ef3a6eb97a /src | |
parent | cb27c4ab37ba500a9226c1eee63dacd18f5b6f56 (diff) | |
download | profani-tty-a3efcb7e05cc22754d0c5551f08c2125f658abea.tar.gz |
Created log dir for each login
Diffstat (limited to 'src')
-rw-r--r-- | src/chat_log.c | 18 |
1 files 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); +//} |