]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - hiskgline.patch
some more patches: split functionality, make stats output clearer, start to add ...
[irc/quakenet/snircd-patchqueue.git] / hiskgline.patch
1 tidy up HIS G-line/K-line reasons, instead of examing the quit reason, set a flag and use that to determine whether or not the quit reason shown to other users should be altered.
2
3 diff -r b737284f4c26 include/client.h
4 --- a/include/client.h Sun Jan 11 22:38:41 2009 +0000
5 +++ b/include/client.h Sun Jan 11 22:38:41 2009 +0000
6 @@ -156,6 +156,8 @@
7 FLAG_PINGSENT, /**< Unreplied ping sent */
8 FLAG_DEADSOCKET, /**< Local socket is dead--Exiting soon */
9 FLAG_KILLED, /**< Prevents "QUIT" from being sent for this */
10 + FLAG_KLINED, /**< HIS K-line reasons, prevents K-line reason from being shown to others */
11 + FLAG_GLINED, /**< HIS G-line reasons, prevents G-line reason from being shown to others */
12 FLAG_BLOCKED, /**< socket is in a blocked condition */
13 FLAG_CLOSING, /**< set when closing to suppress errors */
14 FLAG_UPING, /**< has active UDP ping request */
15 diff -r b737284f4c26 ircd/gline.c
16 --- a/ircd/gline.c Sun Jan 11 22:38:41 2009 +0000
17 +++ b/ircd/gline.c Sun Jan 11 22:38:41 2009 +0000
18 @@ -282,9 +282,10 @@
19 get_client_name(acptr, SHOW_IP));
20
21 /* and get rid of him */
22 - /* WARNING: code in exit_client() relies on the quit message starting with
23 - * G-lined or K-lined for HIS purposes
24 + /* set FLAG_GLINED for HIS function
25 + * prevents G-line reason from being shown to other users
26 */
27 + SetFlag(acptr, FLAG_GLINED);
28 if ((tval = exit_client_msg(cptr, acptr, &me, "G-lined (%s)", gline->gl_reason)))
29 retval = tval; /* retain killed status */
30 }
31 diff -r b737284f4c26 ircd/s_auth.c
32 --- a/ircd/s_auth.c Sun Jan 11 22:38:41 2009 +0000
33 +++ b/ircd/s_auth.c Sun Jan 11 22:38:41 2009 +0000
34 @@ -270,9 +270,10 @@
35 killreason = find_kill(sptr, 1, &reason);
36 if (killreason) {
37 ServerStats->is_ref++;
38 - /* WARNING: code in exit_client() relies on the quit message starting with
39 - * G-lined or K-lined for HIS purposes
40 - */
41 + /* set FLAG_KLINED or FLAG_GLINED for HIS function
42 + * prevents K-line and G-line reason from being shown to other users
43 + */
44 + SetFlag(sptr, killreason == -1 ? FLAG_KLINED : FLAG_GLINED);
45 return exit_client_msg(sptr, sptr, &me, "%s (%s)",
46 (killreason == -1 ? "K-lined" : "G-lined"), reason);
47 }
48 diff -r b737284f4c26 ircd/s_conf.c
49 --- a/ircd/s_conf.c Sun Jan 11 22:38:41 2009 +0000
50 +++ b/ircd/s_conf.c Sun Jan 11 22:38:41 2009 +0000
51 @@ -993,9 +993,10 @@
52 "K-line active for %s%s",
53 IsUnknown(acptr) ? "Unregistered Client ":"",
54 get_client_name(acptr, SHOW_IP));
55 - /* WARNING: code in exit_client() relies on the quit message starting with
56 - * G-lined or K-lined for HIS purposes
57 - */
58 + /* set FLAG_KLINED or FLAG_GLINED for HIS function
59 + * prevents K-line and G-line reason from being shown to other users
60 + */
61 + SetFlag(acptr, found_g == -2 ? FLAG_GLINED : FLAG_KLINED);
62 if (exit_client_msg(cptr, acptr, &me, "%s (%s)", found_g == -2 ? "G-lined" :
63 "K-lined", reason) == CPTR_KILLED)
64 ret = CPTR_KILLED;
65 diff -r b737284f4c26 ircd/s_misc.c
66 --- a/ircd/s_misc.c Sun Jan 11 22:38:41 2009 +0000
67 +++ b/ircd/s_misc.c Sun Jan 11 22:38:41 2009 +0000
68 @@ -496,11 +496,24 @@
69 sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
70 cli_name(victim), cli_serv(victim)->timestamp, comment);
71 else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED)) {
72 - /* do not show G-line or K-line reasons to other users, so remove them - wiebe */
73 - if (!strncmp(comment, "G-lined", 7))
74 - comment = "G-lined";
75 - else if (!strncmp(comment, "K-lined", 7))
76 - comment = "K-lined";
77 + /* my user is hit by K-line or G-line, hide the reason */
78 + if (MyUser(victim)) {
79 + if (HasFlag(victim, FLAG_KLINED))
80 + comment = "K-lined";
81 + else if (HasFlag(victim, FLAG_GLINED))
82 + comment = "G-lined";
83 + } else {
84 + /* backwards compatibility
85 + * remove G-line and K-line reasons from quits from remote users
86 + * as snircd 1.3.x still sends those upstream
87 + * this part of the code can be removed for the next snircd release
88 + * December 2008 - wiebe
89 + */
90 + if (!strncmp(comment, "G-lined", 7))
91 + comment = "G-lined";
92 + else if (!strncmp(comment, "K-lined", 7))
93 + comment = "K-lined";
94 + }
95 sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
96 }
97 }