about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-07-23 01:35:47 +0100
committerJames Booth <boothj5@gmail.com>2012-07-23 01:35:47 +0100
commit6bbad269db9fbce40676966c745506f6c3a72d7d (patch)
tree4a478520c8cec2a6bee81bf84feab5e6c14dcef8 /src
parent4dcec36ef328cd1d2ee0b23fc46607db13091d59 (diff)
downloadprofani-tty-6bbad269db9fbce40676966c745506f6c3a72d7d.tar.gz
Removed @ from log file names
Diffstat (limited to 'src')
-rw-r--r--src/chat_log.c9
-rw-r--r--src/util.c3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/chat_log.c b/src/chat_log.c
index 62e88a8f..e8ec54b9 100644
--- a/src/chat_log.c
+++ b/src/chat_log.c
@@ -27,6 +27,7 @@
 
 #include "chat_log.h"
 #include "common.h"
+#include "util.h"
 
 static GHashTable *logs;
 static GTimeZone *tz;
@@ -51,11 +52,15 @@ void chat_log_chat(const char * const login, char *other,
         g_string_append(log_file, "/.profanity/log");
         create_dir(log_file->str);
     
-        g_string_append_printf(log_file, "/%s", login);
+        char *login_dir = str_replace(login, "@", "_at_");
+        g_string_append_printf(log_file, "/%s", login_dir);
         create_dir(log_file->str);
+        free(login_dir);
 
-        g_string_append_printf(log_file, "/%s.log", other);
+        char *other_file = str_replace(other, "@", "_at_");
+        g_string_append_printf(log_file, "/%s.log", other_file);
         logp = fopen(log_file->str, "a");
+        free(other_file);
     
         g_string_free(log_file, TRUE);
         g_hash_table_insert(logs, other, logp);
diff --git a/src/util.c b/src/util.c
index 909d4d39..340517d7 100644
--- a/src/util.c
+++ b/src/util.c
@@ -37,7 +37,8 @@ void get_time(char *thetime)
 }
 
 char * str_replace (const char *string, const char *substr, 
-    const char *replacement) {
+    const char *replacement) 
+{
     char *tok = NULL;
     char *newstr = NULL;
     char *oldstr = NULL;