about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-03-18 18:56:22 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-04-06 10:50:20 +0200
commita7163b24f3822989173cfca8ad7bfc84193cc839 (patch)
tree9b6c27eaf615b7633a2cc8bcbb1aab116b25655e /src/config
parent994411d470ae3d7a7649fc43f76f180c7287ce43 (diff)
downloadprofani-tty-a7163b24f3822989173cfca8ad7bfc84193cc839.tar.gz
database: Define chatlog database location
Diffstat (limited to 'src/config')
-rw-r--r--src/config/files.c17
-rw-r--r--src/config/files.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/config/files.c b/src/config/files.c
index 133a270e..e77bfa30 100644
--- a/src/config/files.c
+++ b/src/config/files.c
@@ -3,6 +3,7 @@
  * vim: expandtab:ts=4:sts=4:sw=4
  *
  * Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
+ * Copyright (C) 2020 Michael Vetter <jubalh@idoru.org>
  *
  * This file is part of Profanity.
  *
@@ -139,6 +140,22 @@ files_get_log_file(char *log_file)
 }
 
 char*
+files_get_chatlog_database_path(void)
+{
+    gchar *xdg_data = _files_get_xdg_data_home();
+    GString *logfile = g_string_new(xdg_data);
+
+    g_string_append(logfile, "/profanity/chatlog.db");
+
+    char *result = strdup(logfile->str);
+
+    free(xdg_data);
+    g_string_free(logfile, TRUE);
+
+    return result;
+}
+
+char*
 files_get_config_path(char *config_base)
 {
     gchar *xdg_config = _files_get_xdg_config_home();
diff --git a/src/config/files.h b/src/config/files.h
index 12c3f03a..124c3ac8 100644
--- a/src/config/files.h
+++ b/src/config/files.h
@@ -60,6 +60,7 @@ void files_create_directories(void);
 
 char* files_get_config_path(char *config_base);
 char* files_get_data_path(char *data_base);
+char* files_get_chatlog_database_path(void);
 
 char* files_get_log_file(char *log_file);
 char* files_get_inputrc_file(void);