2 38b9cb88 2001-12-14 alex * ngIRCd -- The Next Generation IRC Daemon
3 03d971d9 2002-01-02 alex * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 38b9cb88 2001-12-14 alex * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
6 38b9cb88 2001-12-14 alex * der GNU General Public License (GPL), wie von der Free Software Foundation
7 38b9cb88 2001-12-14 alex * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
8 38b9cb88 2001-12-14 alex * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
9 38b9cb88 2001-12-14 alex * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
10 804b1ec4 2001-12-31 alex * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
12 c7408364 2002-03-25 alex * $Id: irc.c,v 1.89 2002/03/25 17:04:02 alex Exp $
14 38b9cb88 2001-12-14 alex * irc.c: IRC-Befehle
18 ca33cbda 2002-03-12 alex #include "portab.h"
20 ca33cbda 2002-03-12 alex #include "imp.h"
21 38b9cb88 2001-12-14 alex #include <assert.h>
22 574ae82c 2001-12-26 alex #include <errno.h>
23 2a13cd22 2001-12-23 alex #include <stdio.h>
24 bf1c59c6 2002-01-04 alex #include <stdlib.h>
25 2a13cd22 2001-12-23 alex #include <string.h>
27 ac9da09e 2001-12-30 alex #include "ngircd.h"
28 87fc9566 2002-01-21 alex #include "channel.h"
29 2a13cd22 2001-12-23 alex #include "client.h"
30 574ae82c 2001-12-26 alex #include "conf.h"
31 804b1ec4 2001-12-31 alex #include "conn.h"
32 ef7f7a90 2002-02-27 alex #include "irc-write.h"
33 2a13cd22 2001-12-23 alex #include "log.h"
34 2a13cd22 2001-12-23 alex #include "messages.h"
35 804b1ec4 2001-12-31 alex #include "tool.h"
37 ca33cbda 2002-03-12 alex #include "exp.h"
38 38b9cb88 2001-12-14 alex #include "irc.h"
41 bbfe9e8b 2001-12-25 alex GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
43 bbfe9e8b 2001-12-25 alex assert( Client != NULL );
44 bbfe9e8b 2001-12-25 alex assert( Req != NULL );
46 bed4005e 2002-01-04 alex if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
48 bbfe9e8b 2001-12-25 alex /* Falsche Anzahl Parameter? */
49 bed4005e 2002-01-04 alex if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
51 ef7f7a90 2002-02-27 alex return IRC_Show_MOTD( Client );
52 bbfe9e8b 2001-12-25 alex } /* IRC_MOTD */
55 72ebf4f2 2001-12-27 alex GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
57 cd6e4049 2002-02-27 alex CLIENT *cl, *from;
58 92fb409f 2002-01-26 alex CHANNEL *chan;
60 72ebf4f2 2001-12-27 alex assert( Client != NULL );
61 72ebf4f2 2001-12-27 alex assert( Req != NULL );
63 db58d347 2002-01-05 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
65 72ebf4f2 2001-12-27 alex /* Falsche Anzahl Parameter? */
66 bed4005e 2002-01-04 alex if( Req->argc == 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
67 bed4005e 2002-01-04 alex if( Req->argc == 1 ) return IRC_WriteStrClient( Client, ERR_NOTEXTTOSEND_MSG, Client_ID( Client ));
68 bed4005e 2002-01-04 alex if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
70 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
71 db58d347 2002-01-05 alex else from = Client;
72 c2ee5437 2002-01-11 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
74 cd6e4049 2002-02-27 alex cl = Client_Search( Req->argv[0] );
77 72ebf4f2 2001-12-27 alex /* Okay, Ziel ist ein User */
78 3c01ac4e 2002-02-27 alex if(( Client_Type( Client ) != CLIENT_SERVER ) && ( strchr( Client_Modes( cl ), 'a' )))
80 3c01ac4e 2002-02-27 alex /* Ziel-User ist AWAY: Meldung verschicken */
81 3c01ac4e 2002-02-27 alex if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( cl ), Client_Away( cl ))) return DISCONNECTED;
84 3c01ac4e 2002-02-27 alex /* Text senden */
85 92fb409f 2002-01-26 alex if( Client_Conn( from ) > NONE ) Conn_UpdateIdle( Client_Conn( from ));
86 cd6e4049 2002-02-27 alex return IRC_WriteStrClientPrefix( cl, from, "PRIVMSG %s :%s", Client_ID( cl ), Req->argv[1] );
89 92fb409f 2002-01-26 alex chan = Channel_Search( Req->argv[0] );
90 c7408364 2002-03-25 alex if( chan ) return Channel_Write( chan, from, Client, Req->argv[1] );
92 92fb409f 2002-01-26 alex return IRC_WriteStrClient( from, ERR_NOSUCHNICK_MSG, Client_ID( from ), Req->argv[0] );
93 72ebf4f2 2001-12-27 alex } /* IRC_PRIVMSG */
96 72ebf4f2 2001-12-27 alex GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req )
98 db58d347 2002-01-05 alex CLIENT *to, *from;
100 72ebf4f2 2001-12-27 alex assert( Client != NULL );
101 72ebf4f2 2001-12-27 alex assert( Req != NULL );
103 db58d347 2002-01-05 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
105 72ebf4f2 2001-12-27 alex /* Falsche Anzahl Parameter? */
106 72ebf4f2 2001-12-27 alex if( Req->argc != 2 ) return CONNECTED;
108 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
109 db58d347 2002-01-05 alex else from = Client;
110 c2ee5437 2002-01-11 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
112 72ebf4f2 2001-12-27 alex to = Client_Search( Req->argv[0] );
115 72ebf4f2 2001-12-27 alex /* Okay, Ziel ist ein User */
116 db58d347 2002-01-05 alex return IRC_WriteStrClientPrefix( to, from, "NOTICE %s :%s", Client_ID( to ), Req->argv[1] );
118 db58d347 2002-01-05 alex else return CONNECTED;
119 72ebf4f2 2001-12-27 alex } /* IRC_NOTICE */
122 fb9d6ce1 2001-12-31 alex GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req )
124 180095be 2002-02-27 alex CHAR rpl[COMMAND_LEN], *ptr;
125 180095be 2002-02-27 alex CLIENT *target, *from, *c;
126 180095be 2002-02-27 alex CHANNEL *chan;
128 fb9d6ce1 2001-12-31 alex assert( Client != NULL );
129 fb9d6ce1 2001-12-31 alex assert( Req != NULL );
131 180095be 2002-02-27 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
133 fb9d6ce1 2001-12-31 alex /* Falsche Anzahl Parameter? */
134 180095be 2002-02-27 alex if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
136 180095be 2002-02-27 alex /* From aus Prefix ermitteln */
137 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
138 180095be 2002-02-27 alex else from = Client;
139 180095be 2002-02-27 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
141 180095be 2002-02-27 alex if( Req->argc == 2 )
143 180095be 2002-02-27 alex /* an anderen Server forwarden */
144 c7408364 2002-03-25 alex target = Client_Search( Req->argv[1] );
145 180095be 2002-02-27 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
147 180095be 2002-02-27 alex if( target != Client_ThisServer( ))
149 180095be 2002-02-27 alex /* Ok, anderer Server ist das Ziel: forwarden */
150 180095be 2002-02-27 alex return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
154 180095be 2002-02-27 alex if( Req->argc > 0 )
156 180095be 2002-02-27 alex /* bestimmte Channels durchgehen */
157 180095be 2002-02-27 alex ptr = strtok( Req->argv[0], "," );
158 180095be 2002-02-27 alex while( ptr )
160 180095be 2002-02-27 alex chan = Channel_Search( ptr );
163 180095be 2002-02-27 alex /* Namen ausgeben */
164 ef7f7a90 2002-02-27 alex if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
166 180095be 2002-02-27 alex if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
168 180095be 2002-02-27 alex /* naechsten Namen ermitteln */
169 180095be 2002-02-27 alex ptr = strtok( NULL, "," );
171 180095be 2002-02-27 alex return CONNECTED;
174 180095be 2002-02-27 alex /* alle Channels durchgehen */
175 180095be 2002-02-27 alex chan = Channel_First( );
176 180095be 2002-02-27 alex while( chan )
178 180095be 2002-02-27 alex /* Namen ausgeben */
179 ef7f7a90 2002-02-27 alex if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
181 180095be 2002-02-27 alex /* naechster Channel */
182 180095be 2002-02-27 alex chan = Channel_Next( chan );
185 c147ebef 2002-02-27 alex /* Nun noch alle Clients ausgeben, die in keinem Channel sind */
186 180095be 2002-02-27 alex c = Client_First( );
187 180095be 2002-02-27 alex sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
190 c147ebef 2002-02-27 alex if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
192 180095be 2002-02-27 alex /* Okay, das ist ein User: anhaengen */
193 180095be 2002-02-27 alex if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
194 180095be 2002-02-27 alex strcat( rpl, Client_ID( c ));
196 180095be 2002-02-27 alex if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
198 180095be 2002-02-27 alex /* Zeile wird zu lang: senden! */
199 180095be 2002-02-27 alex if( ! IRC_WriteStrClient( from, rpl )) return DISCONNECTED;
200 180095be 2002-02-27 alex sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
204 180095be 2002-02-27 alex /* naechster Client */
205 fb9d6ce1 2001-12-31 alex c = Client_Next( c );
207 180095be 2002-02-27 alex if( rpl[strlen( rpl ) - 1] != ':')
209 fb9d6ce1 2001-12-31 alex /* es wurden User gefunden */
210 180095be 2002-02-27 alex if( ! IRC_WriteStrClient( from, rpl )) return DISCONNECTED;
213 180095be 2002-02-27 alex return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
214 fb9d6ce1 2001-12-31 alex } /* IRC_NAMES */
217 804b1ec4 2001-12-31 alex GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req )
219 804b1ec4 2001-12-31 alex CHAR rpl[COMMAND_LEN];
224 804b1ec4 2001-12-31 alex assert( Client != NULL );
225 804b1ec4 2001-12-31 alex assert( Req != NULL );
227 bed4005e 2002-01-04 alex if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
229 804b1ec4 2001-12-31 alex /* Falsche Anzahl Parameter? */
230 bed4005e 2002-01-04 alex if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
232 804b1ec4 2001-12-31 alex strcpy( rpl, RPL_ISON_MSG );
233 804b1ec4 2001-12-31 alex for( i = 0; i < Req->argc; i++ )
235 804b1ec4 2001-12-31 alex ptr = strtok( Req->argv[i], " " );
236 804b1ec4 2001-12-31 alex while( ptr )
238 804b1ec4 2001-12-31 alex ngt_TrimStr( ptr );
239 c7408364 2002-03-25 alex c = Client_Search( ptr );
240 bf1c59c6 2002-01-04 alex if( c && ( Client_Type( c ) == CLIENT_USER ))
242 804b1ec4 2001-12-31 alex /* Dieser Nick ist "online" */
243 804b1ec4 2001-12-31 alex strcat( rpl, ptr );
244 804b1ec4 2001-12-31 alex strcat( rpl, " " );
246 804b1ec4 2001-12-31 alex ptr = strtok( NULL, " " );
249 804b1ec4 2001-12-31 alex if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
251 bed4005e 2002-01-04 alex return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
252 804b1ec4 2001-12-31 alex } /* IRC_ISON */
255 804b1ec4 2001-12-31 alex GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req )
257 e44988f2 2002-01-05 alex CLIENT *from, *target, *c;
258 eab20bee 2002-01-29 alex CHAR str[LINE_LEN + 1], *ptr = NULL;
259 eab20bee 2002-01-29 alex CL2CHAN *cl2chan;
260 0595f42f 2002-02-11 alex CHANNEL *chan;
262 804b1ec4 2001-12-31 alex assert( Client != NULL );
263 804b1ec4 2001-12-31 alex assert( Req != NULL );
265 db58d347 2002-01-05 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
267 804b1ec4 2001-12-31 alex /* Falsche Anzahl Parameter? */
268 bed4005e 2002-01-04 alex if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
270 804b1ec4 2001-12-31 alex /* Client suchen */
271 c7408364 2002-03-25 alex c = Client_Search( Req->argv[Req->argc - 1] );
272 e44988f2 2002-01-05 alex if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
274 db58d347 2002-01-05 alex /* Empfaenger des WHOIS suchen */
275 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
276 e44988f2 2002-01-05 alex else from = Client;
277 e44988f2 2002-01-05 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
279 e44988f2 2002-01-05 alex /* Forwarden an anderen Server? */
280 e44988f2 2002-01-05 alex if( Req->argc > 1 )
282 8b162c0e 2002-01-06 alex /* angegebenen Ziel-Server suchen */
283 c7408364 2002-03-25 alex target = Client_Search( Req->argv[1] );
284 e44988f2 2002-01-05 alex if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
285 8b162c0e 2002-01-06 alex ptr = Req->argv[1];
287 c90cf7c9 2002-02-25 alex else target = Client_ThisServer( );
289 c90cf7c9 2002-02-25 alex assert( target != NULL );
291 c90cf7c9 2002-02-25 alex if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], ptr );
293 804b1ec4 2001-12-31 alex /* Nick, User und Name */
294 e44988f2 2002-01-05 alex if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
296 804b1ec4 2001-12-31 alex /* Server */
297 e44988f2 2002-01-05 alex if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
299 eab20bee 2002-01-29 alex /* Channels */
300 eab20bee 2002-01-29 alex sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
301 eab20bee 2002-01-29 alex cl2chan = Channel_FirstChannelOf( c );
302 eab20bee 2002-01-29 alex while( cl2chan )
304 0595f42f 2002-02-11 alex chan = Channel_GetChannel( cl2chan );
305 0595f42f 2002-02-11 alex assert( chan != NULL );
307 eab20bee 2002-01-29 alex /* Channel-Name anhaengen */
308 eab20bee 2002-01-29 alex if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
309 0595f42f 2002-02-11 alex if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
310 23add79c 2002-03-10 alex else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
311 0595f42f 2002-02-11 alex strcat( str, Channel_Name( chan ));
313 eab20bee 2002-01-29 alex if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
315 eab20bee 2002-01-29 alex /* Zeile wird zu lang: senden! */
316 eab20bee 2002-01-29 alex if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
317 eab20bee 2002-01-29 alex sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
320 eab20bee 2002-01-29 alex /* naechstes Mitglied suchen */
321 eab20bee 2002-01-29 alex cl2chan = Channel_NextChannelOf( c, cl2chan );
323 eab20bee 2002-01-29 alex if( str[strlen( str ) - 1] != ':')
325 eab20bee 2002-01-29 alex /* Es sind noch Daten da, die gesendet werden muessen */
326 eab20bee 2002-01-29 alex if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
329 804b1ec4 2001-12-31 alex /* IRC-Operator? */
330 bf1c59c6 2002-01-04 alex if( Client_HasMode( c, 'o' ))
332 e44988f2 2002-01-05 alex if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
335 804b1ec4 2001-12-31 alex /* Idle (nur lokale Clients) */
336 bf1c59c6 2002-01-04 alex if( Client_Conn( c ) > NONE )
338 e44988f2 2002-01-05 alex if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
341 949977e8 2002-02-27 alex /* Away? */
342 949977e8 2002-02-27 alex if( Client_HasMode( c, 'a' ))
344 949977e8 2002-02-27 alex if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
347 804b1ec4 2001-12-31 alex /* End of Whois */
348 e44988f2 2002-01-05 alex return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
349 804b1ec4 2001-12-31 alex } /* IRC_WHOIS */
352 2ee05c9a 2002-03-03 alex GLOBAL BOOLEAN IRC_WHO( CLIENT *Client, REQUEST *Req )
354 7de46835 2002-03-03 alex BOOLEAN ok, only_ops;
355 b3a64f5e 2002-03-04 alex CHAR flags[8], *ptr;
356 7de46835 2002-03-03 alex CL2CHAN *cl2chan;
357 7de46835 2002-03-03 alex CHANNEL *chan;
360 2ee05c9a 2002-03-03 alex assert( Client != NULL );
361 2ee05c9a 2002-03-03 alex assert( Req != NULL );
363 2ee05c9a 2002-03-03 alex if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
365 2ee05c9a 2002-03-03 alex /* Falsche Anzahl Parameter? */
366 2ee05c9a 2002-03-03 alex if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
368 7de46835 2002-03-03 alex only_ops = FALSE;
369 7de46835 2002-03-03 alex chan = NULL;
371 7de46835 2002-03-03 alex if( Req->argc == 2 )
373 7de46835 2002-03-03 alex /* Nur OPs anzeigen? */
374 7de46835 2002-03-03 alex if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
375 7de46835 2002-03-03 alex #ifdef STRICT_RFC
376 7de46835 2002-03-03 alex else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
380 7de46835 2002-03-03 alex if( Req->argc >= 1 )
382 7de46835 2002-03-03 alex /* wurde ein Channel oder Nick-Mask angegeben? */
383 7de46835 2002-03-03 alex chan = Channel_Search( Req->argv[0] );
388 7de46835 2002-03-03 alex /* User eines Channels ausgeben */
389 7de46835 2002-03-03 alex if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
392 7de46835 2002-03-03 alex c = Client_First( );
395 7de46835 2002-03-03 alex if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
397 7de46835 2002-03-03 alex ok = FALSE;
398 7de46835 2002-03-03 alex if( Req->argc == 0 ) ok = TRUE;
401 7de46835 2002-03-03 alex if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
402 7de46835 2002-03-03 alex else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
405 7de46835 2002-03-03 alex if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
407 7de46835 2002-03-03 alex /* Flags zusammenbasteln */
408 7de46835 2002-03-03 alex strcpy( flags, "H" );
409 7de46835 2002-03-03 alex if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
411 7de46835 2002-03-03 alex /* ausgeben */
412 7de46835 2002-03-03 alex cl2chan = Channel_FirstChannelOf( c );
413 b3a64f5e 2002-03-04 alex if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
414 b3a64f5e 2002-03-04 alex else ptr = "*";
415 b3a64f5e 2002-03-04 alex if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
419 7de46835 2002-03-03 alex /* naechster Client */
420 7de46835 2002-03-03 alex c = Client_Next( c );
423 7de46835 2002-03-03 alex if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
424 7de46835 2002-03-03 alex else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
425 7de46835 2002-03-03 alex else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
426 2ee05c9a 2002-03-03 alex } /* IRC_WHO */
429 804b1ec4 2001-12-31 alex GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req )
431 804b1ec4 2001-12-31 alex CHAR rpl[COMMAND_LEN];
433 804b1ec4 2001-12-31 alex INT max, i;
435 804b1ec4 2001-12-31 alex assert( Client != NULL );
436 804b1ec4 2001-12-31 alex assert( Req != NULL );
438 bed4005e 2002-01-04 alex if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
440 804b1ec4 2001-12-31 alex /* Falsche Anzahl Parameter? */
441 bed4005e 2002-01-04 alex if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
443 804b1ec4 2001-12-31 alex if( Req->argc > 5 ) max = 5;
444 804b1ec4 2001-12-31 alex else max = Req->argc;
446 804b1ec4 2001-12-31 alex strcpy( rpl, RPL_USERHOST_MSG );
447 804b1ec4 2001-12-31 alex for( i = 0; i < max; i++ )
449 c7408364 2002-03-25 alex c = Client_Search( Req->argv[i] );
450 bf1c59c6 2002-01-04 alex if( c && ( Client_Type( c ) == CLIENT_USER ))
452 804b1ec4 2001-12-31 alex /* Dieser Nick ist "online" */
453 bf1c59c6 2002-01-04 alex strcat( rpl, Client_ID( c ));
454 bf1c59c6 2002-01-04 alex if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
455 804b1ec4 2001-12-31 alex strcat( rpl, "=" );
456 bf1c59c6 2002-01-04 alex if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
457 804b1ec4 2001-12-31 alex else strcat( rpl, "+" );
458 bf1c59c6 2002-01-04 alex strcat( rpl, Client_User( c ));
459 804b1ec4 2001-12-31 alex strcat( rpl, "@" );
460 bf1c59c6 2002-01-04 alex strcat( rpl, Client_Hostname( c ));
461 804b1ec4 2001-12-31 alex strcat( rpl, " " );
464 804b1ec4 2001-12-31 alex if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
466 bed4005e 2002-01-04 alex return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
467 03d971d9 2002-01-02 alex } /* IRC_USERHOST */
470 03d971d9 2002-01-02 alex GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req )
472 03d971d9 2002-01-02 alex assert( Client != NULL );
473 03d971d9 2002-01-02 alex assert( Req != NULL );
475 bf1c59c6 2002-01-04 alex if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
476 bf1c59c6 2002-01-04 alex else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
478 03d971d9 2002-01-02 alex return CONNECTED;
479 03d971d9 2002-01-02 alex } /* IRC_ERROR */
482 c2ee5437 2002-01-11 alex GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req )
484 b3ccaa76 2002-01-16 alex CLIENT *target, *from;
486 c2ee5437 2002-01-11 alex assert( Client != NULL );
487 c2ee5437 2002-01-11 alex assert( Req != NULL );
489 b3ccaa76 2002-01-16 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
491 c2ee5437 2002-01-11 alex /* Falsche Anzahl Parameter? */
492 c2ee5437 2002-01-11 alex if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
494 b3ccaa76 2002-01-16 alex /* Absender ermitteln */
495 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
496 b3ccaa76 2002-01-16 alex else from = Client;
497 b3ccaa76 2002-01-16 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
499 b3ccaa76 2002-01-16 alex /* An anderen Server forwarden? */
500 b3ccaa76 2002-01-16 alex if( Req->argc == 2 )
502 c7408364 2002-03-25 alex target = Client_Search( Req->argv[1] );
503 b3ccaa76 2002-01-16 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
504 b3ccaa76 2002-01-16 alex else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
507 b3ccaa76 2002-01-16 alex /* Wer ist der Absender? */
508 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
509 b3ccaa76 2002-01-16 alex else target = Client;
510 b3ccaa76 2002-01-16 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
512 ef7f7a90 2002-02-27 alex IRC_Send_LUSERS( target );
514 c2ee5437 2002-01-11 alex return CONNECTED;
515 c2ee5437 2002-01-11 alex } /* IRC_LUSERS */
518 c2ee5437 2002-01-11 alex GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req )
520 c2ee5437 2002-01-11 alex CLIENT *target, *from, *c;
521 c2ee5437 2002-01-11 alex CHAR *mask;
523 c2ee5437 2002-01-11 alex assert( Client != NULL );
524 c2ee5437 2002-01-11 alex assert( Req != NULL );
526 c2ee5437 2002-01-11 alex if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
528 c2ee5437 2002-01-11 alex /* Falsche Anzahl Parameter? */
529 c2ee5437 2002-01-11 alex if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
531 c2ee5437 2002-01-11 alex /* Server-Mask ermitteln */
532 c2ee5437 2002-01-11 alex if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
533 c2ee5437 2002-01-11 alex else mask = "*";
535 c2ee5437 2002-01-11 alex /* Absender ermitteln */
536 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
537 c2ee5437 2002-01-11 alex else from = Client;
538 c2ee5437 2002-01-11 alex if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
540 c2ee5437 2002-01-11 alex /* An anderen Server forwarden? */
541 c2ee5437 2002-01-11 alex if( Req->argc == 2 )
543 c7408364 2002-03-25 alex target = Client_Search( Req->argv[0] );
544 c2ee5437 2002-01-11 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
545 c2ee5437 2002-01-11 alex else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
548 c2ee5437 2002-01-11 alex /* Wer ist der Absender? */
549 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
550 c2ee5437 2002-01-11 alex else target = Client;
551 c2ee5437 2002-01-11 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
553 c2ee5437 2002-01-11 alex c = Client_First( );
556 c2ee5437 2002-01-11 alex if( Client_Type( c ) == CLIENT_SERVER )
558 eab20bee 2002-01-29 alex if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
560 c2ee5437 2002-01-11 alex c = Client_Next( c );
563 c2ee5437 2002-01-11 alex return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
564 c2ee5437 2002-01-11 alex } /* IRC_LINKS */
567 458174ff 2002-02-17 alex GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req )
569 08d43d5f 2002-02-26 alex CLIENT *target, *prefix;
571 458174ff 2002-02-17 alex assert( Client != NULL );
572 458174ff 2002-02-17 alex assert( Req != NULL );
574 458174ff 2002-02-17 alex /* Falsche Anzahl Parameter? */
575 458174ff 2002-02-17 alex if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
577 458174ff 2002-02-17 alex /* Ziel suchen */
578 c7408364 2002-03-25 alex if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
579 458174ff 2002-02-17 alex else target = Client_ThisServer( );
581 08d43d5f 2002-02-26 alex /* Prefix ermitteln */
582 c7408364 2002-03-25 alex if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
583 08d43d5f 2002-02-26 alex else prefix = Client;
584 08d43d5f 2002-02-26 alex if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
586 458174ff 2002-02-17 alex /* An anderen Server weiterleiten? */
587 458174ff 2002-02-17 alex if( target != Client_ThisServer( ))
589 458174ff 2002-02-17 alex if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
591 08d43d5f 2002-02-26 alex /* forwarden */
592 180095be 2002-02-27 alex IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
593 458174ff 2002-02-17 alex return CONNECTED;
596 08d43d5f 2002-02-26 alex /* mit Versionsinfo antworten */
597 08d43d5f 2002-02-26 alex return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
598 458174ff 2002-02-17 alex } /* IRC_VERSION */
601 aaa682fb 2002-02-23 alex GLOBAL BOOLEAN IRC_KILL( CLIENT *Client, REQUEST *Req )
603 aaa682fb 2002-02-23 alex CLIENT *prefix, *c;
605 aaa682fb 2002-02-23 alex assert( Client != NULL );
606 aaa682fb 2002-02-23 alex assert( Req != NULL );
608 aaa682fb 2002-02-23 alex if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
610 aaa682fb 2002-02-23 alex /* Falsche Anzahl Parameter? */
611 aaa682fb 2002-02-23 alex if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
613 c7408364 2002-03-25 alex prefix = Client_Search( Req->prefix );
614 aaa682fb 2002-02-23 alex if( ! prefix )
616 aaa682fb 2002-02-23 alex Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
617 aaa682fb 2002-02-23 alex prefix = Client_ThisServer( );
620 aaa682fb 2002-02-23 alex Log( LOG_NOTICE, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
622 aaa682fb 2002-02-23 alex /* andere Server benachrichtigen */
623 aaa682fb 2002-02-23 alex IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], Req->argv[1] );
625 aaa682fb 2002-02-23 alex /* haben wir selber einen solchen Client? */
626 c7408364 2002-03-25 alex c = Client_Search( Req->argv[0] );
627 aaa682fb 2002-02-23 alex if( c && ( Client_Conn( c ) != NONE )) Conn_Close( Client_Conn( c ), NULL, Req->argv[1], TRUE );
629 aaa682fb 2002-02-23 alex return CONNECTED;
630 aaa682fb 2002-02-23 alex } /* IRC_KILL */
633 ef7f7a90 2002-02-27 alex GLOBAL BOOLEAN IRC_Show_MOTD( CLIENT *Client )
635 574ae82c 2001-12-26 alex BOOLEAN ok;
636 574ae82c 2001-12-26 alex CHAR line[127];
639 332db406 2001-12-26 alex assert( Client != NULL );
641 574ae82c 2001-12-26 alex fd = fopen( Conf_MotdFile, "r" );
644 574ae82c 2001-12-26 alex Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
645 bed4005e 2002-01-04 alex return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
648 bed4005e 2002-01-04 alex IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
649 574ae82c 2001-12-26 alex while( TRUE )
651 574ae82c 2001-12-26 alex if( ! fgets( line, 126, fd )) break;
652 574ae82c 2001-12-26 alex if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
653 db58d347 2002-01-05 alex if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
655 db58d347 2002-01-05 alex fclose( fd );
656 db58d347 2002-01-05 alex return FALSE;
659 bed4005e 2002-01-04 alex ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
661 574ae82c 2001-12-26 alex fclose( fd );
664 ef7f7a90 2002-02-27 alex } /* IRC_Show_MOTD */
667 ef7f7a90 2002-02-27 alex GLOBAL BOOLEAN IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
669 c147ebef 2002-02-27 alex BOOLEAN is_visible, is_member;
670 a0123e42 2002-01-28 alex CHAR str[LINE_LEN + 1];
671 a0123e42 2002-01-28 alex CL2CHAN *cl2chan;
672 0595f42f 2002-02-11 alex CLIENT *cl;
674 a0123e42 2002-01-28 alex assert( Client != NULL );
675 a0123e42 2002-01-28 alex assert( Chan != NULL );
677 c147ebef 2002-02-27 alex if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
678 c147ebef 2002-02-27 alex else is_member = FALSE;
680 a0123e42 2002-01-28 alex /* Alle Mitglieder suchen */
681 a0123e42 2002-01-28 alex sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
682 a0123e42 2002-01-28 alex cl2chan = Channel_FirstMember( Chan );
683 a0123e42 2002-01-28 alex while( cl2chan )
685 0595f42f 2002-02-11 alex cl = Channel_GetClient( cl2chan );
687 c147ebef 2002-02-27 alex if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
688 c147ebef 2002-02-27 alex else is_visible = TRUE;
690 c147ebef 2002-02-27 alex if( is_member || is_visible )
692 c147ebef 2002-02-27 alex /* Nick anhaengen */
693 c147ebef 2002-02-27 alex if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
694 c147ebef 2002-02-27 alex if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
695 23add79c 2002-03-10 alex else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
696 c147ebef 2002-02-27 alex strcat( str, Client_ID( cl ));
698 c147ebef 2002-02-27 alex if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
700 c147ebef 2002-02-27 alex /* Zeile wird zu lang: senden! */
701 c147ebef 2002-02-27 alex if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
702 c147ebef 2002-02-27 alex sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
706 a0123e42 2002-01-28 alex /* naechstes Mitglied suchen */
707 a0123e42 2002-01-28 alex cl2chan = Channel_NextMember( Chan, cl2chan );
709 a0123e42 2002-01-28 alex if( str[strlen( str ) - 1] != ':')
711 a0123e42 2002-01-28 alex /* Es sind noch Daten da, die gesendet werden muessen */
712 a0123e42 2002-01-28 alex if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
715 a0123e42 2002-01-28 alex return CONNECTED;
716 ef7f7a90 2002-02-27 alex } /* IRC_Send_NAMES */
719 7de46835 2002-03-03 alex GLOBAL BOOLEAN IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
721 7de46835 2002-03-03 alex BOOLEAN is_visible, is_member;
722 7de46835 2002-03-03 alex CL2CHAN *cl2chan;
723 7de46835 2002-03-03 alex CHAR flags[8];
726 7de46835 2002-03-03 alex assert( Client != NULL );
727 7de46835 2002-03-03 alex assert( Chan != NULL );
729 7de46835 2002-03-03 alex if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
730 7de46835 2002-03-03 alex else is_member = FALSE;
732 7de46835 2002-03-03 alex /* Alle Mitglieder suchen */
733 7de46835 2002-03-03 alex cl2chan = Channel_FirstMember( Chan );
734 7de46835 2002-03-03 alex while( cl2chan )
736 7de46835 2002-03-03 alex c = Channel_GetClient( cl2chan );
738 7de46835 2002-03-03 alex if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
739 7de46835 2002-03-03 alex else is_visible = TRUE;
741 7de46835 2002-03-03 alex if( is_member || is_visible )
743 7de46835 2002-03-03 alex /* Flags zusammenbasteln */
744 7de46835 2002-03-03 alex strcpy( flags, "H" );
745 7de46835 2002-03-03 alex if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
746 7de46835 2002-03-03 alex if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
747 23add79c 2002-03-10 alex else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
749 7de46835 2002-03-03 alex /* ausgeben */
750 7de46835 2002-03-03 alex if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))
752 7de46835 2002-03-03 alex if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
756 7de46835 2002-03-03 alex /* naechstes Mitglied suchen */
757 7de46835 2002-03-03 alex cl2chan = Channel_NextMember( Chan, cl2chan );
759 7de46835 2002-03-03 alex return CONNECTED;
760 7de46835 2002-03-03 alex } /* IRC_Send_WHO */
763 ef7f7a90 2002-02-27 alex GLOBAL BOOLEAN IRC_Send_LUSERS( CLIENT *Client )
767 213fa099 2002-02-13 alex assert( Client != NULL );
769 213fa099 2002-02-13 alex /* Users, Services und Serevr im Netz */
770 213fa099 2002-02-13 alex if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
772 213fa099 2002-02-13 alex /* IRC-Operatoren im Netz */
773 213fa099 2002-02-13 alex cnt = Client_OperCount( );
774 213fa099 2002-02-13 alex if( cnt > 0 )
776 213fa099 2002-02-13 alex if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
779 213fa099 2002-02-13 alex /* Unbekannt Verbindungen */
780 213fa099 2002-02-13 alex cnt = Client_UnknownCount( );
781 213fa099 2002-02-13 alex if( cnt > 0 )
783 213fa099 2002-02-13 alex if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
786 213fa099 2002-02-13 alex /* Channels im Netz */
787 213fa099 2002-02-13 alex if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
789 213fa099 2002-02-13 alex /* Channels im Netz */
790 213fa099 2002-02-13 alex if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
792 213fa099 2002-02-13 alex return CONNECTED;
793 ef7f7a90 2002-02-27 alex } /* IRC_Send_LUSERS */
796 38b9cb88 2001-12-14 alex /* -eof- */