]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - glinesnomask.patch
some more patches: split functionality, make stats output clearer, start to add ...
[irc/quakenet/snircd-patchqueue.git] / glinesnomask.patch
1 SNO_GLINE and SNO_AUTO
2
3 change of plans.
4
5 before, glines with reason starting with "AUTO" end up in SNO_AUTO, all other in SNO_GLINE
6 now
7 /* figure out what snomask to send to, send to SNO_GLINE when:
8 * source is a user and is not on a service server
9 * gline is local, a badchan, or a realname gline
10 * duration is either 120 seconds or less, or 2 weeks or more
11 * nick part is not equal to *
12 * the gline is wide
13 * otherwise, send to SNO_AUTO
14 */
15
16 diff -r 16b56cea76d8 ircd/gline.c
17 --- a/ircd/gline.c Sun Jan 11 22:38:40 2009 +0000
18 +++ b/ircd/gline.c Sun Jan 11 22:38:41 2009 +0000
19 @@ -209,7 +209,7 @@
20 * @return Zero, unless \a sptr G-lined himself, in which case CPTR_KILLED.
21 */
22 static int
23 -do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
24 +do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline, int snomask)
25 {
26 struct Client *acptr;
27 int fd, retval = 0, tval;
28 @@ -278,7 +278,7 @@
29 gline->gl_reason);
30
31 /* let the ops know about it */
32 - sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
33 + sendto_opmask_butone(0, snomask, "G-line active for %s",
34 get_client_name(acptr, SHOW_IP));
35
36 /* and get rid of him */
37 @@ -470,6 +470,7 @@
38 char uhmask[NICKLEN + USERLEN + HOSTLEN + 3];
39 char *nick, *user, *host;
40 int tmp;
41 + int snomask;
42
43 assert(0 != userhost);
44 assert(0 != reason);
45 @@ -543,9 +544,25 @@
46
47 /* lifetime is already an absolute timestamp */
48
49 + /* figure out what snomask to send to, send to SNO_GLINE when:
50 + * source is a user and is not on a service server
51 + * gline is local, a badchan, or a realname gline
52 + * duration is either 120 seconds or less, or 2 weeks or more
53 + * nick part is not equal to *
54 + * the gline is wide
55 + * otherwise, send to SNO_AUTO
56 + */
57 + if ((IsUser(sptr) && !IsService(cli_user(sptr)->server)) ||
58 + (flags & (GLINE_LOCAL|GLINE_BADCHAN|GLINE_REALNAME)) ||
59 + ((expire - CurrentTime <= 120) || (expire - CurrentTime >= 1209600)) ||
60 + !(nick[0] == '*' && nick[1] == '\0') ||
61 + (gline_checkmask(host) != CHECK_APPROVED))
62 + snomask = SNO_GLINE;
63 + else
64 + snomask = SNO_AUTO;
65 +
66 /* Inform ops... */
67 - sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
68 - SNO_AUTO, "%s adding %s %s for %s%s%s%s%s, expiring at "
69 + sendto_opmask_butone(0, snomask, "%s adding %s %s for %s%s%s%s%s, expiring at "
70 "%Tu: %s",
71 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
72 cli_name(sptr) :
73 @@ -581,7 +598,7 @@
74
75 gline_propagate(cptr, sptr, agline);
76
77 - return do_gline(cptr, sptr, agline); /* knock off users if necessary */
78 + return do_gline(cptr, sptr, agline, snomask); /* knock off users if necessary */
79 }
80
81 /** Activate a currently inactive G-line.
82 @@ -644,7 +661,7 @@
83 if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
84 gline_propagate(cptr, sptr, gline);
85
86 - return do_gline(cptr, sptr, gline);
87 + return do_gline(cptr, sptr, gline, SNO_GLINE);
88 }
89
90 /** Deactivate a G-line.
91 @@ -928,7 +945,7 @@
92 gline->gl_lifetime, gline->gl_reason);
93
94 /* OK, let's do the G-line... */
95 - return do_gline(cptr, sptr, gline);
96 + return do_gline(cptr, sptr, gline, SNO_GLINE);
97 }
98
99 /** Destroy a local G-line.