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