1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Flush after chat log writes

This commit is contained in:
James Booth 2012-07-22 21:19:53 +01:00
parent 83ef1d562c
commit 8e02720a69

View File

@ -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);