about summary refs log tree commit diff stats
path: root/src/log.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-02 22:12:35 +0000
committerJames Booth <boothj5@gmail.com>2013-02-02 22:12:35 +0000
commit0b4c464919d44851afd9091eaa435d3fb205e18e (patch)
tree70bf36830b967d5ae2b81122608c31b0c6447090 /src/log.c
parent66647546f423e955fd07a8bc4db3baa7d17c5e0d (diff)
downloadprofani-tty-0b4c464919d44851afd9091eaa435d3fb205e18e.tar.gz
Moved function to get chat log dir to log.c
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 0282f60f..1fbdf72b 100644
--- a/src/log.c
+++ b/src/log.c
@@ -62,6 +62,7 @@ static void _free_chat_log(struct dated_chat_log *dated_log);
 static gboolean _key_equals(void *key1, void *key2);
 static char * _get_log_filename(const char * const other, const char * const login,
     GDateTime *dt, gboolean create);
+static gchar * _get_chatlog_dir(void);
 
 static void _rotate_log_file(void);
 
@@ -358,7 +359,7 @@ static char *
 _get_log_filename(const char * const other, const char * const login,
     GDateTime *dt, gboolean create)
 {
-    gchar *chatlogs_dir = files_get_chatlog_dir();
+    gchar *chatlogs_dir = _get_chatlog_dir();
     GString *log_file = g_string_new(chatlogs_dir);
     g_free(chatlogs_dir);
 
@@ -384,3 +385,17 @@ _get_log_filename(const char * const other, const char * const login,
 
     return result;
 }
+
+static gchar *
+_get_chatlog_dir(void)
+{
+    gchar *xdg_data = xdg_get_data_home();
+    GString *chatlogs_dir = g_string_new(xdg_data);
+    g_string_append(chatlogs_dir, "/profanity/chatlogs");
+    gchar *result = strdup(chatlogs_dir->str);
+    g_free(xdg_data);
+    g_string_free(chatlogs_dir, TRUE);
+
+    return result;
+}
+