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