about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2017-06-13 23:22:58 +0100
committerJames Booth <boothj5@gmail.com>2017-06-13 23:22:58 +0100
commitb0a989a17f83cb0e755f51641b62c1ffdc409e6c (patch)
tree2561a203ab97ce6e5eb741038a64fe1b539f1ef8
parentbaa1754f60903e6c96e82eeccdefd93c918055e9 (diff)
downloadprofani-tty-b0a989a17f83cb0e755f51641b62c1ffdc409e6c.tar.gz
Recreate chat log when removed
fixes #210
-rw-r--r--src/log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 572999d6..ee5a17de 100644
--- a/src/log.c
+++ b/src/log.c
@@ -360,7 +360,12 @@ _chat_log_chat(const char *const login, const char *const other, const char *con
         dated_log = _create_log(other, login);
         g_hash_table_insert(logs, strdup(other), dated_log);
 
-    // log exists but needs rolling
+    // log entry exists but file removed
+    } else if (!g_file_test(dated_log->filename, G_FILE_TEST_EXISTS)) {
+        dated_log = _create_log(other, login);
+        g_hash_table_replace(logs, strdup(other), dated_log);
+
+    // log file needs rolling
     } else if (_log_roll_needed(dated_log)) {
         dated_log = _create_log(other, login);
         g_hash_table_replace(logs, strdup(other), dated_log);