commit 6fdf124570308d98a24afec8601ee49bc1949a62
parent 5f6ef1cc97a507a0b8da260bb7cf290fd8b415f6
Author: hhvn <dev@hhvn.uk>
Date: Sun, 28 Nov 2021 22:06:54 +0000
handle.c hirc.h config.c: don't set server->expect if conf is being read
Diffstat:
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/config.c b/config.c
@@ -6,6 +6,8 @@
#include <errno.h>
#include "hirc.h"
+int readingconf = 0;
+
static int config_nicklist_location(long num);
static int config_nicklist_width(long num);
static int config_buflist_location(long num);
@@ -374,9 +376,11 @@ config_read(char *filename) {
return;
}
+ readingconf = 1;
while (read_line(fileno(file), buf, sizeof(buf)))
if (*buf == '/')
command_eval(buf);
+ readingconf = 0;
}
static int
diff --git a/handle.c b/handle.c
@@ -458,7 +458,7 @@ handle_RPL_ENDOFMOTD(char *msg, char **params, struct Server *server, time_t tim
* Also, it might be better to have an enum for all commands and numerics somewhere */
void
handle_expect(struct Server *server, enum Expect cmd, char *about) {
- if (cmd >= Expect_last || cmd < 0)
+ if (cmd >= Expect_last || cmd < 0 || readingconf)
return;
free(server->expect[cmd]);
diff --git a/hirc.h b/hirc.h
@@ -151,6 +151,7 @@ extern int uineedredraw;
/* config.c */
extern struct Config config[];
+extern int readingconf;
/* commands.c */
extern struct Command commands[];