]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Properly check for the SNIRCD_VERSION macro.
authorGunnar Beutner <redacted>
Tue, 16 Jul 2013 15:20:33 +0000 (17:20 +0200)
committerGunnar Beutner <redacted>
Tue, 16 Jul 2013 15:20:33 +0000 (17:20 +0200)
--HG--
branch : shroudtrusts

glines/glines.c
glines/glines_buf.c
glines/glines_commands.c
glines/glines_handler.c

index cf85c51f0dfbb34f61f2fdfe8ac27c0d68dfb1db..7e7b3c541e83431be1e50134874e9fa792aebbaa 100644 (file)
@@ -163,7 +163,14 @@ void gline_propagate(gline *agline) {
     return;
   }
 
+#if SNIRCD_VERSION >= 140
+#error TODO: implement 6 parameter glines for snircd >=1.4.0
+#endif /* SNIRCD_VERSION */
+
   if (agline->flags & GLINE_DESTROYED) {
+#if SNIRCD_VERSION < 135
+    controlwall(NO_OPER, NL_GLINES, "Tried to destroy G-Line on '%s' however SNIRCD_VERSION is too old.", glinetostring(agline));
+#else
     controlwall(NO_OPER, NL_GLINES, "Destroying G-Line on '%s' lasting %s with reason '%s', created by: %s",
       glinetostring(agline), longtoduration(agline->expire-getnettime(), 0),
       agline->reason->content, agline->creator->content);
@@ -177,6 +184,7 @@ void gline_propagate(gline *agline) {
       glinetostring(agline), agline->expire - getnettime(),
       agline->lastmod, agline->reason->content);
 #endif
+#endif /* SNIRCD_VERSION */
   } else if (agline->flags & GLINE_ACTIVE) {
     controlwall(NO_OPER, NL_GLINES, "Activating G-Line on '%s' lasting %s created by %s with reason '%s'",
       glinetostring(agline), longtoduration(agline->expire-getnettime(), 0),
index 12a5045d2214d5c6fb805190d085c757faa8c9f1..d00ee34f8e535f55ab3ea01898295b092884e205 100644 (file)
@@ -232,6 +232,16 @@ void glinebufflush(glinebuf *gbuf, int propagate) {
       else if (!(gl->flags & GLINE_ACTIVE) && sgl->flags & GLINE_ACTIVE)
         gline_deactivate(sgl, 0, 0);
 
+#if SNIRCD_VERSION >= 140
+      sgl->expire = gl->expire;
+
+      if (gl->lifetime > sgl->lifetime) 
+        sgl->lifetime = gl->lifetime;
+
+      freesstring(sgl->reason);
+      sgl->reason = getsstring(gl->reason, 512);
+#endif
+
       freegline(gl);
       gl = sgl;
     } else {
index b9ee5fd73577a700529e2a54b2963cca194ba74d..efc78b97d6181dbc264517764029a5ba30b53ddd 100644 (file)
@@ -124,7 +124,7 @@ static int glines_cmdgline(void *source, int cargc, char **cargv) {
   glinebuf gbuf;
 #if SNIRCD_VERSION < 140
   gline *gl;
-#endif
+#endif /* SNIRCD_VERSION */
 
   if (cargc < 1)
     return CMD_USAGE;
@@ -159,7 +159,7 @@ static int glines_cmdgline(void *source, int cargc, char **cargv) {
 
     controlreply(sender, "Reactivating existing gline on %s", mask);
   }
-#endif
+#endif /* SNIRCD_VERSION */
 
   if (sender->auth)
     snprintf(creator, sizeof(creator), "#%s", sender->authname);
index 45d2476fb8b0369092442eb7037649f1959a24f0..54e8652b788bca882e4647b87414419d3c93c294 100644 (file)
@@ -80,7 +80,6 @@ int handleglinemsg(void *source, int cargc, char **cargv) {
   /* 2nd param is mask */
   mask = cargv[1];
 
-  /* snircd 1.3.5 can destroy glines, no #if here */
   if (*mask == '%') {
     flags |= GLINE_DESTROY;
     mask++;