mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 20:36:22 +00:00
Flush after chat log writes
This commit is contained in:
@@ -25,26 +25,27 @@
|
|||||||
|
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
|
|
||||||
#include "log.h"
|
#include "chat_log.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static FILE *chatlog;
|
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)
|
void chat_log_init(void)
|
||||||
{
|
{
|
||||||
GString *log_file = g_string_new(getenv("HOME"));
|
GString *log_file = g_string_new(getenv("HOME"));
|
||||||
g_string_append(log_file, "/.profanity/log");
|
g_string_append(log_file, "/.profanity/log");
|
||||||
create_dir(log_file->str);
|
create_dir(log_file->str);
|
||||||
g_string_append(log_file, "/chat.log");
|
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);
|
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)
|
void chat_log_close(void)
|
||||||
{
|
{
|
||||||
fclose(chatlog);
|
fclose(chatlog);
|
||||||
|
|||||||
Reference in New Issue
Block a user