]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame - ischannelservice.patch
oplevelforward.patch - revert to earlier fix + comments
[irc/quakenet/snircd-patchqueue.git] / ischannelservice.patch
CommitLineData
c8fc5f4b 1Added new define in include/client.h
2IsRealChannelService() - client has usermode +k and is on a services server (+s flag)
3
4Function ms_invite did not return an error when the source was a channel service,
5that should only be for a real channel service.
6
7Some places the IsChannelService() check is not changed because it is changed in some of the
8other patches later in the queue.
9
10TODO: keep the side effect of usermode +k that channels are hidden, or leave that soley to usermode +n?
11That is, keep IsChannelService() in whois/who or use IsRealChannelService().
12
13diff -r 979639f84630 include/client.h
14--- a/include/client.h Fri Jan 30 15:56:19 2009 +0100
15+++ b/include/client.h Fri Jan 30 16:38:40 2009 +0100
16@@ -568,6 +568,8 @@
17 #define IsBurstOrBurstAck(x) (HasFlag(x, FLAG_BURST) || HasFlag(x, FLAG_BURST_ACK))
18 /** Return non-zero if the client has set mode +k (channel service). */
19 #define IsChannelService(x) HasFlag(x, FLAG_CHSERV)
20+/** Return non-zero if the client has set mode +k (channel service) and is on a service server */
21+#define IsRealChannelService(x) (IsChannelService(x) && IsService(cli_user(x)->server))
22 /** Return non-zero if the client's socket is disconnected. */
23 #define IsDead(x) HasFlag(x, FLAG_DEADSOCKET)
24 /** Return non-zero if the client has set mode +d (deaf). */
25diff -r 979639f84630 ircd/channel.c
26--- a/ircd/channel.c Fri Jan 30 15:56:19 2009 +0100
27+++ b/ircd/channel.c Fri Jan 30 16:38:40 2009 +0100
28@@ -180,7 +180,7 @@
29 * however there are typically no more than 1000 people in a channel
30 * at a time.
31 */
32- if (IsChannelService(cptr)) {
33+ if (IsRealChannelService(cptr)) {
34 m = chptr->members;
35 while (m) {
36 assert(m->channel == chptr);
37@@ -3190,7 +3190,7 @@
38 * Allow +X'ed users to mess with +k'ed.
39 * --Bigfoot
40 */
41- if ((IsChannelService(state->cli_change[i].client) && IsService(cli_user(state->cli_change[i].client)->server)) || (IsChannelService(state->cli_change[i].client) && !IsXtraOp(state->sptr))) {
42+ if ((IsRealChannelService(state->cli_change[i].client)) || (IsChannelService(state->cli_change[i].client) && !IsXtraOp(state->sptr))) {
43 if (state->flags & MODE_PARSE_FORCE) /* it was forced */
44 sendto_opmask_butone(0, SNO_HACK4, "Deop of +k user on %H by %s",
45 state->chptr,
46@@ -3198,7 +3198,7 @@
47 cli_name((cli_user(state->sptr))->server)));
48
49 else if (MyUser(state->sptr) && state->flags & MODE_PARSE_SET && (state->sptr != state->cli_change[i].client)) {
50- if(IsService(cli_user(state->cli_change[i].client)->server) && IsChannelService(state->cli_change[i].client)){
51+ if(IsRealChannelService(state->cli_change[i].client)){
52 send_reply(state->sptr, ERR_ISREALSERVICE,
53 cli_name(state->cli_change[i].client),
54 state->chptr->chname);
55diff -r 979639f84630 ircd/m_invite.c
56--- a/ircd/m_invite.c Fri Jan 30 15:56:19 2009 +0100
57+++ b/ircd/m_invite.c Fri Jan 30 16:38:40 2009 +0100
58@@ -271,7 +271,7 @@
59 } else if (IsBurstOrBurstAck(cptr))
60 return 0;
61
62- if (!IsChannelService(sptr) && !find_channel_member(sptr, chptr)) {
63+ if (!IsRealChannelService(sptr) && !find_channel_member(sptr, chptr)) {
64 send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname);
65 return 0;
66 }
67diff -r 979639f84630 ircd/m_kick.c
68--- a/ircd/m_kick.c Fri Jan 30 15:56:19 2009 +0100
69+++ b/ircd/m_kick.c Fri Jan 30 16:38:40 2009 +0100
70@@ -136,17 +136,14 @@
71 * Allow +X'ed users to kick +k'ed, but not U-lined services.
72 * --Bigfoot
73 */
74- if (IsChannelService(who)) {
75- if (IsService(cli_user(who)->server))
76- return send_reply(sptr, ERR_ISREALSERVICE, cli_name(who), chptr->chname);
77+ if (IsRealChannelService(who))
78+ return send_reply(sptr, ERR_ISREALSERVICE, cli_name(who), chptr->chname);
79
80- if (!IsXtraOp(sptr) && (who!=sptr)) {
81- /* the victim is paranoid AND on the channel but not a zombie - wiebe */
82- if (IsParanoid(who) && (member = find_member_link(chptr, who)) && !IsZombie(member)) {
83- sendcmdto_one(&me, CMD_NOTICE, who, "%C :kick: %s tried to /KICK you from %s.", who, cli_name(sptr), chptr->chname);
84- }
85- return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname);
86- }
87+ if (IsChannelService(who) && !IsXtraOp(sptr) && (who!=sptr)) {
88+ /* the victim is paranoid AND on the channel but not a zombie */
89+ if (IsParanoid(who) && (member = find_member_link(chptr, who)) && !IsZombie(member))
90+ sendcmdto_one(&me, CMD_NOTICE, who, "%C :kick: %s tried to /KICK you from %s.", who, cli_name(sptr), chptr->chname);
91+ return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname);
92 }
93
94 /* Prevent kicking opers from local channels -DM- */
95diff -r 979639f84630 ircd/m_kill.c
96--- a/ircd/m_kill.c Fri Jan 30 15:56:19 2009 +0100
97+++ b/ircd/m_kill.c Fri Jan 30 16:38:40 2009 +0100
98@@ -293,7 +293,7 @@
99 * Allow +X'ed users to kill +k'ed, but not U-lined services.
100 * --Bigfoot
101 */
102- if (IsChannelService(victim) && IsService(cli_user(victim)->server))
103+ if (IsRealChannelService(victim))
104 return send_reply(sptr, ERR_ISREALSERVICE, "KILL", cli_name(victim));
105
106 if (IsChannelService(victim) && !IsXtraOp(sptr) && !(victim==sptr))
107diff -r 979639f84630 ircd/m_whois.c
108--- a/ircd/m_whois.c Fri Jan 30 15:56:19 2009 +0100
109+++ b/ircd/m_whois.c Fri Jan 30 16:38:40 2009 +0100
110@@ -143,8 +143,13 @@
111 send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host,
112 cli_info(acptr));
113
114+ /* TODO: IsChannelService or IsRealChannelService?
115+ * we have usermode +n to hide channels already, so could go with the IsReal.. version
116+ * if an oper wants to hide channels too, they can set +n
117+ * in that case also remove || (acptr==sptr)
118+ */
119 /* Display the channels this user is on. */
120- if ((!IsChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr))
121+ if ((!IsRealChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr))
122 {
123 struct Membership* chan;
124 mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name);
125diff -r 979639f84630 ircd/whocmds.c
126--- a/ircd/whocmds.c Fri Jan 30 15:56:19 2009 +0100
127+++ b/ircd/whocmds.c Fri Jan 30 16:38:40 2009 +0100
128@@ -94,8 +94,9 @@
129 {
130 chan = find_channel_member(acptr, repchan);
131 }
132+ /* TODO: use IsRealChannelService or IsChannelService? */
133 else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA)))
134- && !IsChannelService(acptr) && !IsNoChan(acptr))
135+ && !IsRealChannelService(acptr) && !IsNoChan(acptr))
136 {
137 for (chan = cli_user(acptr)->channel; chan; chan = chan->next_channel)
138 if (PubChannel(chan->channel) &&