1 Added new define in include/client.h
2 IsRealChannelService() - client has usermode +k and is on a services server (+s flag)
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.
7 Some places the IsChannelService() check is not changed because it is changed in some of the
8 other patches later in the queue.
10 TODO: keep the side effect of usermode +k that channels are hidden, or leave that soley to usermode +n?
11 That is, keep IsChannelService() in whois/who or use IsRealChannelService().
13 diff -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
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). */
25 diff -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
29 * however there are typically no more than 1000 people in a channel
32 - if (IsChannelService(cptr)) {
33 + if (IsRealChannelService(cptr)) {
36 assert(m->channel == chptr);
38 * Allow +X'ed users to mess with +k'ed.
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",
47 cli_name((cli_user(state->sptr))->server)));
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);
55 diff -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
59 } else if (IsBurstOrBurstAck(cptr))
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);
67 diff -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
71 * Allow +X'ed users to kick +k'ed, but not U-lined services.
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);
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);
85 - return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname);
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);
94 /* Prevent kicking opers from local channels -DM- */
95 diff -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
99 * Allow +X'ed users to kill +k'ed, but not U-lined services.
102 - if (IsChannelService(victim) && IsService(cli_user(victim)->server))
103 + if (IsRealChannelService(victim))
104 return send_reply(sptr, ERR_ISREALSERVICE, "KILL", cli_name(victim));
106 if (IsChannelService(victim) && !IsXtraOp(sptr) && !(victim==sptr))
107 diff -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
111 send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host,
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)
119 /* Display the channels this user is on. */
120 - if ((!IsChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr))
121 + if ((!IsRealChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr))
123 struct Membership* chan;
124 mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name);
125 diff -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
130 chan = find_channel_member(acptr, repchan);
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))
137 for (chan = cli_user(acptr)->channel; chan; chan = chan->next_channel)
138 if (PubChannel(chan->channel) &&