]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Return ERR_NOTEXTTOSEND on empty PRIVMSG content
authorValentin Lorentz <progval+git@progval.net>
Sun, 3 Sep 2023 08:05:54 +0000 (10:05 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 17 Sep 2023 20:25:40 +0000 (22:25 +0200)
They are dropped further down the line anyway; and sending ERR_NOTEXTTOSEND
early matches other servers' behavior.

src/ngircd/irc.c

index ba33e5ae334d03786281e4599f31529330f2c295..5cf4fe235b175faafe35867fed26958dec596ea5 100644 (file)
@@ -572,6 +572,13 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 #endif
                message = Req->argv[1];
 
+       if (message[0] == '\0') {
+               if (!SendErrors)
+                       return CONNECTED;
+               return IRC_WriteErrClient(Client, ERR_NOTEXTTOSEND_MSG,
+                                         Client_ID(Client));
+       }
+
        /* handle msgtarget = msgto *("," msgto) */
        currentTarget = strtok_r(currentTarget, ",", &strtok_last);
        ngt_UpperStr(Req->command);