]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blobdiff - glinesnomask.patch
welcome: do not call welcome_insert on last local/global entry and when not set yet
[irc/quakenet/snircd-patchqueue.git] / glinesnomask.patch
index f970e80f29de6d4b14841f1fdf015a29a1cf2541..1c55883e12c1717ab611185e4cba9520a6e515b8 100644 (file)
@@ -1,96 +1,68 @@
-SNO_GLINE and SNO_AUTO
-before, glines with reason starting with "AUTO" end up in SNO_AUTO, all other in SNO_GLINE
-now
-/* figure out what snomask to send to, send to SNO_GLINE when:
-*  source is a user and is not on a service server
-*  gline is local, a badchan, or a realname gline
-*  duration is either 120 seconds or less, or 2 weeks or more
-*  nick part is not equal to *
-*  the gline is wide
-* otherwise, send to SNO_AUTO
-*/
+use snomask SNO_GLINE when oper is the source of the GLINE message, else use SNO_AUTO
 
-diff -r 16b56cea76d8 ircd/gline.c
---- a/ircd/gline.c     Sun Jan 11 22:38:40 2009 +0000
-+++ b/ircd/gline.c     Sun Jan 11 22:38:41 2009 +0000
-@@ -209,7 +209,7 @@
-  * @return Zero, unless \a sptr G-lined himself, in which case CPTR_KILLED.
-  */
- static int
--do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
-+do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline, int snomask)
- {
-   struct Client *acptr;
-   int fd, retval = 0, tval;
-@@ -278,7 +278,7 @@
+diff -r 5302f8ba2ea2 ircd/gline.c
+--- a/ircd/gline.c     Thu Mar 25 11:41:07 2010 +0100
++++ b/ircd/gline.c     Thu Mar 25 11:53:55 2010 +0100
+@@ -231,7 +231,7 @@
+         continue;
+       /* let the ops know about it */
+-      sendto_opmask_butone(0, SNO_GLINE, "BADCHAN active for %H", chptr);
++      sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "BADCHAN active for %H", chptr);
+       for (member=chptr->members;member;member=nmember) {
+         nmember=member->next_member;
+@@ -286,7 +286,7 @@
                   gline->gl_reason);
  
          /* let the ops know about it */
 -        sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
-+        sendto_opmask_butone(0, snomask, "G-line active for %s",
++        sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "G-line active for %s",
                               get_client_name(acptr, SHOW_IP));
  
          /* and get rid of him */
-@@ -470,6 +470,7 @@
-   char uhmask[NICKLEN + USERLEN + HOSTLEN + 3];
-   char *nick, *user, *host;
-   int tmp;
-+  int snomask;
-   assert(0 != userhost);
-   assert(0 != reason);
-@@ -543,9 +544,25 @@
+@@ -567,7 +567,7 @@
    /* lifetime is already an absolute timestamp */
  
-+  /* figure out what snomask to send to, send to SNO_GLINE when:
-+   *  source is a user and is not on a service server
-+   *  gline is local, a badchan, or a realname gline
-+   *  duration is either 120 seconds or less, or 2 weeks or more
-+   *  nick part is not equal to *
-+   *  the gline is wide
-+   * otherwise, send to SNO_AUTO   
-+   */
-+  if ((IsUser(sptr) && !IsService(cli_user(sptr)->server)) ||
-+       (flags & (GLINE_LOCAL|GLINE_BADCHAN|GLINE_REALNAME)) ||
-+       ((expire - CurrentTime <= 120) || (expire - CurrentTime >= 1209600)) ||
-+       !(nick[0] == '*' && nick[1] == '\0') ||
-+       (gline_checkmask(host) != CHECK_APPROVED))
-+    snomask = SNO_GLINE;
-+  else
-+    snomask = SNO_AUTO;
-+
    /* Inform ops... */
 -  sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
--                       SNO_AUTO, "%s adding %s %s for %s%s%s%s%s, expiring at "
-+  sendto_opmask_butone(0, snomask, "%s adding %s %s for %s%s%s%s%s, expiring at "
++  sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE :
+                        SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at "
                         "%Tu: %s",
                         (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
-                          cli_name(sptr) :
-@@ -581,7 +598,7 @@
-   gline_propagate(cptr, sptr, agline);
+@@ -643,7 +643,7 @@
+     return 0; /* was active to begin with */
  
--  return do_gline(cptr, sptr, agline); /* knock off users if necessary */
-+  return do_gline(cptr, sptr, agline, snomask); /* knock off users if necessary */
- }
- /** Activate a currently inactive G-line.
-@@ -644,7 +661,7 @@
-   if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
-     gline_propagate(cptr, sptr, gline);
--  return do_gline(cptr, sptr, gline);
-+  return do_gline(cptr, sptr, gline, SNO_GLINE);
- }
+   /* Inform ops and log it */
+-  sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
++  sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "%s activating global %s for %s%s%s%s%s, "
+                        "expiring at %Tu: %s",
+                        (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
+                          get_client_name_and_opername(sptr) :
+@@ -716,7 +716,7 @@
+   }
  
- /** Deactivate a G-line.
-@@ -928,7 +945,7 @@
-                         gline->gl_lifetime, gline->gl_reason);
+   /* Inform ops and log it */
+-  sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
++  sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
+                      "%s",
+                        (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
+                          get_client_name_and_opername(sptr) :
+@@ -921,7 +921,7 @@
+   }
  
-   /* OK, let's do the G-line... */
--  return do_gline(cptr, sptr, gline);
-+  return do_gline(cptr, sptr, gline, SNO_GLINE);
- }
+   /* All right, inform ops... */
+-  sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s",
++  sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "%s modifying global %s for %s%s%s%s%s:%s",
+                      (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
+                      get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
+                      GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+@@ -968,7 +968,7 @@
+   assert(GlineIsLocal(gline));
  
- /** Destroy a local G-line.
+   /* Inform ops and log it */
+-  sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
++  sendto_opmask_butone(0, IsUser(sptr) ? SNO_GLINE : SNO_AUTO, "%s removing local %s for %s%s%s%s%s",
+                      (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
+                      get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
+                      GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",