]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-write.c
Introduce new function IRC_WriteErrClient()
[ngircd-alex.git] / src / ngircd / irc-write.c
index 93753564770f3dbdeb32f768d01c0c991959f237..526e2fb694bdf948ccf957f6fafb9a8ca5571d25 100644 (file)
@@ -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.
  *