-SNO_GLINE and SNO_AUTO
+use snomask SNO_GLINE when oper is the source of the GLINE message, else use SNO_AUTO
-Add = mask prefix to glines to be used by services
-so their gline actions end up in SNO_AUTO,
-freeing SNO_GLINE from spam
-
-Services can do add this prefix before the mask for
-automated hits, but not add them for glines manually
-set by an oper on the service.
-
-<source> GL <target> [=][!][+-<>]<mask> ..
-
-Oper is not allowed to use = prefix in /GLINE,
-as that would be cheating :-)
-
-*** important ***
-This prefix must not be used until the entire network
-and services are upgraded to handle it!
-
-diff -r a9d96ac08a2c include/gline.h
---- a/include/gline.h Fri Jan 30 18:28:17 2009 +0100
-+++ b/include/gline.h Fri Jan 30 18:52:10 2009 +0100
-@@ -88,8 +88,10 @@
- #define GLINE_LIFETIME 0x2000 /**< Record lifetime update */
- #define GLINE_REASON 0x4000 /**< Reason update */
-
-+#define GLINE_AUTO 0x8000 /**< G-line set auto by service */
-+
- /** Controllable flags that can be set on an actual G-line. */
--#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME)
-+#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME | GLINE_AUTO)
- /** Mask for G-line activity flags. */
- #define GLINE_ACTMASK (GLINE_ACTIVE | GLINE_LDEACT)
-
-@@ -110,6 +112,8 @@
- #define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN)
- /** Test whether \a g is local to this server. */
- #define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
-+/** Test whether \a g is auto set by service */
-+#define GlineIsAuto(g) ((g)->gl_flags & GLINE_AUTO)
-
- /** Return nick mask of a G-line. */
- #define GlineNick(g) ((g)->gl_nick)
-diff -r a9d96ac08a2c ircd/gline.c
---- a/ircd/gline.c Fri Jan 30 18:28:17 2009 +0100
-+++ b/ircd/gline.c Fri Jan 30 18:52:10 2009 +0100
-@@ -278,7 +278,7 @@
+diff -r 3ef00ebe95e6 ircd/gline.c
+--- a/ircd/gline.c Sat Jul 20 14:58:23 2013 +0100
++++ b/ircd/gline.c Sat Jul 20 15:02:35 2013 +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, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE, "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 */
-@@ -378,7 +378,8 @@
- return 0;
-
- assert(gline->gl_lastmod);
-- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ GlineIsAuto(gline) ? "=" : "",
- GlineIsRemActive(gline) ? '+' : '-',
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
-@@ -555,8 +556,8 @@
+@@ -576,7 +576,7 @@
/* lifetime is already an absolute timestamp */
/* 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, (flags & GLINE_AUTO) ? SNO_AUTO : SNO_GLINE,
-+ "%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) :
-@@ -630,7 +631,8 @@
+@@ -652,7 +652,7 @@
return 0; /* was active to begin with */
/* 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, GlineIsAuto(gline) ? SNO_AUTO : 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)) ?
- cli_name(sptr) :
-@@ -756,7 +758,8 @@
- lifetime = expire;
+ get_client_name_and_opername(sptr) :
+@@ -725,7 +725,7 @@
+ }
/* Inform ops and log it */
-- sendto_opmask_butone(0, SNO_GLINE, "%s %s GLINE for %s, expiring at %Tu",
-+ sendto_opmask_butone(0, (flags & GLINE_AUTO) ? SNO_AUTO : SNO_GLINE,
-+ "%s %s GLINE for %s, expiring at %Tu",
+- 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)) ?
- cli_name(sptr) : cli_name((cli_user(sptr))->server),
- msg, userhost, expire + TSoffset);
-@@ -765,7 +768,8 @@
- "%#C %s GLINE for %s, expiring at %Tu", sptr, msg, userhost,
- expire);
-
-- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* -%s %Tu %Tu %Tu",
-+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s-%s %Tu %Tu %Tu",
-+ (flags & GLINE_AUTO) ? "=" : "",
- userhost, expire, lastmod, lifetime);
-
- return 0;
-@@ -912,6 +916,12 @@
- break;
- }
-
-+ /* Handle the change of auto or manual G-line */
-+ if ((flags & GLINE_AUTO) && !GlineIsAuto(gline))
-+ gline->gl_flags |= GLINE_AUTO; /* mark as auto */
-+ else if (!(flags & GLINE_AUTO) && GlineIsAuto(gline))
-+ gline->gl_flags &= ~GLINE_AUTO; /* mark as manual */
-+
- /* Handle expiration changes... */
- if (flags & GLINE_EXPIRE) {
- gline->gl_expire = expire; /* save new expiration time */
-@@ -944,7 +954,8 @@
- }
+ get_client_name_and_opername(sptr) :
+@@ -932,7 +932,7 @@
/* 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, flags & GLINE_AUTO ? SNO_GLINE : SNO_GLINE,
-+ "%s modifying global %s for %s%s%s%s%s:%s",
+ non_auto = non_auto || ircd_strncmp(gline->gl_reason, "AUTO", 4);
+- sendto_opmask_butone(0, non_auto ? SNO_GLINE : SNO_AUTO,
++ 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)) ?
- cli_name(sptr) : cli_name((cli_user(sptr))->server),
- GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-@@ -965,7 +976,8 @@
- */
- if (action != GLINE_LOCAL_ACTIVATE && action != GLINE_LOCAL_DEACTIVATE)
- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
-- "* %s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ "* %s%s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ (flags & GLINE_AUTO) ? "=" : "",
- flags & GLINE_OPERFORCE ? "!" : "", op,
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
-@@ -1179,8 +1191,9 @@
-
- gliter(GlobalGlineList, gline, sgline) {
- if (!GlineIsLocal(gline) && gline->gl_lastmod)
-- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
-- GlineIsRemActive(gline) ? '+' : '-',
-+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ GlineIsAuto(gline) ? "=" : "",
-+ GlineIsRemActive(gline) ? '+' : '-',
- gline->gl_nick ? gline->gl_nick : "",
- gline->gl_nick ? "!" : "",
- gline->gl_user,
-@@ -1192,7 +1205,8 @@
-
- gliter(BadChanGlineList, gline, sgline) {
- if (!GlineIsLocal(gline) && gline->gl_lastmod)
-- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s %Tu %Tu %Tu :%s",
-+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s %Tu %Tu %Tu :%s",
-+ GlineIsAuto(gline) ? "=" : "",
- GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
- gline->gl_expire - CurrentTime, gline->gl_lastmod,
- gline->gl_lifetime, gline->gl_reason);
-@@ -1210,7 +1224,8 @@
- if (GlineIsLocal(gline) || !gline->gl_lastmod)
- return 0;
-
-- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
-+ GlineIsAuto(gline) ? "=" : "",
- GlineIsRemActive(gline) ? '+' : '-',
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
- GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
-@@ -1249,6 +1264,7 @@
- gline->gl_expire + TSoffset, gline->gl_lastmod,
- gline->gl_lifetime + TSoffset,
- GlineIsLocal(gline) ? cli_name(&me) : "*",
-+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
- gline->gl_state == GLOCAL_ACTIVATED ? ">" :
- (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
- GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
-@@ -1263,6 +1279,7 @@
- gline->gl_expire + TSoffset, gline->gl_lastmod,
- gline->gl_lifetime + TSoffset,
- GlineIsLocal(gline) ? cli_name(&me) : "*",
-+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
- gline->gl_state == GLOCAL_ACTIVATED ? ">" :
- (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
- GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
-@@ -1273,6 +1290,7 @@
- gline->gl_expire + TSoffset, gline->gl_lastmod,
- gline->gl_lifetime + TSoffset,
- GlineIsLocal(gline) ? cli_name(&me) : "*",
-+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
- gline->gl_state == GLOCAL_ACTIVATED ? ">" :
- (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
- GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
-@@ -1308,6 +1326,7 @@
- gline->gl_host ? gline->gl_host : "",
- gline->gl_expire + TSoffset, gline->gl_lastmod,
- gline->gl_lifetime + TSoffset,
-+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
- gline->gl_state == GLOCAL_ACTIVATED ? ">" :
- (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
- GlineIsRemActive(gline) ? '+' : '-',
-@@ -1318,6 +1337,7 @@
- send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user, "", "", "", "",
- gline->gl_expire + TSoffset, gline->gl_lastmod,
- gline->gl_lifetime + TSoffset,
-+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
- gline->gl_state == GLOCAL_ACTIVATED ? ">" :
- (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
- GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
-diff -r a9d96ac08a2c ircd/m_gline.c
---- a/ircd/m_gline.c Fri Jan 30 18:28:17 2009 +0100
-+++ b/ircd/m_gline.c Fri Jan 30 18:52:10 2009 +0100
-@@ -140,6 +140,11 @@
- if (IsServer(sptr))
- flags |= GLINE_FORCE;
+ get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
+@@ -980,7 +980,7 @@
+ assert(GlineIsLocal(gline));
-+ if (*mask == '=') {
-+ mask++;
-+ flags |= GLINE_AUTO; /* auto G-line action by service */
-+ }
-+
- if (*mask == '!') {
- mask++;
- flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */
-@@ -183,11 +188,14 @@
- if ((action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) &&
- !IsMe(acptr)) {
- Debug((DEBUG_DEBUG, "I am forwarding a local change to a global gline "
-- "to a remote server; target %s, mask %s, operforce %s, action %c",
-- target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
-+ "to a remote server; target %s, mask %s, auto %s, operforce %s, action %c",
-+ target, mask,
-+ flags & GLINE_AUTO ? "YES" : "NO",
-+ flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
-
-- sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
-+ sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s", acptr,
-+ flags & GLINE_AUTO ? "=" : "",
- flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
-
-@@ -226,8 +234,10 @@
-
- /* OK, create the local G-line */
- Debug((DEBUG_DEBUG, "I am creating a local G-line here; target %s, "
-- "mask %s, operforce %s, action %s, expire %Tu, reason: %s",
-- target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
-+ "mask %s, auto %s, operforce %s, action %s, expire %Tu, reason: %s",
-+ target, mask,
-+ flags & GLINE_AUTO ? "YES" : "NO",
-+ flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? "+" : "-", expire, reason));
-
- return gline_add(cptr, sptr, mask, reason, expire, lastmod,
-@@ -239,7 +249,8 @@
-
- /* Let's now destroy the G-line */;
- Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
-- "mask %s, operforce %s, action %s", target, mask,
-+ "mask %s, auto %s, operforce %s, action %s", target, mask,
-+ flags & GLINE_AUTO ? "YES" : "NO",
- flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? "+" : "-"));
-
-@@ -255,14 +266,17 @@
- assert(!IsMe(acptr));
-
- Debug((DEBUG_DEBUG, "I am forwarding a local G-line to a remote server; "
-- "target %s, mask %s, operforce %s, action %c, expire %Tu, "
-+ "target %s, mask %s, auto %s, operforce %s, action %c, expire %Tu, "
- "lastmod %Tu, reason: %s", target, mask,
-+ flags & GLINE_AUTO ? "YES" : "NO",
- flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? '+' : '-', expire, CurrentTime,
- reason));
-
-- sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s",
-- acptr, flags & GLINE_OPERFORCE ? "!" : "",
-+ sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s %Tu %Tu :%s",
-+ acptr,
-+ flags & GLINE_AUTO ? "=" : "",
-+ flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_ACTIVATE ? '+' : '-', mask,
- expire - CurrentTime, CurrentTime, reason);
-
-@@ -323,9 +337,10 @@
- return need_more_params(sptr, "GLINE");
-
- Debug((DEBUG_DEBUG, "I have a global G-line I am acting upon now; "
-- "target %s, mask %s, operforce %s, action %s, expire %Tu, "
-+ "target %s, mask %s, auto %s, operforce %s, action %s, expire %Tu, "
- "lastmod %Tu, lifetime %Tu, reason: %s; gline %s! (fields "
- "present: %s %s %s)", target, mask,
-+ flags & GLINE_AUTO ? "YES" : "NO",
- flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? "+" :
- (action == GLINE_DEACTIVATE ? "-" :
-@@ -353,7 +368,8 @@
- action == GLINE_ACTIVATE ? "activation" : "deactivation"));
-
- /* propagate the G-line, even though we don't have it */
-- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s %Tu",
-+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s %Tu",
-+ flags & GLINE_AUTO ? "=" : "",
- action == GLINE_ACTIVATE ? '+' : '-',
- mask, lastmod);
-
-@@ -389,6 +405,10 @@
- return gline_list(sptr, 0);
- }
-
-+ /* ignore auto prefix from oper */
-+ if (*mask == '=')
-+ mask++;
-+
- if (*mask == '!') {
- mask++;
-
-diff -r a9d96ac08a2c ircd/s_err.c
---- a/ircd/s_err.c Fri Jan 30 18:28:17 2009 +0100
-+++ b/ircd/s_err.c Fri Jan 30 18:52:10 2009 +0100
-@@ -526,7 +526,7 @@
- /* 246 */
- { RPL_STATSTLINE, "%c %s %s", "246" },
- /* 247 */
-- { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%c :%s", "247" },
-+ { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%s%c :%s", "247" },
- /* 248 */
- { RPL_STATSULINE, "U %s", "248" },
- /* 249 */
-@@ -592,7 +592,7 @@
- /* 279 */
- { 0 },
- /* 280 */
-- { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%c :%s", "280" },
-+ { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%s%c :%s", "280" },
- /* 281 */
- { RPL_ENDOFGLIST, ":End of G-line List", "281" },
- /* 282 */
+ /* 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",