From 99711a5c6ea6ea34109ab4b661db3890337df234 Mon Sep 17 00:00:00 2001 From: Felix Brucker Date: Tue, 2 Oct 2018 21:08:13 +0200 Subject: [PATCH] Allow many large messages --- src/plugins/mod_chat_history_sqlite.c | 2 +- src/util/cbuffer.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/mod_chat_history_sqlite.c b/src/plugins/mod_chat_history_sqlite.c index 131861b..d2f5814 100644 --- a/src/plugins/mod_chat_history_sqlite.c +++ b/src/plugins/mod_chat_history_sqlite.c @@ -26,7 +26,7 @@ #include "util/list.h" #include "util/cbuffer.h" -#define MAX_HISTORY_SIZE 16384 +#define MAX_HISTORY_SIZE 614400 struct chat_history_data { diff --git a/src/util/cbuffer.c b/src/util/cbuffer.c index 2962269..642a42d 100644 --- a/src/util/cbuffer.c +++ b/src/util/cbuffer.c @@ -20,6 +20,7 @@ #include "uhub.h" #define CBUF_FLAG_CONST_BUFFER 0x01 +#define MAX_MSG_LEN 16384 struct cbuffer { @@ -86,19 +87,19 @@ void cbuf_append(struct cbuffer* buf, const char* msg) void cbuf_append_format(struct cbuffer* buf, const char* format, ...) { - static char tmp[1024]; + static char tmp[MAX_MSG_LEN]; va_list args; int bytes; uhub_assert(buf->flags == 0); va_start(args, format); - bytes = vsnprintf(tmp, 1024, format, args); + bytes = vsnprintf(tmp, sizeof(tmp), format, args); va_end(args); cbuf_append_bytes(buf, tmp, bytes); } void cbuf_append_strftime(struct cbuffer* buf, const char* format, const struct tm* tm) { - static char tmp[1024]; + static char tmp[MAX_MSG_LEN]; int bytes; uhub_assert(buf->flags == 0); bytes = strftime(tmp, sizeof(tmp), format, tm);