about summary refs log tree commit diff stats
path: root/src/otr
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-07-24 21:35:12 +0100
committerJames Booth <boothj5@gmail.com>2016-07-24 21:49:35 +0100
commita3a73cf0031fef7b4012b27bc1955c406175f0fe (patch)
treea9bfba0b9899eff139a9a8e5436468e35d6b7e91 /src/otr
parent29452f8f1b8f7a61773905169b3883f1b494c786 (diff)
downloadprofani-tty-a3a73cf0031fef7b4012b27bc1955c406175f0fe.tar.gz
Move all filepath handling to files.c
Diffstat (limited to 'src/otr')
-rw-r--r--src/otr/otr.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 955e60fa..8aa3bac1 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -126,12 +126,11 @@ cb_write_fingerprints(void *opdata)
 {
     gcry_error_t err = 0;
 
-    gchar *data_home = files_get_xdg_data_home();
-    GString *basedir = g_string_new(data_home);
-    free(data_home);
-
+    char *otrdir = files_get_data_path(DIR_OTR);
+    GString *basedir = g_string_new(otrdir);
+    free(otrdir);
     gchar *account_dir = str_replace(jid, "@", "_at_");
-    g_string_append(basedir, "/profanity/otr/");
+    g_string_append(basedir, "/");
     g_string_append(basedir, account_dir);
     g_string_append(basedir, "/");
     free(account_dir);
@@ -215,12 +214,11 @@ otr_on_connect(ProfAccount *account)
     jid = strdup(account->jid);
     log_info("Loading OTR key for %s", jid);
 
-    gchar *data_home = files_get_xdg_data_home();
-    GString *basedir = g_string_new(data_home);
-    free(data_home);
-
+    char *otrdir = files_get_data_path(DIR_OTR);
+    GString *basedir = g_string_new(otrdir);
+    free(otrdir);
     gchar *account_dir = str_replace(jid, "@", "_at_");
-    g_string_append(basedir, "/profanity/otr/");
+    g_string_append(basedir, "/");
     g_string_append(basedir, account_dir);
     g_string_append(basedir, "/");
     free(account_dir);
@@ -393,12 +391,11 @@ otr_keygen(ProfAccount *account)
     jid = strdup(account->jid);
     log_info("Generating OTR key for %s", jid);
 
-    gchar *data_home = files_get_xdg_data_home();
-    GString *basedir = g_string_new(data_home);
-    free(data_home);
-
+    char *otrdir = files_get_data_path(DIR_OTR);
+    GString *basedir = g_string_new(otrdir);
+    free(otrdir);
     gchar *account_dir = str_replace(jid, "@", "_at_");
-    g_string_append(basedir, "/profanity/otr/");
+    g_string_append(basedir, "/");
     g_string_append(basedir, account_dir);
     g_string_append(basedir, "/");
     free(account_dir);