]> jfr.im git - irc/quakenet/newserv.git/blobdiff - glines/glines_handler.c
GLINES: fix compiler warnings
[irc/quakenet/newserv.git] / glines / glines_handler.c
index 61f7d528236fd27c8c596d46afd51b326e6727ab..a1c7b337a879939b39ff6bed4d1facfa698d86a9 100644 (file)
@@ -3,6 +3,14 @@
 #include "../localuser/localuserchannel.h"
 #include "glines.h"
 
+//#define DEBUG
+
+#ifdef DEBUG
+#define Debug(...) Error("debuggline", ERR_DEBUG, ##__VA_ARGS__)
+#else
+#define Debug(...)
+#endif
+
 /*
   <prefix> GL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>] [<lifetime>] [:<reason>]
 */
@@ -60,7 +68,7 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
           Error("gline", ERR_WARNING, "Received gline from non-existant server");
           return CMD_ERROR; 
         } else {
-          creator = serverlist[(int)creatornum].name->content, HOSTLEN;
+          creator = serverlist[(int)creatornum].name->content;
         }
       break;
     case 5:
@@ -130,12 +138,12 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
          return CMD_ERROR;
     }
 
-    Error("debuggline", ERR_WARNING, "GL Received: Creator %s, Mask %s, Reason %s, Expire %lu, Lastmod %lu, Lifetime %lu", creator, mask, reason, expire, lastmod, lifetime);   
+    Debug("GL Received: Creator %s, Mask %s, Reason %s, Expire %lu, Lastmod %lu, Lifetime %lu", creator, mask, reason, expire, lastmod, lifetime);   
 
     agline = findgline(mask);
 
     if (agline) {
-      Error("debuggline", ERR_WARNING, "Update for existing gline received for %s - old lastmod %lu, expire %lu, lifetime %lu, reason %s, creator %s", mask, agline->lastmod, agline->expire, agline->lifetime, agline->reason->content, agline->creator->content);
+      Debug("Update for existing gline received for %s - old lastmod %lu, expire %lu, lifetime %lu, reason %s, creator %s", mask, agline->lastmod, agline->expire, agline->lifetime, agline->reason ? agline->reason->content : "", agline->creator->content);
 
       agline->flags |= GLINE_ACTIVE;
 
@@ -149,7 +157,7 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
         freesstring(agline->reason);
         agline->reason = getsstring(reason, 255); 
       } else {
-        Error("debuggline", ERR_WARNING, "received a gline with a lower lastmod");
+        Debug("received a gline with a lower lastmod");
         /* Don't send our gline as that might cause loops in case we don't understand the gline properly. */
       } 
 
@@ -196,13 +204,11 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
 
       return CMD_OK;
     } else {
+       if (cargc < 5)
+         return CMD_OK; /* U:lined gline, we're done */
        Error("gline", ERR_WARNING, "Gline addition - adding deactivated gline - mask not found (%s)", mask);
        expire = abs_expire(atoi(cargv[2]));
        switch (cargc) {
-         case 4:
-           /* asuka U:d, no lastmod */
-           reason = cargv[3];
-           break;
          case 5:
            /*asuka lastmod */
            lastmod = atoi(cargv[3]);
@@ -252,12 +258,12 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
         freesstring(agline->reason);
         agline->reason = getsstring(reason, 255);
       } else {
-        Error("debuggline", ERR_WARNING, "received a gline modification with a lower lastmod");
+        Debug("received a gline modification with a lower lastmod");
       }
 
       return CMD_OK;
     } else {
-      Error("gline", ERR_WARNING, "Received modification for G-Line that does not exist for mask %s", mask);
+      Debug("Received modification for G-Line that does not exist for mask %s", mask);
       return CMD_ERROR;
     }
   }