]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame - glinesnomask.patch
Update patchset for latest ircu changes
[irc/quakenet/snircd-patchqueue.git] / glinesnomask.patch
CommitLineData
715c825d 1SNO_GLINE and SNO_AUTO
12e82c05 2
c5aca5d6 3Add = mask prefix to glines to be used by services
4so their gline actions end up in SNO_AUTO,
5freeing SNO_GLINE from spam
12e82c05 6
c5aca5d6 7Services can do add this prefix before the mask for
8automated hits, but not add them for glines manually
9set by an oper on the service.
715c825d 10
c5aca5d6 11<source> GL <target> [=][!][+-<>]<mask> ..
12
13Oper is not allowed to use = prefix in /GLINE,
14as that would be cheating :-)
15
16*** important ***
17This prefix must not be used until the entire network
18and services are upgraded to handle it!
19
a41348b1 20diff -r 8dcf56ed67b9 include/gline.h
21--- a/include/gline.h Sun Feb 15 15:31:50 2009 +0100
22+++ b/include/gline.h Sun Feb 15 15:59:10 2009 +0100
c5aca5d6 23@@ -88,8 +88,10 @@
24 #define GLINE_LIFETIME 0x2000 /**< Record lifetime update */
25 #define GLINE_REASON 0x4000 /**< Reason update */
26
27+#define GLINE_AUTO 0x8000 /**< G-line set auto by service */
28+
29 /** Controllable flags that can be set on an actual G-line. */
30-#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME)
31+#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME | GLINE_AUTO)
32 /** Mask for G-line activity flags. */
33 #define GLINE_ACTMASK (GLINE_ACTIVE | GLINE_LDEACT)
34
35@@ -110,6 +112,8 @@
36 #define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN)
37 /** Test whether \a g is local to this server. */
38 #define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
39+/** Test whether \a g is auto set by service */
40+#define GlineIsAuto(g) ((g)->gl_flags & GLINE_AUTO)
41
42 /** Return nick mask of a G-line. */
43 #define GlineNick(g) ((g)->gl_nick)
a41348b1 44diff -r 8dcf56ed67b9 ircd/gline.c
45--- a/ircd/gline.c Sun Feb 15 15:31:50 2009 +0100
46+++ b/ircd/gline.c Sun Feb 15 15:59:10 2009 +0100
715c825d
CP
47@@ -278,7 +278,7 @@
48 gline->gl_reason);
49
50 /* let the ops know about it */
51- sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
c5aca5d6 52+ sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE, "G-line active for %s",
715c825d
CP
53 get_client_name(acptr, SHOW_IP));
54
55 /* and get rid of him */
c5aca5d6 56@@ -378,7 +378,8 @@
57 return 0;
715c825d 58
c5aca5d6 59 assert(gline->gl_lastmod);
60- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
61+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
62+ GlineIsAuto(gline) ? "=" : "",
63 GlineIsRemActive(gline) ? '+' : '-',
64 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
65 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
a41348b1 66@@ -555,9 +556,8 @@
715c825d
CP
67 /* lifetime is already an absolute timestamp */
68
715c825d
CP
69 /* Inform ops... */
70- sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
a41348b1 71- SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at "
72- "%Tu: %s",
c5aca5d6 73+ sendto_opmask_butone(0, (flags & GLINE_AUTO) ? SNO_AUTO : SNO_GLINE,
a41348b1 74+ "%s adding %s%s %s for %s%s%s%s%s, expiring at %Tu: %s",
715c825d
CP
75 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
76 cli_name(sptr) :
a41348b1 77 cli_name((cli_user(sptr))->server),
78@@ -631,7 +631,8 @@
c5aca5d6 79 return 0; /* was active to begin with */
80
81 /* Inform ops and log it */
82- sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
83+ sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
84+ "%s activating global %s for %s%s%s%s%s, "
85 "expiring at %Tu: %s",
86 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
87 cli_name(sptr) :
a41348b1 88@@ -704,8 +705,8 @@
89 }
c5aca5d6 90
91 /* Inform ops and log it */
a41348b1 92- sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
93- "%s",
94+ sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
95+ "%s %s %s for %s%s%s%s%s, expiring at %Tu: %s",
c5aca5d6 96 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
a41348b1 97 cli_name(sptr) :
98 cli_name((cli_user(sptr))->server),
99@@ -877,6 +878,12 @@
c5aca5d6 100 break;
101 }
102
103+ /* Handle the change of auto or manual G-line */
104+ if ((flags & GLINE_AUTO) && !GlineIsAuto(gline))
105+ gline->gl_flags |= GLINE_AUTO; /* mark as auto */
106+ else if (!(flags & GLINE_AUTO) && GlineIsAuto(gline))
107+ gline->gl_flags &= ~GLINE_AUTO; /* mark as manual */
108+
109 /* Handle expiration changes... */
110 if (flags & GLINE_EXPIRE) {
111 gline->gl_expire = expire; /* save new expiration time */
a41348b1 112@@ -909,7 +916,8 @@
c5aca5d6 113 }
114
115 /* All right, inform ops... */
116- sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s",
a41348b1 117+ sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
c5aca5d6 118+ "%s modifying global %s for %s%s%s%s%s:%s",
119 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
120 cli_name(sptr) : cli_name((cli_user(sptr))->server),
121 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
a41348b1 122@@ -930,7 +938,8 @@
c5aca5d6 123 */
124 if (action != GLINE_LOCAL_ACTIVATE && action != GLINE_LOCAL_DEACTIVATE)
125 sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
126- "* %s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
127+ "* %s%s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
a41348b1 128+ GlineIsAuto(gline) ? "=" : "",
c5aca5d6 129 flags & GLINE_OPERFORCE ? "!" : "", op,
130 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
131 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
a41348b1 132@@ -956,7 +965,8 @@
133 assert(GlineIsLocal(gline));
134
135 /* Inform ops and log it */
136- sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
137+ sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
138+ "%s removing local %s for %s%s%s%s%s",
139 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
140 cli_name(sptr) : cli_name((cli_user(sptr))->server),
141 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
142@@ -1144,8 +1154,9 @@
c5aca5d6 143
144 gliter(GlobalGlineList, gline, sgline) {
145 if (!GlineIsLocal(gline) && gline->gl_lastmod)
146- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
147- GlineIsRemActive(gline) ? '+' : '-',
148+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
149+ GlineIsAuto(gline) ? "=" : "",
150+ GlineIsRemActive(gline) ? '+' : '-',
151 gline->gl_nick ? gline->gl_nick : "",
152 gline->gl_nick ? "!" : "",
153 gline->gl_user,
a41348b1 154@@ -1157,7 +1168,8 @@
c5aca5d6 155
156 gliter(BadChanGlineList, gline, sgline) {
157 if (!GlineIsLocal(gline) && gline->gl_lastmod)
158- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s %Tu %Tu %Tu :%s",
159+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s %Tu %Tu %Tu :%s",
160+ GlineIsAuto(gline) ? "=" : "",
161 GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
162 gline->gl_expire - CurrentTime, gline->gl_lastmod,
163 gline->gl_lifetime, gline->gl_reason);
a41348b1 164@@ -1175,7 +1187,8 @@
c5aca5d6 165 if (GlineIsLocal(gline) || !gline->gl_lastmod)
166 return 0;
167
168- sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
169+ sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
170+ GlineIsAuto(gline) ? "=" : "",
171 GlineIsRemActive(gline) ? '+' : '-',
172 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
173 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
a41348b1 174@@ -1214,6 +1227,7 @@
c5aca5d6 175 gline->gl_expire + TSoffset, gline->gl_lastmod,
176 gline->gl_lifetime + TSoffset,
177 GlineIsLocal(gline) ? cli_name(&me) : "*",
178+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
179 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
180 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
181 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
a41348b1 182@@ -1228,6 +1242,7 @@
c5aca5d6 183 gline->gl_expire + TSoffset, gline->gl_lastmod,
184 gline->gl_lifetime + TSoffset,
185 GlineIsLocal(gline) ? cli_name(&me) : "*",
186+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
187 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
188 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
189 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
a41348b1 190@@ -1238,6 +1253,7 @@
c5aca5d6 191 gline->gl_expire + TSoffset, gline->gl_lastmod,
192 gline->gl_lifetime + TSoffset,
193 GlineIsLocal(gline) ? cli_name(&me) : "*",
194+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
195 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
196 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
197 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
a41348b1 198@@ -1273,6 +1289,7 @@
c5aca5d6 199 gline->gl_host ? gline->gl_host : "",
200 gline->gl_expire + TSoffset, gline->gl_lastmod,
201 gline->gl_lifetime + TSoffset,
202+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
203 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
204 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
205 GlineIsRemActive(gline) ? '+' : '-',
a41348b1 206@@ -1283,6 +1300,7 @@
c5aca5d6 207 send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user, "", "", "", "",
208 gline->gl_expire + TSoffset, gline->gl_lastmod,
209 gline->gl_lifetime + TSoffset,
210+ GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
211 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
212 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
213 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
a41348b1 214diff -r 8dcf56ed67b9 ircd/m_gline.c
215--- a/ircd/m_gline.c Sun Feb 15 15:31:50 2009 +0100
216+++ b/ircd/m_gline.c Sun Feb 15 15:59:10 2009 +0100
c5aca5d6 217@@ -140,6 +140,11 @@
218 if (IsServer(sptr))
219 flags |= GLINE_FORCE;
220
221+ if (*mask == '=') {
222+ mask++;
223+ flags |= GLINE_AUTO; /* auto G-line action by service */
224+ }
225+
226 if (*mask == '!') {
227 mask++;
228 flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */
229@@ -183,11 +188,14 @@
230 if ((action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) &&
231 !IsMe(acptr)) {
232 Debug((DEBUG_DEBUG, "I am forwarding a local change to a global gline "
233- "to a remote server; target %s, mask %s, operforce %s, action %c",
234- target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
8ffede71 235+ "to a remote server; target %s, mask %s, auto %s, operforce %s, action %c",
c5aca5d6 236+ target, mask,
c5aca5d6 237+ flags & GLINE_AUTO ? "YES" : "NO",
8ffede71 238+ flags & GLINE_OPERFORCE ? "YES" : "NO",
c5aca5d6 239 action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
240
241- sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
242+ sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s", acptr,
243+ flags & GLINE_AUTO ? "=" : "",
244 flags & GLINE_OPERFORCE ? "!" : "",
245 action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
246
247@@ -226,8 +234,10 @@
248
249 /* OK, create the local G-line */
250 Debug((DEBUG_DEBUG, "I am creating a local G-line here; target %s, "
251- "mask %s, operforce %s, action %s, expire %Tu, reason: %s",
252- target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
8ffede71 253+ "mask %s, auto %s, operforce %s, action %s, expire %Tu, reason: %s",
c5aca5d6 254+ target, mask,
c5aca5d6 255+ flags & GLINE_AUTO ? "YES" : "NO",
8ffede71 256+ flags & GLINE_OPERFORCE ? "YES" : "NO",
c5aca5d6 257 action == GLINE_ACTIVATE ? "+" : "-", expire, reason));
258
259 return gline_add(cptr, sptr, mask, reason, expire, lastmod,
8ffede71 260@@ -239,7 +249,8 @@
c5aca5d6 261
262 /* Let's now destroy the G-line */;
263 Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
264- "mask %s, operforce %s, action %s", target, mask,
8ffede71 265+ "mask %s, auto %s, operforce %s, action %s", target, mask,
c5aca5d6 266+ flags & GLINE_AUTO ? "YES" : "NO",
8ffede71 267 flags & GLINE_OPERFORCE ? "YES" : "NO",
c5aca5d6 268 action == GLINE_ACTIVATE ? "+" : "-"));
269
c5aca5d6 270@@ -255,14 +266,17 @@
271 assert(!IsMe(acptr));
272
273 Debug((DEBUG_DEBUG, "I am forwarding a local G-line to a remote server; "
274- "target %s, mask %s, operforce %s, action %c, expire %Tu, "
8ffede71 275+ "target %s, mask %s, auto %s, operforce %s, action %c, expire %Tu, "
c5aca5d6 276 "lastmod %Tu, reason: %s", target, mask,
c5aca5d6 277+ flags & GLINE_AUTO ? "YES" : "NO",
8ffede71 278 flags & GLINE_OPERFORCE ? "YES" : "NO",
c5aca5d6 279 action == GLINE_ACTIVATE ? '+' : '-', expire, CurrentTime,
280 reason));
281
282- sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s",
283- acptr, flags & GLINE_OPERFORCE ? "!" : "",
284+ sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s %Tu %Tu :%s",
285+ acptr,
286+ flags & GLINE_AUTO ? "=" : "",
287+ flags & GLINE_OPERFORCE ? "!" : "",
288 action == GLINE_ACTIVATE ? '+' : '-', mask,
289 expire - CurrentTime, CurrentTime, reason);
290
8ffede71 291@@ -323,9 +337,10 @@
c5aca5d6 292 return need_more_params(sptr, "GLINE");
293
294 Debug((DEBUG_DEBUG, "I have a global G-line I am acting upon now; "
295- "target %s, mask %s, operforce %s, action %s, expire %Tu, "
8ffede71 296+ "target %s, mask %s, auto %s, operforce %s, action %s, expire %Tu, "
c5aca5d6 297 "lastmod %Tu, lifetime %Tu, reason: %s; gline %s! (fields "
298 "present: %s %s %s)", target, mask,
c5aca5d6 299+ flags & GLINE_AUTO ? "YES" : "NO",
8ffede71 300 flags & GLINE_OPERFORCE ? "YES" : "NO",
c5aca5d6 301 action == GLINE_ACTIVATE ? "+" :
302 (action == GLINE_DEACTIVATE ? "-" :
c5aca5d6 303@@ -353,7 +368,8 @@
304 action == GLINE_ACTIVATE ? "activation" : "deactivation"));
305
306 /* propagate the G-line, even though we don't have it */
307- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s %Tu",
308+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s %Tu",
309+ flags & GLINE_AUTO ? "=" : "",
310 action == GLINE_ACTIVATE ? '+' : '-',
311 mask, lastmod);
312
8ffede71 313@@ -389,6 +405,10 @@
c5aca5d6 314 return gline_list(sptr, 0);
c5aca5d6 315 }
316
8ffede71 317+ /* ignore auto prefix from oper */
318+ if (*mask == '=')
319+ mask++;
320+
c5aca5d6 321 if (*mask == '!') {
8ffede71 322 mask++;
715c825d 323
a41348b1 324diff -r 8dcf56ed67b9 ircd/s_err.c
325--- a/ircd/s_err.c Sun Feb 15 15:31:50 2009 +0100
326+++ b/ircd/s_err.c Sun Feb 15 15:59:10 2009 +0100
c5aca5d6 327@@ -526,7 +526,7 @@
328 /* 246 */
329 { RPL_STATSTLINE, "%c %s %s", "246" },
330 /* 247 */
331- { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%c :%s", "247" },
332+ { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%s%c :%s", "247" },
333 /* 248 */
334 { RPL_STATSULINE, "U %s", "248" },
335 /* 249 */
336@@ -592,7 +592,7 @@
337 /* 279 */
338 { 0 },
339 /* 280 */
340- { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%c :%s", "280" },
341+ { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%s%c :%s", "280" },
342 /* 281 */
343 { RPL_ENDOFGLIST, ":End of G-line List", "281" },
344 /* 282 */