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