+
+ if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
+ else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
+ else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
+} /* IRC_WHO */
+
+
+GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req )
+{
+ CHAR rpl[COMMAND_LEN];
+ CLIENT *c;
+ INT max, i;
+
+ assert( Client != NULL );
+ assert( Req != NULL );
+
+ if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
+
+ /* Falsche Anzahl Parameter? */
+ if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+
+ if( Req->argc > 5 ) max = 5;
+ else max = Req->argc;
+
+ strcpy( rpl, RPL_USERHOST_MSG );
+ for( i = 0; i < max; i++ )
+ {
+ c = Client_Search( Req->argv[i] );
+ if( c && ( Client_Type( c ) == CLIENT_USER ))
+ {
+ /* Dieser Nick ist "online" */
+ strcat( rpl, Client_ID( c ));
+ if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
+ strcat( rpl, "=" );
+ if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
+ else strcat( rpl, "+" );
+ strcat( rpl, Client_User( c ));
+ strcat( rpl, "@" );
+ strcat( rpl, Client_Hostname( c ));
+ strcat( rpl, " " );
+ }
+ }
+ if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
+
+ return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
+} /* IRC_USERHOST */
+
+
+GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req )
+{
+ assert( Client != NULL );
+ assert( Req != NULL );
+
+ if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
+ else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
+
+ return CONNECTED;
+} /* IRC_ERROR */
+
+
+GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req )
+{
+ CLIENT *target, *from;
+
+ assert( Client != NULL );
+ assert( Req != NULL );
+
+ if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
+
+ /* Falsche Anzahl Parameter? */
+ if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+
+ /* Absender ermitteln */
+ if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
+ else from = Client;
+ if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
+
+ /* An anderen Server forwarden? */
+ if( Req->argc == 2 )
+ {
+ target = Client_Search( Req->argv[1] );
+ if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
+ else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
+ }
+
+ /* Wer ist der Absender? */
+ if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
+ else target = Client;
+ if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
+
+ IRC_Send_LUSERS( target );
+
+ return CONNECTED;
+} /* IRC_LUSERS */
+
+
+GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req )
+{
+ CLIENT *target, *from, *c;
+ CHAR *mask;
+
+ assert( Client != NULL );
+ assert( Req != NULL );
+
+ if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
+
+ /* Falsche Anzahl Parameter? */
+ if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+
+ /* Server-Mask ermitteln */
+ if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
+ else mask = "*";
+
+ /* Absender ermitteln */
+ if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
+ else from = Client;
+ if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
+
+ /* An anderen Server forwarden? */
+ if( Req->argc == 2 )
+ {
+ target = Client_Search( Req->argv[0] );
+ if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
+ else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
+ }
+
+ /* Wer ist der Absender? */
+ if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
+ else target = Client;
+ if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
+
+ c = Client_First( );
+ while( c )
+ {
+ if( Client_Type( c ) == CLIENT_SERVER )
+ {
+ 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;
+ }
+ c = Client_Next( c );
+ }
+
+ return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
+} /* IRC_LINKS */
+
+
+GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req )
+{
+ CLIENT *target, *prefix;
+
+ assert( Client != NULL );
+ assert( Req != NULL );
+
+ /* Falsche Anzahl Parameter? */
+ if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+
+ /* Ziel suchen */
+ if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
+ else target = Client_ThisServer( );
+
+ /* Prefix ermitteln */
+ if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
+ else prefix = Client;
+ if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
+
+ /* An anderen Server weiterleiten? */
+ if( target != Client_ThisServer( ))