about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-07-22 21:19:53 +0100
committerJames Booth <boothj5@gmail.com>2012-07-22 21:19:53 +0100
commit8e02720a69ab38977ab35cd0768bd04e5d97909c (patch)
tree92e2a6a766d75cea52a52eaae18000a2bac9cd8f /src
parent83ef1d562c0c8fa4148193c46bbc7f519c80badc (diff)
downloadprofani-tty-8e02720a69ab38977ab35cd0768bd04e5d97909c.tar.gz
Flush after chat log writes
Diffstat (limited to 'src')
-rw-r--r--src/chat_log.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/chat_log.c b/src/chat_log.c
index 3e685a96..89681924 100644
--- a/src/chat_log.c
+++ b/src/chat_log.c
@@ -25,26 +25,27 @@
 
 #include "glib.h"
 
-#include "log.h"
+#include "chat_log.h"
 #include "common.h"
 
 static FILE *chatlog;
 
-void chat_log_chat(const char * const user, const char * const msg)
-{
-    fprintf(chatlog, "%s: %s\n", user, msg);
-}
-
 void chat_log_init(void)
 {
     GString *log_file = g_string_new(getenv("HOME"));
     g_string_append(log_file, "/.profanity/log");
     create_dir(log_file->str);
     g_string_append(log_file, "/chat.log");
-    logp = fopen(log_file->str, "a");
+    chatlog = fopen(log_file->str, "a");
     g_string_free(log_file, TRUE);
 }
 
+void chat_log_chat(const char * const user, const char * const msg)
+{
+    fprintf(chatlog, "%s: %s\n", user, msg);
+    fflush(chatlog);
+}
+
 void chat_log_close(void)
 {
     fclose(chatlog);