]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-write.c
Quote received messages of ERROR commands in log output
[ngircd-alex.git] / src / ngircd / irc-write.c
index ea0f5f8a288158531e55952212197b360690102e..9b5b5e2185aa2e8a9b1577e5d5b5fa2ee3359bd4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -405,6 +405,53 @@ va_dcl
 } /* IRC_WriteStrRelatedPrefix */
 
 
+/**
+ * Send WALLOPS message.
+ */
+#ifdef PROTOTYPES
+GLOBAL void
+IRC_SendWallops(CLIENT *Client, CLIENT *From, const char *Format, ...)
+#else
+GLOBAL void
+IRC_SendWallops(Client, From, Format, va_alist )
+CLIENT *Client;
+CLIENT *From;
+char *Format;
+va_dcl
+#endif
+{
+       va_list ap;
+       char msg[1000];
+       CLIENT *to;
+
+#ifdef PROTOTYPES
+       va_start(ap, Format);
+#else
+       va_start(ap);
+#endif
+       vsnprintf(msg, 1000, Format, ap);
+       va_end(ap);
+
+       for (to=Client_First(); to != NULL; to=Client_Next(to)) {
+               if (Client_Conn(to) == NONE) /* no local connection */
+                       continue;
+
+               switch (Client_Type(to)) {
+               case CLIENT_USER:
+                       if (Client_HasMode(to, 'w'))
+                               IRC_WriteStrClientPrefix(to, From,
+                                                        "WALLOPS :%s", msg);
+                               break;
+               case CLIENT_SERVER:
+                       if (to != Client)
+                               IRC_WriteStrClientPrefix(to, From,
+                                                        "WALLOPS :%s", msg);
+                               break;
+               }
+       }
+} /* IRC_SendWallops */
+
+
 GLOBAL void
 IRC_SetPenalty( CLIENT *Client, time_t Seconds )
 {