]>
Commit | Line | Data |
---|---|---|
1 | attempt to move checks for chanmodes c C N T u into | |
2 | the *_can_send_to_channel() functions in channel.c where ircu by default has its chanmode checks | |
3 | ||
4 | instead of having them in each of the places used (m_wallchops, m_wallvoices, ircd_relay.c, etc.) | |
5 | not tested completely | |
6 | ||
7 | client_can_send_to_channel() | |
8 | and | |
9 | member_can_send_to_channel() | |
10 | ||
11 | move our cCNT mode checks to new function can_send_to_channel() used | |
12 | from the two functions above | |
13 | now the checks for cCNT modes are in one place. | |
14 | check for +u remains in member_can_send_to_chan() - as quit from non-member does not show | |
15 | ||
16 | need to verify handling of remote users, services, servers etc. | |
17 | ||
18 | possible problem discovered (ircu): | |
19 | in some places *_can_send_to_channel() is first called with reveal delayedjoin user ON | |
20 | but the code then proceeds to check target limits, which upon refusal means the delayedjoin | |
21 | user is revealed (locally) without actually sending anything to the channel... | |
22 | ...that seems wrong/weird | |
23 | ||
24 | diff -r e5a9f5ebb56d include/channel.h | |
25 | --- a/include/channel.h Sat Jan 31 18:37:49 2009 +0100 | |
26 | +++ b/include/channel.h Sat Jan 31 18:40:26 2009 +0100 | |
27 | @@ -103,9 +103,9 @@ | |
28 | #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */ | |
29 | #define MODE_REGISTERED 0x2000 /**< Channel marked as registered | |
30 | * (for future semantic expansion) */ | |
31 | -#define MODE_NOCOLOUR 0x4000 /**< No mIRC/ANSI colors/bold */ | |
32 | -#define MODE_NOCTCP 0x8000 /**< No channel CTCPs */ | |
33 | -#define MODE_NONOTICE 0x10000 /**< No channel notices */ | |
34 | +#define MODE_NOCOLOUR 0x4000 /**< +c No mIRC/ANSI colors/bold */ | |
35 | +#define MODE_NOCTCP 0x8000 /**< +C No channel CTCPs */ | |
36 | +#define MODE_NONOTICE 0x10000 /**< +N No channel notices */ | |
37 | #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til | |
38 | * later */ | |
39 | #define MODE_FREE 0x40000 /**< string needs to be passed to | |
40 | @@ -115,7 +115,7 @@ | |
41 | #define MODE_APASS 0x200000 | |
42 | #define MODE_WASDELJOINS 0x400000 /**< Not DELJOINS, but some joins | |
43 | * pending */ | |
44 | -#define MODE_NOQUITPARTS 0x800000 | |
45 | +#define MODE_NOQUITPARTS 0x800000 /**< +u No user defined quit or part messages */ | |
46 | ||
47 | #define MODE_NOMULTITARGET 0x1000000 /**< +T No multiple targets */ | |
48 | #define MODE_MODERATENOREG 0x2000000 /**< +M Moderate unauthed users */ | |
49 | @@ -396,8 +396,12 @@ | |
50 | ||
51 | extern const char* find_no_nickchange_channel(struct Client* cptr); | |
52 | extern struct Membership* find_channel_member(struct Client* cptr, struct Channel* chptr); | |
53 | -extern int member_can_send_to_channel(struct Membership* member, int reveal); | |
54 | -extern int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal); | |
55 | +extern int member_can_send_to_channel(struct Membership* member, int reveal, | |
56 | + unsigned int flags, const char *text, const int target); | |
57 | +extern int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, | |
58 | + int reveal, unsigned int flags, const char *text, const int target); | |
59 | +extern int can_send_to_channel(struct Client *cptr, struct Channel *chptr, | |
60 | + unsigned int flags, const char *text, const int target); | |
61 | ||
62 | extern void remove_user_from_channel(struct Client *sptr, struct Channel *chptr); | |
63 | extern void remove_user_from_all_channels(struct Client* cptr); | |
64 | diff -r e5a9f5ebb56d ircd/channel.c | |
65 | --- a/ircd/channel.c Sat Jan 31 18:37:49 2009 +0100 | |
66 | +++ b/ircd/channel.c Sat Jan 31 18:40:26 2009 +0100 | |
67 | @@ -683,10 +683,14 @@ | |
68 | * @param member The membership of the user | |
69 | * @param reveal If true, the user will be "revealed" on a delayed | |
70 | * joined channel. | |
71 | + * @param flags The bitmask of additional modes to check (besides +n +m +r +M +b) | |
72 | + * @param text The message from the user, needed for modes +c and +C | |
73 | + * @param target The number of targets the message is sent to, for +T | |
74 | * | |
75 | * @returns True if the client can speak on the channel. | |
76 | */ | |
77 | -int member_can_send_to_channel(struct Membership* member, int reveal) | |
78 | +int member_can_send_to_channel(struct Membership* member, int reveal, | |
79 | + unsigned int flags, const char *text, const int target) | |
80 | { | |
81 | assert(0 != member); | |
82 | ||
83 | @@ -694,15 +698,17 @@ | |
84 | * temporary desynch, or maybe they are on an older server, but | |
85 | * we do not want to send ERR_CANNOTSENDTOCHAN more than once. | |
86 | */ | |
87 | - if (!MyUser(member->user)) | |
88 | - { | |
89 | + /* client on service server (+s) - let it through */ | |
90 | + if (IsService(cli_user(member->user)->server)) { | |
91 | if (IsDelayedJoin(member) && reveal) | |
92 | RevealDelayedJoin(member); | |
93 | return 1; | |
94 | } | |
95 | - | |
96 | - /* +X user can always speak on the channel */ | |
97 | + | |
98 | + /* +X exclude +X clients from modes +mMR and bans */ | |
99 | if (IsXtraOp(member->user)) { | |
100 | + if (!can_send_to_channel(member->user, member->channel, flags, text, target)) | |
101 | + return 0; | |
102 | if (IsDelayedJoin(member) && reveal) | |
103 | RevealDelayedJoin(member); | |
104 | return 1; | |
105 | @@ -714,7 +720,7 @@ | |
106 | ||
107 | /* If you have voice or ops, you can speak. */ | |
108 | if (IsVoicedOrOpped(member)) | |
109 | - return 1; | |
110 | + return can_send_to_channel(member->user, member->channel, flags, text, target); | |
111 | ||
112 | /* | |
113 | * If it's moderated, and you aren't a privileged user, you can't | |
114 | @@ -731,6 +737,23 @@ | |
115 | if (is_banned(member)) | |
116 | return 0; | |
117 | ||
118 | + /* enough checked for remote users */ | |
119 | + if (!MyUser(member->user)) { | |
120 | + if (IsDelayedJoin(member) && reveal) | |
121 | + RevealDelayedJoin(member); | |
122 | + return 1; | |
123 | + } | |
124 | + | |
125 | + /* +u check for user defined quit and part messages, | |
126 | + * and they are not allowed | |
127 | + */ | |
128 | + if ((flags & MODE_NOQUITPARTS) && (member->channel->mode.mode & MODE_NOQUITPARTS)) | |
129 | + return 0; | |
130 | + | |
131 | + /* check various other modes (like cCNT) */ | |
132 | + if (!can_send_to_channel(member->user, member->channel, flags, text, target)) | |
133 | + return 0; | |
134 | + | |
135 | if (IsDelayedJoin(member) && reveal) | |
136 | RevealDelayedJoin(member); | |
137 | ||
138 | @@ -746,16 +769,22 @@ | |
139 | * @param chptr The channel to check | |
140 | * @param reveal If the user should be revealed (see | |
141 | * member_can_send_to_channel()) | |
142 | + * @param flags The bitmask of additional modes to check (besides +n +m +r +M +b) | |
143 | + * @param text The message needed to check for +c and +C | |
144 | + * @param target The number of targets the message is sent to, for +T | |
145 | * | |
146 | * @returns true if the client is allowed to speak on the channel, false | |
147 | * otherwise | |
148 | * | |
149 | * @see member_can_send_to_channel() | |
150 | */ | |
151 | -int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal) | |
152 | +int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal, | |
153 | + unsigned int flags, const char *text, const int target) | |
154 | { | |
155 | struct Membership *member; | |
156 | - assert(0 != cptr); | |
157 | + | |
158 | + assert(0 != cptr); | |
159 | + | |
160 | /* | |
161 | * Servers can always speak on channels. | |
162 | */ | |
163 | @@ -769,15 +798,90 @@ | |
164 | * or +m (moderated). | |
165 | */ | |
166 | if (!member) { | |
167 | - if (IsXtraOp(cptr)) | |
168 | + /* client on service server (+s) - let it through */ | |
169 | + if (IsService(cli_user(cptr)->server)) | |
170 | return 1; | |
171 | - else if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED)) || | |
172 | - ((chptr->mode.mode & (MODE_REGONLY|MODE_MODERATENOREG)) && !IsAccount(cptr))) | |
173 | + /* client with umode +X exempt from modes +nmrM and bans */ | |
174 | + if (!IsXtraOp(cptr)) { | |
175 | + if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED)) || | |
176 | + ((chptr->mode.mode & (MODE_REGONLY|MODE_MODERATENOREG)) && !IsAccount(cptr))) | |
177 | + return 0; | |
178 | + if (find_ban(cptr, chptr->banlist)) | |
179 | + return 0; | |
180 | + } | |
181 | + /* check various other modes (like cCNT) */ | |
182 | + if (!can_send_to_channel(cptr, chptr, flags, text, target)) | |
183 | return 0; | |
184 | - else | |
185 | - return !find_ban(cptr, chptr->banlist); | |
186 | } | |
187 | - return member_can_send_to_channel(member, reveal); | |
188 | + return member_can_send_to_channel(member, reveal, flags, text, target); | |
189 | +} | |
190 | + | |
191 | +/** Check if a client can send to a channel. | |
192 | + * | |
193 | + * These checks are done for both clients on and off the channel. | |
194 | + * | |
195 | + * @param cptr The client to check | |
196 | + * @param chptr The channel to check | |
197 | + * @param flags The bitmask of modes to check | |
198 | + * @param text The message needed to check for +c and +C | |
199 | + * @param target The number of targets the message is sent to, for +T | |
200 | + * | |
201 | + * @returns true if the client is allowed to speak on the channel, false | |
202 | + * otherwise | |
203 | + * | |
204 | + * @see client_can_send_to_channel() | |
205 | + * @see member_can_send_to_channel() | |
206 | + */ | |
207 | +int can_send_to_channel(struct Client *cptr, struct Channel *chptr, | |
208 | + unsigned int flags, const char *text, const int target) | |
209 | +{ | |
210 | + const char *ch; | |
211 | + unsigned int modes; | |
212 | + int controlcodes = 0; | |
213 | + | |
214 | + assert(0 != cptr); | |
215 | + assert(0 != chptr); | |
216 | + | |
217 | + modes = chptr->mode.mode; | |
218 | + | |
219 | + /* only check these modes on local users */ | |
220 | + if (!MyUser(cptr)) | |
221 | + return 1; | |
222 | + | |
223 | + /* +T check for multi target message and they are not allowed */ | |
224 | + if ((flags & MODE_NOMULTITARGET) && (modes & MODE_NOMULTITARGET) && | |
225 | + target > 1) | |
226 | + return 0; | |
227 | + | |
228 | + /* +N check for channel wide notice and they are not allowed */ | |
229 | + if ((flags & MODE_NONOTICE) && (modes & MODE_NONOTICE)) | |
230 | + return 0; | |
231 | + | |
232 | + /* these last two checks should always be last | |
233 | + * as they loop over the entire message in search for | |
234 | + * CTCP char and control codes | |
235 | + */ | |
236 | + /* +C check for CTCP and CTCPs are not allowed */ | |
237 | + if ((flags & MODE_NOCTCP) && (modes & MODE_NOCTCP) && (text != NULL) && | |
238 | + ircd_strncmp(text,"\001ACTION ",8)) { | |
239 | + for (ch=text;*ch;) { | |
240 | + if (*ch++==1) | |
241 | + return 0; | |
242 | + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) | |
243 | + controlcodes = 1; | |
244 | + } | |
245 | + } | |
246 | + | |
247 | + /* +c check for control codes and they are not allowed */ | |
248 | + if ((flags & MODE_NOCOLOUR) && (modes & MODE_NOCOLOUR) && (text != NULL)) { | |
249 | + if (controlcodes) /* already found control codes */ | |
250 | + return 0; | |
251 | + for (ch=text;*ch;ch++) { | |
252 | + if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) | |
253 | + return 0; | |
254 | + } | |
255 | + } | |
256 | + return 1; | |
257 | } | |
258 | ||
259 | /** Returns the name of a channel that prevents the user from changing nick. | |
260 | @@ -3627,13 +3731,11 @@ | |
261 | /* Send notification to channel */ | |
262 | if (!(flags & (CHFL_ZOMBIE | CHFL_DELAYED))) | |
263 | sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_PART, chan, NULL, 0, | |
264 | - ((flags & CHFL_BANNED) || ((chan->mode.mode & MODE_NOQUITPARTS) | |
265 | - && !IsChannelService(member->user)) || !jbuf->jb_comment) ? | |
266 | + ((flags & CHFL_BANNED) || !jbuf->jb_comment) ? | |
267 | "%H" : "%H :%s", chan, jbuf->jb_comment); | |
268 | else if (MyUser(jbuf->jb_source)) | |
269 | sendcmdto_one(jbuf->jb_source, CMD_PART, jbuf->jb_source, | |
270 | - ((flags & CHFL_BANNED) || (chan->mode.mode & MODE_NOQUITPARTS) | |
271 | - || !jbuf->jb_comment) ? | |
272 | + ((flags & CHFL_BANNED) || !jbuf->jb_comment) ? | |
273 | ":%H" : "%H :%s", chan, jbuf->jb_comment); | |
274 | /* XXX: Shouldn't we send a PART here anyway? */ | |
275 | /* to users on the channel? Why? From their POV, the user isn't on | |
276 | diff -r e5a9f5ebb56d ircd/ircd_relay.c | |
277 | --- a/ircd/ircd_relay.c Sat Jan 31 18:37:49 2009 +0100 | |
278 | +++ b/ircd/ircd_relay.c Sat Jan 31 18:40:26 2009 +0100 | |
279 | @@ -87,7 +87,6 @@ | |
280 | void relay_channel_message(struct Client* sptr, const char* name, const char* text, const int targetc) | |
281 | { | |
282 | struct Channel* chptr; | |
283 | - const char *ch; | |
284 | assert(0 != sptr); | |
285 | assert(0 != name); | |
286 | assert(0 != text); | |
287 | @@ -99,35 +98,19 @@ | |
288 | /* | |
289 | * This first: Almost never a server/service | |
290 | */ | |
291 | - if (!client_can_send_to_channel(sptr, chptr, 1)) { | |
292 | + if (!client_can_send_to_channel(sptr, chptr, 1, | |
293 | + (MODE_NOCOLOUR | MODE_NOCTCP | MODE_NOMULTITARGET), text, targetc)) { | |
294 | send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname); | |
295 | return; | |
296 | } | |
297 | + /* TODO: what is this again? | |
298 | + * client_can_send_to_channel already reveals delayed join user | |
299 | + * locally anyway, and now the message gets denied? | |
300 | + * hmm... | |
301 | + */ | |
302 | if ((chptr->mode.mode & MODE_NOPRIVMSGS) && | |
303 | check_target_limit(sptr, chptr, chptr->chname, 0)) | |
304 | return; | |
305 | - | |
306 | - /* +T check */ | |
307 | - if ((chptr->mode.mode & MODE_NOMULTITARGET) && (targetc > 1)) { | |
308 | - send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname); | |
309 | - return; | |
310 | - } | |
311 | - | |
312 | - /* +cC checks */ | |
313 | - if (chptr->mode.mode & MODE_NOCOLOUR) | |
314 | - for (ch=text;*ch;ch++) | |
315 | - if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) { | |
316 | - send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname); | |
317 | - return; | |
318 | - } | |
319 | - | |
320 | - if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(text,"\001ACTION ",8)) | |
321 | - for (ch=text;*ch;) | |
322 | - if (*ch++==1) { | |
323 | - send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname); | |
324 | - return; | |
325 | - } | |
326 | - | |
327 | ||
328 | sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr), | |
329 | SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text); | |
330 | @@ -143,7 +126,6 @@ | |
331 | void relay_channel_notice(struct Client* sptr, const char* name, const char* text, const int targetc) | |
332 | { | |
333 | struct Channel* chptr; | |
334 | - const char *ch; | |
335 | assert(0 != sptr); | |
336 | assert(0 != name); | |
337 | assert(0 != text); | |
338 | @@ -153,31 +135,15 @@ | |
339 | /* | |
340 | * This first: Almost never a server/service | |
341 | */ | |
342 | - if (!client_can_send_to_channel(sptr, chptr, 1)) | |
343 | + if (!client_can_send_to_channel(sptr, chptr, 1, | |
344 | + (MODE_NONOTICE | MODE_NOCOLOUR | MODE_NOCTCP | MODE_NOMULTITARGET), text, targetc)) | |
345 | return; | |
346 | ||
347 | + /* TODO: idem as in previous function */ | |
348 | if ((chptr->mode.mode & MODE_NOPRIVMSGS) && | |
349 | check_target_limit(sptr, chptr, chptr->chname, 0)) | |
350 | return; | |
351 | ||
352 | - if ((chptr->mode.mode & MODE_NONOTICE)) | |
353 | - return; | |
354 | - | |
355 | - /* +T check */ | |
356 | - if ((chptr->mode.mode & MODE_NOMULTITARGET) && (targetc > 1)) | |
357 | - return; | |
358 | - | |
359 | - /* +cC checks */ | |
360 | - if (chptr->mode.mode & MODE_NOCOLOUR) | |
361 | - for (ch=text;*ch;ch++) | |
362 | - if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) | |
363 | - return; | |
364 | - | |
365 | - if (chptr->mode.mode & MODE_NOCTCP) | |
366 | - for (ch=text;*ch;) | |
367 | - if (*ch++==1) | |
368 | - return; | |
369 | - | |
370 | sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr), | |
371 | SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text); | |
372 | } | |
373 | @@ -204,7 +170,7 @@ | |
374 | * This first: Almost never a server/service | |
375 | * Servers may have channel services, need to check for it here | |
376 | */ | |
377 | - if (client_can_send_to_channel(sptr, chptr, 1) || IsChannelService(sptr)) { | |
378 | + if (client_can_send_to_channel(sptr, chptr, 1, 0, NULL, 1)) { | |
379 | sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr), | |
380 | SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text); | |
381 | } | |
382 | @@ -232,7 +198,8 @@ | |
383 | * This first: Almost never a server/service | |
384 | * Servers may have channel services, need to check for it here | |
385 | */ | |
386 | - if (client_can_send_to_channel(sptr, chptr, 1) || IsChannelService(sptr)) { | |
387 | + /* TODO: check how we get here */ | |
388 | + if (client_can_send_to_channel(sptr, chptr, 1, 0, NULL, 1)) { | |
389 | sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr), | |
390 | SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text); | |
391 | } | |
392 | diff -r e5a9f5ebb56d ircd/m_part.c | |
393 | --- a/ircd/m_part.c Sat Jan 31 18:37:49 2009 +0100 | |
394 | +++ b/ircd/m_part.c Sat Jan 31 18:40:26 2009 +0100 | |
395 | @@ -140,7 +140,8 @@ | |
396 | ||
397 | assert(!IsZombie(member)); /* Local users should never zombie */ | |
398 | ||
399 | - if (!member_can_send_to_channel(member, 0)) | |
400 | + /* check +u here or later somewhere in channel.c ? */ | |
401 | + if (!member_can_send_to_channel(member, 0, MODE_NOQUITPARTS, NULL, 1)) | |
402 | { | |
403 | flags |= CHFL_BANNED; | |
404 | /* Remote clients don't want to see a comment either. */ | |
405 | diff -r e5a9f5ebb56d ircd/m_quit.c | |
406 | --- a/ircd/m_quit.c Sat Jan 31 18:37:49 2009 +0100 | |
407 | +++ b/ircd/m_quit.c Sat Jan 31 18:40:26 2009 +0100 | |
408 | @@ -109,8 +109,8 @@ | |
409 | struct Membership* chan; | |
410 | /* (slug for +u) removed !IsDelayedJoin(chan) as splidge said to */ | |
411 | for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) { | |
412 | - if (!IsZombie(chan) && (!member_can_send_to_channel(chan, 0) | |
413 | - || (chan->channel->mode.mode & MODE_NOQUITPARTS))) | |
414 | + if (!IsZombie(chan) && (!member_can_send_to_channel(chan, 0, | |
415 | + MODE_NOQUITPARTS, NULL, 1))) | |
416 | return exit_client(cptr, sptr, sptr, "Signed off"); | |
417 | } | |
418 | } | |
419 | diff -r e5a9f5ebb56d ircd/m_topic.c | |
420 | --- a/ircd/m_topic.c Sat Jan 31 18:37:49 2009 +0100 | |
421 | +++ b/ircd/m_topic.c Sat Jan 31 18:40:26 2009 +0100 | |
422 | @@ -144,7 +144,7 @@ | |
423 | } | |
424 | else if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr)) | |
425 | send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname); | |
426 | - else if (!client_can_send_to_channel(sptr, chptr, 1)) | |
427 | + else if (!client_can_send_to_channel(sptr, chptr, 1, 0, NULL, 1)) | |
428 | send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname); | |
429 | else | |
430 | do_settopic(sptr,cptr,chptr,topic,0); | |
431 | diff -r e5a9f5ebb56d ircd/m_wallchops.c | |
432 | --- a/ircd/m_wallchops.c Sat Jan 31 18:37:49 2009 +0100 | |
433 | +++ b/ircd/m_wallchops.c Sat Jan 31 18:40:26 2009 +0100 | |
434 | @@ -103,7 +103,6 @@ | |
435 | { | |
436 | struct Channel *chptr; | |
437 | struct Membership* member; | |
438 | - const char *ch; | |
439 | ||
440 | assert(0 != cptr); | |
441 | assert(cptr == sptr); | |
442 | @@ -117,24 +116,13 @@ | |
443 | return send_reply(sptr, ERR_NOTEXTTOSEND); | |
444 | ||
445 | if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
446 | - if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) { | |
447 | + /* check also for modes +N +c and +C */ | |
448 | + if (client_can_send_to_channel(sptr, chptr, 0, | |
449 | + (MODE_NONOTICE | MODE_NOCOLOUR | MODE_NOCTCP), parv[parc - 1], 1)) { | |
450 | if ((chptr->mode.mode & MODE_NOPRIVMSGS) && | |
451 | check_target_limit(sptr, chptr, chptr->chname, 0)) | |
452 | return 0; | |
453 | ||
454 | - /* +cC checks */ | |
455 | - if (chptr->mode.mode & MODE_NOCOLOUR) | |
456 | - for (ch=parv[parc - 1];*ch;ch++) | |
457 | - if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) { | |
458 | - return 0; | |
459 | - } | |
460 | - | |
461 | - if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(parv[parc - 1],"\001ACTION ",8)) | |
462 | - for (ch=parv[parc - 1];*ch;) | |
463 | - if (*ch++==1) { | |
464 | - return 0; | |
465 | - } | |
466 | - | |
467 | /* Reveal delayedjoin user */ | |
468 | if ((member = find_member_link(chptr, cptr)) && IsDelayedJoin(member)) | |
469 | RevealDelayedJoin(member); | |
470 | @@ -165,7 +153,7 @@ | |
471 | return 0; | |
472 | ||
473 | if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
474 | - if (client_can_send_to_channel(sptr, chptr, 1)) { | |
475 | + if (client_can_send_to_channel(sptr, chptr, 1, 0, NULL, 1)) { | |
476 | sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr, | |
477 | SKIP_DEAF | SKIP_BURST | SKIP_NONOPS, | |
478 | "%H :%s", chptr, parv[parc - 1]); | |
479 | diff -r e5a9f5ebb56d ircd/m_wallvoices.c | |
480 | --- a/ircd/m_wallvoices.c Sat Jan 31 18:37:49 2009 +0100 | |
481 | +++ b/ircd/m_wallvoices.c Sat Jan 31 18:40:26 2009 +0100 | |
482 | @@ -102,7 +102,6 @@ | |
483 | { | |
484 | struct Channel *chptr; | |
485 | struct Membership* member; | |
486 | - const char *ch; | |
487 | ||
488 | assert(0 != cptr); | |
489 | assert(cptr == sptr); | |
490 | @@ -116,24 +115,12 @@ | |
491 | return send_reply(sptr, ERR_NOTEXTTOSEND); | |
492 | ||
493 | if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
494 | - if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) { | |
495 | + if (client_can_send_to_channel(sptr, chptr, 0, | |
496 | + (MODE_NONOTICE | MODE_NOCOLOUR | MODE_NOCTCP), parv[parc - 1], 1)) { | |
497 | if ((chptr->mode.mode & MODE_NOPRIVMSGS) && | |
498 | check_target_limit(sptr, chptr, chptr->chname, 0)) | |
499 | return 0; | |
500 | ||
501 | - /* +cC checks */ | |
502 | - if (chptr->mode.mode & MODE_NOCOLOUR) | |
503 | - for (ch=parv[parc - 1];*ch;ch++) | |
504 | - if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) { | |
505 | - return 0; | |
506 | - } | |
507 | - | |
508 | - if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(parv[parc - 1],"\001ACTION ",8)) | |
509 | - for (ch=parv[parc - 1];*ch;) | |
510 | - if (*ch++==1) { | |
511 | - return 0; | |
512 | - } | |
513 | - | |
514 | /* Reveal delayedjoin user */ | |
515 | if ((member = find_member_link(chptr, cptr)) && IsDelayedJoin(member)) | |
516 | RevealDelayedJoin(member); | |
517 | @@ -164,7 +151,7 @@ | |
518 | return 0; | |
519 | ||
520 | if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
521 | - if (client_can_send_to_channel(sptr, chptr, 1)) { | |
522 | + if (client_can_send_to_channel(sptr, chptr, 1, 0, NULL, 1)) { | |
523 | sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr, | |
524 | SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES, | |
525 | "%H :%s", chptr, parv[parc - 1]); |