]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Send error messages about failed glines to the user rather than controllwalling them.
authorGunnar Beutner <redacted>
Tue, 16 Jul 2013 14:39:02 +0000 (16:39 +0200)
committerGunnar Beutner <redacted>
Tue, 16 Jul 2013 14:39:02 +0000 (16:39 +0200)
--HG--
branch : shroudtrusts

glines/glines.h
glines/glines_buf.c
glines/glines_commands.c

index a5c7a72417efb3441bf12657ad03dfd356dce11a..6f6dad6f7d7e1220ba3d9ed4138b1c6d53ed83cd 100644 (file)
@@ -109,8 +109,8 @@ gline *glinebufadd(glinebuf *gbuf, const char *mask, const char *creator, const
 void glinebufaddbyip(glinebuf *gbuf, const char *user, struct irc_in_addr *ip, unsigned char bits, int flags, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime);
 void glinebufaddbynick(glinebuf *gbuf, nick *, int flags, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime);
 void glinebufcounthits(glinebuf *gbuf, int *users, int *channels);
-int glinebufsanitize(glinebuf *gbuf);
-void glinebufspew(glinebuf *gbuf, nick *np);
+int glinebufsanitize(glinebuf *gbuf, nick *spewto);
+void glinebufspew(glinebuf *gbuf, nick *spewto);
 void glinebufflush(glinebuf *gbuf, int propagate);
 void glinebufabandon(glinebuf *gbuf);
 
index 1a867d3d5db138589e265e6e13e4f5fc9e8b2576..802b9bf94543dba1a69db428794881a8d1905000 100644 (file)
@@ -156,7 +156,7 @@ void glinebufcounthits(glinebuf *gbuf, int *users, int *channels) {
   }
 }
 
-int glinebufsanitize(glinebuf *gbuf) {
+int glinebufsanitize(glinebuf *gbuf, nick *spewto) {
   gline *gl, **pnext;
   int skipped;
   const char *hint;
@@ -168,9 +168,14 @@ int glinebufsanitize(glinebuf *gbuf) {
     gl = *pnext;
 
     if (!isglinesane(gl, &hint)) {
-      controlwall(NO_OPER, NL_GLINES, "Sanity check failed for G-Line on '%s' lasting %s created by %s with reason '%s' - Skipping: %s",
-        glinetostring(gl), longtoduration(gl->expire-getnettime(), 0),
-        gl->reason->content, gl->creator->content, hint);
+      if (spewto) {
+        controlreply(spewto, "Sanity check failed for G-Line on '%s' - Skipping: %s",
+          glinetostring(gl), hint);
+      } else {
+        controlwall(NO_OPER, NL_GLINES, "Sanity check failed for G-Line on '%s' lasting %s created by %s with reason '%s' - Skipping: %s",
+          glinetostring(gl), longtoduration(gl->expire-getnettime(), 0),
+          gl->reason->content, gl->creator->content, hint);
+      }
 
       *pnext = gl->next;
       freegline(gl);
@@ -185,11 +190,11 @@ int glinebufsanitize(glinebuf *gbuf) {
   return skipped;
 }
 
-void glinebufspew(glinebuf *gbuf, nick *np) {
+void glinebufspew(glinebuf *gbuf, nick *spewto) {
   gline *gl;
 
   for (gl = gbuf->head; gl; gl = gl->next)
-    controlreply(np, "mask: %s", glinetostring(gl));
+    controlreply(spewto, "mask: %s", glinetostring(gl));
 }
 
 void glinebufflush(glinebuf *gbuf, int propagate) {
index ebbec6bd0f3111cdd8cc5e9dcbc4af6657358c8b..8f27d1f6b152dc6ef3c7bcc2f1dd9033a0713c54 100644 (file)
@@ -173,7 +173,7 @@ static int glines_cmdgline(void *source, int cargc, char **cargv) {
     }
   }
 
-  if (sanitychecks && glinebufsanitize(&gbuf) > 0) {
+  if (sanitychecks && glinebufsanitize(&gbuf, sender) > 0) {
     glinebufabandon(&gbuf);
     controlreply(sender, "G-Line failed sanity checks. Not setting G-Line.");
     return CMD_ERROR;