summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--litterbox.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/litterbox.c b/litterbox.c
index bb98b3e..0fe8797 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -213,21 +213,13 @@ static struct {
 	size_t cap, len;
 } motd;
 
-static void handleReplyMOTDStart(struct Message *msg) {
-	(void)msg;
-	motd.len = 0;
-	motd.cap = 80;
-	motd.buf = malloc(motd.cap);
-	if (!motd.buf) err(EX_OSERR, "malloc");
-}
-
 static void handleReplyMOTD(struct Message *msg) {
 	require(msg, false, 2);
 	char *line = msg->params[1];
 	if (!strncmp(line, "- ", 2)) line += 2;
 	size_t len = strlen(line);
 	if (motd.len + len + 1 > motd.cap) {
-		motd.cap *= 2;
+		motd.cap = (motd.cap ? motd.cap * 2 : len + 1);
 		motd.buf = realloc(motd.buf, motd.cap);
 		if (!motd.buf) err(EX_OSERR, "realloc");
 	}
@@ -674,7 +666,6 @@ static const struct Handler {
 	{ "332", true, handleReplyTopic },
 	{ "353", true, handleReplyNames },
 	{ "372", false, handleReplyMOTD },
-	{ "375", false, handleReplyMOTDStart },
 	{ "376", true, handleReplyEndOfMOTD },
 	{ "900", false, handleReplyLoggedIn },
 	{ "904", false, handleErrorSASLFail },
30e6381ce69402607e5c240f97b471b&follow=1'>Remove rc scriptsJune McEnroe 2020-08-27contrib/palaver: Fix documented database pathJune McEnroe 2020-08-27contrib/palaver: Remove rc scriptJune McEnroe 2020-08-27contrib/palaver: Fix database search and creationJune McEnroe 2020-08-27contrib/palaver: Use pounce's XDG directoryJune McEnroe 2020-08-27contrib/palaver: Only allow HTTPSJune McEnroe 2020-08-25Support the pounce_env rc variableJune McEnroe 2020-08-25Remove deprecated option namesJune McEnroe 2020-08-25Document configuration and data file searchJune McEnroe 2020-08-24Use dataOpen for save fileJune McEnroe 2020-08-24Use configOpen to load localCAJune McEnroe 2020-08-24Use configPath to load client cert/privJune McEnroe 2020-08-24Use configOpen in getopt_configJune McEnroe 2020-08-24Import xdg.c from catgirlJune McEnroe 2020-08-23Replace “RAND_bytes” by “getentropy”Issam E. Maghni 2020-08-16contrib/palaver: Add no message preview flagsJune McEnroe 2020-08-13contrib/palaver: Don't set channel for PMsJune McEnroe 2020-08-13Fix unintended interception of NICK after registrationJune McEnroe 2020-08-12Add Additional Components section to READMEJune McEnroe 2020-08-12Document -L / palaver optionJune McEnroe 2020-08-11contrib/palaver: Document service configurationJune McEnroe 2020-08-11contrib/palaver: Add install target and rc scriptJune McEnroe 2020-08-11contrib/palaver: Implement command and notificationsJune McEnroe