X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Firc-write.c;h=526e2fb694bdf948ccf957f6fafb9a8ca5571d25;hp=93753564770f3dbdeb32f768d01c0c991959f237;hb=904c8a4375cb9deed64007b06c6a7ba42313d93d;hpb=b86e33ef4945e21078b2c1f37a5d276e615450ee diff --git a/src/ngircd/irc-write.c b/src/ngircd/irc-write.c index 93753564..526e2fb6 100644 --- a/src/ngircd/irc-write.c +++ b/src/ngircd/irc-write.c @@ -41,6 +41,43 @@ static void cb_writeStrServersPrefixFlag PARAMS((CLIENT *Client, CLIENT *Prefix, void *Buffer)); static void Send_Marked_Connections PARAMS((CLIENT *Prefix, const char *Buffer)); +/** + * Send an error message to a client and enforce a penalty time. + * + * @param Client The target client. + * @param Format Format string. + * @return CONNECTED or DISCONNECTED. + */ +#ifdef PROTOTYPES +GLOBAL bool +IRC_WriteErrClient( CLIENT *Client, const char *Format, ... ) +#else +GLOBAL bool +IRC_WriteErrClient( Client, Format, va_alist ) +CLIENT *Client; +const char *Format; +va_dcl +#endif +{ + char buffer[1000]; + va_list ap; + + assert(Client != NULL); + assert(Format != NULL); + +#ifdef PROTOTYPES + va_start(ap, Format); +#else + va_start(ap); +#endif + vsnprintf(buffer, 1000, Format, ap); + va_end(ap); + + IRC_SetPenalty(Client, 2); + return IRC_WriteStrClientPrefix(Client, Client_ThisServer(), + "%s", buffer); +} + /** * Send a message to a client. *