]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/irc-channel.c
Implement channel mode 'O': "IRC operators only"
[ngircd-alex.git] / src / ngircd / irc-channel.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  *
11  * IRC channel commands
12  */
13
14
15 #include "portab.h"
16
17 #include "imp.h"
18 #include <assert.h>
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <string.h>
22
23 #include "defines.h"
24 #include "conn.h"
25 #include "channel.h"
26 #include "conn-func.h"
27 #include "lists.h"
28 #include "log.h"
29 #include "match.h"
30 #include "messages.h"
31 #include "parse.h"
32 #include "irc-info.h"
33 #include "irc-write.h"
34 #include "conf.h"
35
36 #include "exp.h"
37 #include "irc-channel.h"
38
39
40 /*
41  * RFC 2812, (3.2.1 Join message Command):
42  *  Note that this message
43  *  accepts a special argument ("0"), which is a special request to leave all
44  *  channels the user is currently a member of. The server will process this
45  *  message as if the user had sent a PART command (See Section 3.2.2) for
46  *  each channel he is a member of.
47  */
48 static bool
49 part_from_all_channels(CLIENT* client, CLIENT *target)
50 {
51         CL2CHAN *cl2chan;
52         CHANNEL *chan;
53
54         while ((cl2chan = Channel_FirstChannelOf(target))) {
55                 chan = Channel_GetChannel(cl2chan);
56                 assert( chan != NULL );
57                 Channel_Part(target, client, Channel_Name(chan), Client_ID(target));
58         }
59         return CONNECTED;
60 }
61
62
63 /**
64  * Check weather a local client is allowed to join an already existing
65  * channel or not.
66  * @param Client Client that sent the JOIN command
67  * @param chan Channel to check
68  * @param channame Name of the channel
69  * @param key Provided channel key (or NULL if none has been provided)
70  * @return true if client is allowed to join channel, false otherwise
71  */
72 static bool
73 join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
74              const char *key)
75 {
76         bool is_invited, is_banned;
77         const char *channel_modes;
78
79         /* Allow IRC operators to overwrite channel limits */
80         if (strchr(Client_Modes(Client), 'o'))
81                 return true;
82
83         is_banned = Lists_Check(Channel_GetListBans(chan), Client);
84         is_invited = Lists_Check(Channel_GetListInvites(chan), Client);
85
86         if (is_banned && !is_invited) {
87                 /* Client is banned from channel (and not on invite list) */
88                 IRC_WriteStrClient(Client, ERR_BANNEDFROMCHAN_MSG,
89                                    Client_ID(Client), channame);
90                 return false;
91         }
92
93         channel_modes = Channel_Modes(chan);
94         if (strchr(channel_modes, 'i') && !is_invited) {
95                 /* Channel is "invite-only" and client is not on invite list */
96                 IRC_WriteStrClient(Client, ERR_INVITEONLYCHAN_MSG,
97                                    Client_ID(Client), channame);
98                 return false;
99         }
100
101         if (!Channel_CheckKey(chan, Client, key ? key : "")) {
102                 /* Channel is protected by a channel key and the client
103                  * didn't specify the correct one */
104                 IRC_WriteStrClient(Client, ERR_BADCHANNELKEY_MSG,
105                                    Client_ID(Client), channame);
106                 return false;
107         }
108
109         if (strchr(channel_modes, 'l') &&
110             (Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) {
111                 /* There are more clints joined to this channel than allowed */
112                 IRC_WriteStrClient(Client, ERR_CHANNELISFULL_MSG,
113                                    Client_ID(Client), channame);
114                 return false;
115         }
116
117         if (strchr(channel_modes, 'z') && !Conn_UsesSSL(Client_Conn(Client))) {
118                 /* Only "secure" clients are allowed, but clients doesn't
119                  * use SSL encryption */
120                 IRC_WriteStrClient(Client, ERR_SECURECHANNEL_MSG,
121                                    Client_ID(Client), channame);
122                 return false;
123         }
124
125         if (strchr(channel_modes, 'O') && !Client_OperByMe(Client)) {
126                 /* Only IRC operators are allowed! */
127                 IRC_WriteStrClient(Client, ERR_OPONLYCHANNEL_MSG,
128                                    Client_ID(Client), channame);
129                 return false;
130         }
131
132         return true;
133 }
134
135
136 static void
137 join_set_channelmodes(CHANNEL *chan, CLIENT *target, const char *flags)
138 {
139         if (flags) {
140                 while (*flags) {
141                         Channel_UserModeAdd(chan, target, *flags);
142                         flags++;
143                 }
144         }
145
146         /* If channel persistent and client is ircop: make client chanop */
147         if (strchr(Channel_Modes(chan), 'P') && strchr(Client_Modes(target), 'o'))
148                 Channel_UserModeAdd(chan, target, 'o');
149 }
150
151
152 static void
153 cb_join_forward(CLIENT *To, CLIENT *Prefix, void *Data)
154 {
155         CONN_ID conn;
156         char str[COMMAND_LEN], *ptr = NULL;
157
158         strlcpy(str, (char *)Data, sizeof(str));
159         conn = Client_Conn(To);
160
161         if (Conn_Options(conn) & CONN_RFC1459) {
162                 /* RFC 1459 compatibility mode, appended modes are NOT
163                  * supported, so strip them off! */
164                 ptr = strchr(str, 0x7);
165                 if (ptr)
166                         *ptr++ = '\0';
167         }
168
169         IRC_WriteStrClientPrefix(To, Prefix, "JOIN %s", str);
170         if (ptr && *ptr)
171                 IRC_WriteStrClientPrefix(To, Prefix, "MODE %s +%s %s", str, ptr,
172                                          Client_ID(Prefix));
173 } /* cb_join_forward */
174
175
176 static void
177 join_forward(CLIENT *Client, CLIENT *target, CHANNEL *chan,
178                                         const char *channame)
179 {
180         char modes[CHANNEL_MODE_LEN], str[COMMAND_LEN];
181
182         strlcpy(&modes[1], Channel_UserModes(chan, target), sizeof(modes) - 1);
183         if (modes[1])
184                 modes[0] = 0x7;
185         else
186                 modes[0] = '\0';
187
188         /* forward to other servers (if it is not a local channel) */
189         if (!Channel_IsLocal(chan)) {
190                 snprintf(str, sizeof(str), "%s%s", channame, modes);
191                 IRC_WriteStrServersPrefixFlag_CB(Client, target, '\0',
192                                                  cb_join_forward, str);
193         }
194
195         /* tell users in this channel about the new client */
196         IRC_WriteStrChannelPrefix(Client, chan, target, false,
197                                   "JOIN :%s",  channame);
198
199         /* syncronize channel modes */
200         if (modes[1]) {
201                 IRC_WriteStrChannelPrefix(Client, chan, target, false,
202                                           "MODE %s +%s %s", channame,
203                                           &modes[1], Client_ID(target));
204         }
205 } /* join_forward */
206
207
208 static bool
209 join_send_topic(CLIENT *Client, CLIENT *target, CHANNEL *chan,
210                                         const char *channame)
211 {
212         const char *topic;
213
214         if (Client_Type(Client) != CLIENT_USER)
215                 return true;
216         /* acknowledge join */
217         if (!IRC_WriteStrClientPrefix(Client, target, "JOIN :%s", channame))
218                 return false;
219
220         /* Send topic to client, if any */
221         topic = Channel_Topic(chan);
222         assert(topic != NULL);
223         if (*topic) {
224                 if (!IRC_WriteStrClient(Client, RPL_TOPIC_MSG,
225                         Client_ID(Client), channame, topic))
226                                 return false;
227 #ifndef STRICT_RFC
228                 if (!IRC_WriteStrClient(Client, RPL_TOPICSETBY_MSG,
229                         Client_ID(Client), channame,
230                         Channel_TopicWho(chan),
231                         Channel_TopicTime(chan)))
232                                 return false;
233 #endif
234         }
235         /* send list of channel members to client */
236         if (!IRC_Send_NAMES(Client, chan))
237                 return false;
238         return IRC_WriteStrClient(Client, RPL_ENDOFNAMES_MSG, Client_ID(Client), Channel_Name(chan));
239 }
240
241
242 GLOBAL bool
243 IRC_JOIN( CLIENT *Client, REQUEST *Req )
244 {
245         char *channame, *key = NULL, *flags, *lastkey = NULL, *lastchan = NULL;
246         CLIENT *target;
247         CHANNEL *chan;
248
249         assert( Client != NULL );
250         assert( Req != NULL );
251
252         /* Bad number of arguments? */
253         if (Req->argc < 1 || Req->argc > 2)
254                 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
255                                           Client_ID(Client), Req->command);
256
257         /* Who is the sender? */
258         if (Client_Type(Client) == CLIENT_SERVER)
259                 target = Client_Search(Req->prefix);
260         else
261                 target = Client;
262
263         if (!target)
264                 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix);
265
266         /* Is argument "0"? */
267         if (Req->argc == 1 && !strncmp("0", Req->argv[0], 2))
268                 return part_from_all_channels(Client, target);
269
270         /* Are channel keys given? */
271         if (Req->argc > 1)
272                 key = strtok_r(Req->argv[1], ",", &lastkey);
273
274         channame = Req->argv[0];
275         channame = strtok_r(channame, ",", &lastchan);
276
277         /* Make sure that "channame" is not the empty string ("JOIN :") */
278         if (! channame)
279                 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
280                                           Client_ID(Client), Req->command);
281
282         while (channame) {
283                 flags = NULL;
284
285                 /* Did the server include channel-user-modes? */
286                 if (Client_Type(Client) == CLIENT_SERVER) {
287                         flags = strchr(channame, 0x7);
288                         if (flags) {
289                                 *flags = '\0';
290                                 flags++;
291                         }
292                 }
293
294                 chan = Channel_Search(channame);
295                 if (!chan && Conf_PredefChannelsOnly) {
296                          /* channel must be created, but server does not allow this */
297                         IRC_WriteStrClient(Client, ERR_BANNEDFROMCHAN_MSG, Client_ID(Client), channame);
298                         break;
299                 }
300
301                 /* Local client? */
302                 if (Client_Type(Client) == CLIENT_USER) {
303                         /* Test if the user has reached the channel limit */
304                         if ((Conf_MaxJoins > 0) &&
305                             (Channel_CountForUser(Client) >= Conf_MaxJoins))
306                                 return IRC_WriteStrClient(Client,
307                                                 ERR_TOOMANYCHANNELS_MSG,
308                                                 Client_ID(Client), channame);
309                         if (chan) {
310                                 /* Already existing channel: check if the
311                                  * client is allowed to join */
312                                 if (!join_allowed(Client, chan, channame, key))
313                                         break;
314                         } else {
315                                 /* New channel: first user will become channel
316                                  * operator unless this is a modeless channel */
317                                 if (*channame != '+')
318                                         flags = "o";
319                         }
320
321                         /* Local client: update idle time */
322                         Conn_UpdateIdle(Client_Conn(Client));
323                 } else {
324                         /* Remote server: we don't need to know whether the
325                          * client is invited or not, but we have to make sure
326                          * that the "one shot" entries (generated by INVITE
327                          * commands) in this list become deleted when a user
328                          * joins a channel this way. */
329                         if (chan)
330                                 (void)Lists_Check(Channel_GetListInvites(chan),
331                                                   target);
332                 }
333
334                 /* Join channel (and create channel if it doesn't exist) */
335                 if (!Channel_Join(target, channame))
336                         break;
337
338                 if (!chan) { /* channel is new; it has been created above */
339                         chan = Channel_Search(channame);
340                         assert(chan != NULL);
341                         if (Channel_IsModeless(chan)) {
342                                 Channel_ModeAdd(chan, 't'); /* /TOPIC not allowed */
343                                 Channel_ModeAdd(chan, 'n'); /* no external msgs */
344                         }
345                 }
346                 assert(chan != NULL);
347
348                 join_set_channelmodes(chan, target, flags);
349
350                 join_forward(Client, target, chan, channame);
351
352                 if (!join_send_topic(Client, target, chan, channame))
353                         break; /* write error */
354
355                 /* next channel? */
356                 channame = strtok_r(NULL, ",", &lastchan);
357                 if (channame && key)
358                         key = strtok_r(NULL, ",", &lastkey);
359         }
360         return CONNECTED;
361 } /* IRC_JOIN */
362
363
364 /**
365  * Handler for the IRC "PART" command.
366  */
367 GLOBAL bool
368 IRC_PART(CLIENT * Client, REQUEST * Req)
369 {
370         CLIENT *target;
371         char *chan;
372
373         assert(Client != NULL);
374         assert(Req != NULL);
375
376         if (Req->argc < 1 || Req->argc > 2)
377                 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
378                                           Client_ID(Client), Req->command);
379
380         /* Get the sender */
381         if (Client_Type(Client) == CLIENT_SERVER)
382                 target = Client_Search(Req->prefix);
383         else
384                 target = Client;
385         if (!target)
386                 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
387                                           Client_ID(Client), Req->prefix);
388
389         /* Loop over all the given channel names */
390         chan = strtok(Req->argv[0], ",");
391
392         /* Make sure that "chan" is not the empty string ("PART :") */
393         if (! chan)
394                 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
395                                           Client_ID(Client), Req->command);
396
397         while (chan) {
398                 Channel_Part(target, Client, chan,
399                              Req->argc > 1 ? Req->argv[1] : Client_ID(target));
400                 chan = strtok(NULL, ",");
401         }
402
403         /* Update idle time, if local client */
404         if (Client_Conn(Client) > NONE)
405                 Conn_UpdateIdle(Client_Conn(Client));
406
407         return CONNECTED;
408 } /* IRC_PART */
409
410
411 GLOBAL bool
412 IRC_TOPIC( CLIENT *Client, REQUEST *Req )
413 {
414         CHANNEL *chan;
415         CLIENT *from;
416         char *topic;
417         bool onchannel, topicok, use_servermode, r;
418
419         assert( Client != NULL );
420         assert( Req != NULL );
421
422         if (Req->argc < 1 || Req->argc > 2)
423                 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
424                                           Client_ID(Client), Req->command);
425
426         if (Client_Type(Client) == CLIENT_SERVER)
427                 from = Client_Search(Req->prefix);
428         else
429                 from = Client;
430
431         if (!from)
432                 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
433                                           Client_ID(Client), Req->prefix);
434
435         chan = Channel_Search(Req->argv[0]);
436         if (!chan)
437                 return IRC_WriteStrClient(from, ERR_NOSUCHCHANNEL_MSG,
438                                           Client_ID(from), Req->argv[0]);
439
440         Channel_CheckAdminRights(chan, Client, from,
441                                  &onchannel, &topicok, &use_servermode);
442
443         if (!onchannel && !topicok)
444                 return IRC_WriteStrClient(from, ERR_NOTONCHANNEL_MSG,
445                                           Client_ID(from), Req->argv[0]);
446
447         if (Req->argc == 1) {
448                 /* Request actual topic */
449                 topic = Channel_Topic(chan);
450                 if (*topic) {
451                         r = IRC_WriteStrClient(from, RPL_TOPIC_MSG,
452                                                Client_ID(Client),
453                                                Channel_Name(chan), topic);
454 #ifndef STRICT_RFC
455                         r = IRC_WriteStrClient(from, RPL_TOPICSETBY_MSG,
456                                                Client_ID(Client),
457                                                Channel_Name(chan),
458                                                Channel_TopicWho(chan),
459                                                Channel_TopicTime(chan));
460 #endif
461                         return r;
462                 }
463                 else
464                         return IRC_WriteStrClient(from, RPL_NOTOPIC_MSG,
465                                                   Client_ID(from),
466                                                   Channel_Name(chan));
467         }
468
469         if (strchr(Channel_Modes(chan), 't')) {
470                 /* Topic Lock. Is the user a channel or IRC operator? */
471                 if (!topicok)
472                         return IRC_WriteStrClient(from, ERR_CHANOPRIVSNEEDED_MSG,
473                                                   Client_ID(from),
474                                                   Channel_Name(chan));
475         }
476
477         /* Set new topic */
478         Channel_SetTopic(chan, from, Req->argv[1]);
479         LogDebug("%s \"%s\" set topic on \"%s\": %s",
480                  Client_TypeText(from), Client_Mask(from), Channel_Name(chan),
481                  Req->argv[1][0] ? Req->argv[1] : "<none>");
482
483         if (use_servermode)
484                 from = Client_ThisServer();
485
486         /* Update channel and forward new topic to other servers */
487         if (!Channel_IsLocal(chan))
488                 IRC_WriteStrServersPrefix(Client, from, "TOPIC %s :%s",
489                                           Req->argv[0], Req->argv[1]);
490         IRC_WriteStrChannelPrefix(Client, chan, from, false, "TOPIC %s :%s",
491                                   Req->argv[0], Req->argv[1]);
492
493         if (Client_Type(Client) == CLIENT_USER)
494                 return IRC_WriteStrClientPrefix(Client, Client, "TOPIC %s :%s",
495                                                 Req->argv[0], Req->argv[1]);
496         else
497                 return CONNECTED;
498 } /* IRC_TOPIC */
499
500
501 /**
502  * Handler for the IRC "LIST" command.
503  * This implementation handles the local case as well as the forwarding of the
504  * LIST command to other servers in the IRC network.
505  */
506 GLOBAL bool
507 IRC_LIST( CLIENT *Client, REQUEST *Req )
508 {
509         char *pattern;
510         CHANNEL *chan;
511         CLIENT *from, *target;
512
513         assert( Client != NULL );
514         assert( Req != NULL );
515
516         /* Bad number of prameters? */
517         if( Req->argc > 2 )
518                 return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG,
519                         Client_ID( Client ), Req->command );
520
521         if( Req->argc > 0 )
522                 pattern = strtok( Req->argv[0], "," );
523         else
524                 pattern = "*";
525
526         /* Get sender from prefix, if any */
527         if( Client_Type( Client ) == CLIENT_SERVER )
528                 from = Client_Search( Req->prefix );
529         else
530                 from = Client;
531
532         if( ! from )
533                 return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG,
534                                 Client_ID( Client ), Req->prefix );
535
536         if( Req->argc == 2 )
537         {
538                 /* Forward to other server? */
539                 target = Client_Search( Req->argv[1] );
540                 if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER ))
541                         return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG,
542                                         Client_ID( Client ), Req->argv[1] );
543
544                 if( target != Client_ThisServer( ))
545                 {
546                         /* Target is indeed an other server, forward it! */
547                         return IRC_WriteStrClientPrefix( target, from,
548                                         "LIST %s :%s", Client_ID( from ),
549                                         Req->argv[1] );
550                 }
551         }
552
553         while( pattern )
554         {
555                 /* Loop through all the channels */
556                 chan = Channel_First( );
557                 while( chan )
558                 {
559                         /* Check search pattern */
560                         if( Match( pattern, Channel_Name( chan )))
561                         {
562                                 /* Gotcha! */
563                                 if( ! strchr( Channel_Modes( chan ), 's' ) ||
564                                     Channel_IsMemberOf( chan, from ))
565                                 {
566                                         if( ! IRC_WriteStrClient( from,
567                                             RPL_LIST_MSG, Client_ID( from ),
568                                             Channel_Name( chan ),
569                                             Channel_MemberCount( chan ),
570                                             Channel_Topic( chan )))
571                                                 return DISCONNECTED;
572                                 }
573                         }
574                         chan = Channel_Next( chan );
575                 }
576
577                 /* Get next name ... */
578                 if( Req->argc > 0 )
579                         pattern = strtok( NULL, "," );
580                 else
581                         pattern = NULL;
582         }
583
584         return IRC_WriteStrClient( from, RPL_LISTEND_MSG, Client_ID( from ));
585 } /* IRC_LIST */
586
587
588 GLOBAL bool
589 IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
590 {
591         char modes_add[COMMAND_LEN], l[16], *ptr;
592         CLIENT *from;
593         CHANNEL *chan;
594         int arg_topic;
595
596         assert( Client != NULL );
597         assert( Req != NULL );
598
599         /* Bad number of parameters? */
600         if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
601
602         /* Compatibility kludge */
603         if( Req->argc == 5 ) arg_topic = 4;
604         else if( Req->argc == 3 ) arg_topic = 2;
605         else arg_topic = -1;
606
607         /* Search origin */
608         from = Client_Search( Req->prefix );
609         if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
610
611         /* Search or create channel */
612         chan = Channel_Search( Req->argv[0] );
613         if( ! chan ) chan = Channel_Create( Req->argv[0] );
614         if( ! chan ) return CONNECTED;
615
616         if( Req->argv[1][0] == '+' )
617         {
618                 ptr = Channel_Modes( chan );
619                 if( ! *ptr )
620                 {
621                         /* OK, this channel doesn't have modes jet, set the received ones: */
622                         Channel_SetModes( chan, &Req->argv[1][1] );
623
624                         if( Req->argc == 5 )
625                         {
626                                 if( strchr( Channel_Modes( chan ), 'k' )) Channel_SetKey( chan, Req->argv[2] );
627                                 if( strchr( Channel_Modes( chan ), 'l' )) Channel_SetMaxUsers( chan, atol( Req->argv[3] ));
628                         }
629                         else
630                         {
631                                 /* Delete modes which we never want to inherit */
632                                 Channel_ModeDel( chan, 'l' );
633                                 Channel_ModeDel( chan, 'k' );
634                         }
635
636                         strcpy( modes_add, "" );
637                         ptr = Channel_Modes( chan );
638                         while( *ptr )
639                         {
640                                 if( *ptr == 'l' )
641                                 {
642                                         snprintf( l, sizeof( l ), " %lu", Channel_MaxUsers( chan ));
643                                         strlcat( modes_add, l, sizeof( modes_add ));
644                                 }
645                                 if( *ptr == 'k' )
646                                 {
647                                         strlcat( modes_add, " ", sizeof( modes_add ));
648                                         strlcat( modes_add, Channel_Key( chan ), sizeof( modes_add ));
649                                 }
650                                 ptr++;
651                         }
652
653                         /* Inform members of this channel */
654                         IRC_WriteStrChannelPrefix( Client, chan, from, false, "MODE %s +%s%s", Req->argv[0], Channel_Modes( chan ), modes_add );
655                 }
656         }
657         else Log( LOG_WARNING, "CHANINFO: invalid MODE format ignored!" );
658
659         if( arg_topic > 0 )
660         {
661                 /* We got a topic */
662                 ptr = Channel_Topic( chan );
663                 if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
664                 {
665                         /* OK, there is no topic jet */
666                         Channel_SetTopic(chan, Client, Req->argv[arg_topic]);
667                         IRC_WriteStrChannelPrefix(Client, chan, from, false,
668                              "TOPIC %s :%s", Req->argv[0], Channel_Topic(chan));
669                 }
670         }
671
672         /* Forward CHANINFO to other serevrs */
673         if( Req->argc == 5 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4] );
674         else if( Req->argc == 3 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
675         else IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1] );
676
677         return CONNECTED;
678 } /* IRC_CHANINFO */
679
680
681 /* -eof- */