commit fef99807d57d68ecaa7116d6cae5d062a501fcde
parent 0cdb725e23c6ed50fae62c86b17555a2fadc353d
Author: hhvn <dev@hhvn.uk>
Date: Tue, 26 Oct 2021 23:27:14 +0100
hist.c ui.c: remove error_buf and just use main_buf
Diffstat:
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/hist.c b/hist.c
@@ -65,10 +65,10 @@ hist_add(struct Server *server, struct HistInfo *histinfo, struct Nick *from,
struct History *new, *p;
int i;
- if (options & HIST_MAIN || activity == Activity_error) {
+ if (options & HIST_MAIN) {
if (histinfo->history != main_buf->history)
hist_add(server, main_buf, from, msg, params, activity, timestamp, HIST_SHOW);
- else if (options & HIST_MAIN)
+ else
ui_error("HIST_MAIN specified, but history is &main_buf", NULL);
}
diff --git a/ui.c b/ui.c
@@ -10,7 +10,6 @@
#endif /* TLS */
#include "hirc.h"
-struct HistInfo *error_buf;
struct Window windows[Win_last] = {
[Win_main] = {.handler = NULL},
[Win_input] = {.handler = ui_draw_input},
@@ -33,14 +32,14 @@ ui_error_(char *file, int line, char *format, ...) {
vsnprintf(msg, sizeof(msg), format, ap);
va_end(ap);
- hist_format(NULL, error_buf, Activity_error, HIST_SHOW,
+ hist_format(NULL, main_buf, Activity_error, HIST_SHOW,
"SELF_ERROR %s %d :%s",
file, line, msg);
}
void
ui_perror_(char *file, int line, char *str) {
- hist_format(NULL, error_buf, Activity_error, HIST_SHOW,
+ hist_format(NULL, main_buf, Activity_error, HIST_SHOW,
"SELF_ERROR %s %d :%s: %s",
file, line, str, strerror(errno));
}
@@ -48,14 +47,14 @@ ui_perror_(char *file, int line, char *str) {
#ifdef TLS
void
ui_tls_config_error_(char *file, int line, struct tls_config *config, char *str) {
- hist_format(NULL, error_buf, Activity_error, HIST_SHOW,
+ hist_format(NULL, main_buf, Activity_error, HIST_SHOW,
"SELF_ERROR %s %d :%s: %s",
file, line, str, tls_config_error(config));
}
void
ui_tls_error_(char *file, int line, struct tls *ctx, char *str) {
- hist_format(NULL, error_buf, Activity_error, HIST_SHOW,
+ hist_format(NULL, main_buf, Activity_error, HIST_SHOW,
"SELF_ERROR %s %d :%s: %s",
file, line, str, tls_error(ctx));
}
@@ -73,13 +72,6 @@ ui_init(void) {
memset(input.string, '\0', sizeof(input.string));
input.counter = 0;
- error_buf = emalloc(sizeof(struct HistInfo));
- error_buf->activity = Activity_ignore;
- error_buf->unread = 0;
- error_buf->server = NULL;
- error_buf->channel = NULL;
- error_buf->history = NULL;
-
if (nicklistlocation != 0 && nicklistlocation == buflistlocation) {
ui_error("nicklist and buflist can't be set to same location in config.h", NULL);
windows[Win_buflist].location = LEFT;