From 8e02720a69ab38977ab35cd0768bd04e5d97909c Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Jul 2012 21:19:53 +0100 Subject: Flush after chat log writes --- src/chat_log.c | 15 ++++++++------- 1 file 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); -- cgit 1.4.1-2-gfad0