2 # Parent e5696ca6af7ca3b62663f4891d4f570b3e66356e
4 Add % prefix for gline allowing a global gline to be destroyed (removed from memory)
5 instead of being kept in memory in a deactivated state until it expires.
7 This prefix should only be used when there are no servers split that have the gline,
8 because during a netmerge, if the other end has this gline,
9 it will be reintroduced to our side of the network.
13 P10 (Uworld gline, no lastmod)
14 "<source numeric> GL * %-<mask>"
16 P10 (normal gline, lastmod)
17 "<source numeric> GL * %-<mask> <expire> <lastmod> :<reason>"
20 "GLINE %-<mask> * <expire> :<reason>"
22 diff -r e5696ca6af7c include/gline.h
23 --- a/include/gline.h Sun Jul 21 09:54:48 2013 +0200
24 +++ b/include/gline.h Sun Jul 21 10:10:30 2013 +0200
26 #define GLINE_LASTMOD 0x0200 /**< Find only G-lines with non-zero lastmod. */
27 #define GLINE_OPERFORCE 0x0400 /**< Oper forcing G-line to be set. */
28 #define GLINE_REALNAME 0x0800 /**< G-line matches only the realname field. */
29 +#define GLINE_DESTROY 0x1000 /**< G-line is to be destroyed, removed from memory - snircd */
31 #define GLINE_EXPIRE 0x1000 /**< Expiration time update */
32 #define GLINE_LIFETIME 0x2000 /**< Record lifetime update */
34 #define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN)
35 /** Test whether \a g is local to this server. */
36 #define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
37 +/** Test whether \a g is to be destroyed - snircd */
38 +#define GlineIsDestroy(g) ((g)->gl_flags & GLINE_DESTROY)
40 /** Return nick mask of a G-line. */
41 #define GlineNick(g) ((g)->gl_nick)
42 diff -r e5696ca6af7c ircd/gline.c
43 --- a/ircd/gline.c Sun Jul 21 09:54:48 2013 +0200
44 +++ b/ircd/gline.c Sun Jul 21 10:10:30 2013 +0200
47 assert(gline->gl_lastmod);
49 - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
50 + sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
51 + GlineIsDestroy(gline) ? "%" : "",
52 GlineIsRemActive(gline) ? '+' : '-',
53 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
54 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
56 msg = "removing global";
57 gline->gl_flags &= ~GLINE_ACTIVE; /* propagate a -<mask> */
59 - msg = "deactivating global";
61 + /* destroy gline - snircd */
62 + if (flags & GLINE_DESTROY) {
63 + msg = "destroying global";
64 + gline->gl_flags |= GLINE_DESTROY;
67 + msg = "deactivating global";
69 if (flags & GLINE_LOCAL)
70 gline->gl_flags |= GLINE_LDEACT;
75 - if ((saveflags & GLINE_ACTMASK) != GLINE_ACTIVE)
76 + if ((saveflags & GLINE_ACTMASK) != GLINE_ACTIVE && !(flags & GLINE_DESTROY))
77 return 0; /* was inactive to begin with */
81 gline_propagate(cptr, sptr, gline);
83 /* if it's a local gline or a Uworld gline (and not locally deactivated).. */
84 - if (GlineIsLocal(gline) || (!gline->gl_lastmod && !(flags & GLINE_LOCAL)))
85 + if (GlineIsLocal(gline) || (!gline->gl_lastmod && !(flags & GLINE_LOCAL)) ||
86 + (flags & GLINE_DESTROY)) /* destroy gline - snircd */
87 gline_free(gline); /* get rid of it */
90 diff -r e5696ca6af7c ircd/m_gline.c
91 --- a/ircd/m_gline.c Sun Jul 21 09:54:48 2013 +0200
92 +++ b/ircd/m_gline.c Sun Jul 21 10:10:30 2013 +0200
96 flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */
97 + } else if (*mask == '%') { /* destroy gline - snircd */
99 + flags |= GLINE_DESTROY;
102 switch (*mask) { /* handle +, -, <, and > */
104 lifetime, flags | GLINE_ACTIVE);
106 } else if (IsMe(acptr)) { /* destroying a local G-line */
107 - if (!agline) /* G-line doesn't exist, so let's complain... */
108 - return send_reply(sptr, ERR_NOSUCHGLINE, mask);
110 + /* manually propagate destroy for a global gline we dont have - snircd */
111 + if ((flags & GLINE_DESTROY) && !(flags & (GLINE_ACTIVE|GLINE_LOCAL))) {
112 + sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %%-%s %Tu %Tu %Tu :%s",
113 + mask, expire, lastmod, lifetime, reason);
116 + /* G-line doesn't exist, so let's complain... */
117 + return send_reply(sptr, ERR_NOSUCHGLINE, mask);
121 /* Let's now destroy the G-line */;
122 Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
125 if (HasPriv(sptr, PRIV_WIDE_GLINE))
126 flags |= GLINE_OPERFORCE;
127 + } else if (*mask == '%') { /* destroy gline - snircd */
129 + flags |= GLINE_DESTROY;
132 switch (*mask) { /* handle +, -, <, and > */