]> jfr.im git - irc/quakenet/newserv.git/blobdiff - glines/glines_util.c
Update documentation.
[irc/quakenet/newserv.git] / glines / glines_util.c
index 4f6aeb986cca8e3ead004d0c79a46c92204c0650..160e5b2cfa8f40a1faef10888eb7b4da14df6e17 100644 (file)
@@ -1,19 +1,21 @@
 #include "../irc/irc.h"
+#include "../trusts/trusts.h"
 #include "glines.h"
 
 int glinebyip(const char *user, struct irc_in_addr *ip, unsigned char bits, int duration, const char *reason, int flags, const char *creator) {
   glinebuf gbuf;
   int hits;
 
-  glinebufinit(&gbuf, 1);
+  glinebufinit(&gbuf, 0);
+  glinebufcommentf(&gbuf, "on IP mask %s@%s, set by %s", user, CIDRtostr(*ip, bits), creator);
   glinebufaddbyip(&gbuf, user, ip, bits, flags, creator, reason, getnettime() + duration, getnettime(), getnettime() + duration);
 
   glinebufcounthits(&gbuf, &hits, NULL);
 
   if (flags & GLINE_SIMULATE)
-    glinebufabandon(&gbuf);
+    glinebufabort(&gbuf);
   else
-    glinebufflush(&gbuf, 1);
+    glinebufcommit(&gbuf, 1);
 
   return hits;
 }
@@ -22,16 +24,27 @@ int glinebynick(nick *np, int duration, const char *reason, int flags, const cha
   glinebuf gbuf;
   int hits;
 
-  glinebufinit(&gbuf, 1);
+  glinebufinit(&gbuf, 0);
+  glinebufcommentf(&gbuf, "on nick %s!%s@%s, set by %s", np->nick, np->ident, np->host->name->content, creator);
   glinebufaddbynick(&gbuf, np, flags, creator, reason, getnettime() + duration, getnettime(), getnettime() + duration);
 
   glinebufcounthits(&gbuf, &hits, NULL);
 
   if (flags & GLINE_SIMULATE)
-    glinebufabandon(&gbuf);
+    glinebufabort(&gbuf);
   else
-    glinebufflush(&gbuf, 1);
+    glinebufcommit(&gbuf, 1);
 
   return hits;
 }
 
+void glineunsetmask(const char *mask) {
+  gline *gl;
+
+  gl = findgline(mask);
+
+  if (!gl)
+    return;
+
+  gline_deactivate(gl, 0, 1);
+}