- LINKS implementiert, LUSERS begonnen.
This commit is contained in:
parent
4fe7e9d6f1
commit
c2ee5437da
|
@ -9,11 +9,14 @@
|
||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc.c,v 1.35 2002/01/09 21:30:45 alex Exp $
|
* $Id: irc.c,v 1.36 2002/01/11 23:50:55 alex Exp $
|
||||||
*
|
*
|
||||||
* irc.c: IRC-Befehle
|
* irc.c: IRC-Befehle
|
||||||
*
|
*
|
||||||
* $Log: irc.c,v $
|
* $Log: irc.c,v $
|
||||||
|
* Revision 1.36 2002/01/11 23:50:55 alex
|
||||||
|
* - LINKS implementiert, LUSERS begonnen.
|
||||||
|
*
|
||||||
* Revision 1.35 2002/01/09 21:30:45 alex
|
* Revision 1.35 2002/01/09 21:30:45 alex
|
||||||
* - WHOIS wurde faelschlicherweise an User geforwarded statt vom Server beantwortet.
|
* - WHOIS wurde faelschlicherweise an User geforwarded statt vom Server beantwortet.
|
||||||
*
|
*
|
||||||
|
@ -773,7 +776,8 @@ GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
|
||||||
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_GetFromID( Req->prefix );
|
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_GetFromID( Req->prefix );
|
||||||
else from = Client;
|
else from = Client;
|
||||||
|
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
to = Client_Search( Req->argv[0] );
|
to = Client_Search( Req->argv[0] );
|
||||||
if( to )
|
if( to )
|
||||||
{
|
{
|
||||||
|
@ -799,6 +803,7 @@ GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req )
|
||||||
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_GetFromID( Req->prefix );
|
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_GetFromID( Req->prefix );
|
||||||
else from = Client;
|
else from = Client;
|
||||||
|
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
to = Client_Search( Req->argv[0] );
|
to = Client_Search( Req->argv[0] );
|
||||||
if( to )
|
if( to )
|
||||||
|
@ -1211,6 +1216,69 @@ GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req )
|
||||||
} /* IRC_ERROR */
|
} /* IRC_ERROR */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
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 > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
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_GetFromID( 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_GetFromID( 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_GetFromID( 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_Introducer( c )), 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 */
|
||||||
|
|
||||||
|
|
||||||
LOCAL BOOLEAN Hello_User( CLIENT *Client )
|
LOCAL BOOLEAN Hello_User( CLIENT *Client )
|
||||||
{
|
{
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
|
|
|
@ -9,11 +9,14 @@
|
||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc.h,v 1.16 2002/01/05 19:15:03 alex Exp $
|
* $Id: irc.h,v 1.17 2002/01/11 23:50:55 alex Exp $
|
||||||
*
|
*
|
||||||
* irc.h: IRC-Befehle (Header)
|
* irc.h: IRC-Befehle (Header)
|
||||||
*
|
*
|
||||||
* $Log: irc.h,v $
|
* $Log: irc.h,v $
|
||||||
|
* Revision 1.17 2002/01/11 23:50:55 alex
|
||||||
|
* - LINKS implementiert, LUSERS begonnen.
|
||||||
|
*
|
||||||
* Revision 1.16 2002/01/05 19:15:03 alex
|
* Revision 1.16 2002/01/05 19:15:03 alex
|
||||||
* - Fehlerpruefung bei select() in der "Hauptschleife" korrigiert.
|
* - Fehlerpruefung bei select() in der "Hauptschleife" korrigiert.
|
||||||
*
|
*
|
||||||
|
@ -94,6 +97,8 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req );
|
||||||
GLOBAL BOOLEAN IRC_SQUIT( CLIENT *Client, REQUEST *Req );
|
GLOBAL BOOLEAN IRC_SQUIT( CLIENT *Client, REQUEST *Req );
|
||||||
|
|
||||||
GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req );
|
GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req );
|
||||||
|
GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req );
|
||||||
|
GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req );
|
||||||
|
|
||||||
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req );
|
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req );
|
||||||
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
|
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
|
||||||
|
|
|
@ -9,11 +9,14 @@
|
||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: messages.h,v 1.17 2002/01/05 23:23:44 alex Exp $
|
* $Id: messages.h,v 1.18 2002/01/11 23:50:55 alex Exp $
|
||||||
*
|
*
|
||||||
* irc.h: IRC-Befehle (Header)
|
* irc.h: IRC-Befehle (Header)
|
||||||
*
|
*
|
||||||
* $Log: messages.h,v $
|
* $Log: messages.h,v $
|
||||||
|
* Revision 1.18 2002/01/11 23:50:55 alex
|
||||||
|
* - LINKS implementiert, LUSERS begonnen.
|
||||||
|
*
|
||||||
* Revision 1.17 2002/01/05 23:23:44 alex
|
* Revision 1.17 2002/01/05 23:23:44 alex
|
||||||
* - neue Nachricht ERR_NOSUCHSERVER_MSG definiert.
|
* - neue Nachricht ERR_NOSUCHSERVER_MSG definiert.
|
||||||
*
|
*
|
||||||
|
@ -89,6 +92,21 @@
|
||||||
#define RPL_MYINFO "004"
|
#define RPL_MYINFO "004"
|
||||||
#define RPL_MYINFO_MSG RPL_MYINFO" %s %s ngircd-"VERSION" ior +"
|
#define RPL_MYINFO_MSG RPL_MYINFO" %s %s ngircd-"VERSION" ior +"
|
||||||
|
|
||||||
|
#define RPL_LUSERCLIENT "251"
|
||||||
|
#define RPL_LUSERCLIENT_MSG RPL_LUSERCLIENT" %s :There are %d users and %d services on %d servers"
|
||||||
|
|
||||||
|
#define RPL_LUSEROP "252"
|
||||||
|
#define RPL_LUSEROP_MSG RPL_LUSEROP" %s %d :operator(s) online"
|
||||||
|
|
||||||
|
#define RPL_LUSERUNKNOWN "253"
|
||||||
|
#define RPL_LUSERUNKNOWN_MSG RPL_LUSERUNKNOWN" %s %d :unknown connection(s)"
|
||||||
|
|
||||||
|
#define RPL_LUSERCHANNELS "254"
|
||||||
|
#define RPL_LUSERCHANNELS_MSG RPL_LUSERCHANNELS_MSG" %s %d :channels formed"
|
||||||
|
|
||||||
|
#define RPL_LUSERME "255"
|
||||||
|
#define RPL_LUSERME_MSG RPL_LUSERME" %s :I have %d clients and %d servers"
|
||||||
|
|
||||||
#define RPL_MOTDSTART "375"
|
#define RPL_MOTDSTART "375"
|
||||||
#define RPL_MOTDSTART_MSG RPL_MOTDSTART" %s :- %s message of the day"
|
#define RPL_MOTDSTART_MSG RPL_MOTDSTART" %s :- %s message of the day"
|
||||||
|
|
||||||
|
@ -128,6 +146,12 @@
|
||||||
#define RPL_NAMREPLY "353"
|
#define RPL_NAMREPLY "353"
|
||||||
#define RPL_NAMREPLY_MSG RPL_NAMREPLY" %s %s %s :%s"
|
#define RPL_NAMREPLY_MSG RPL_NAMREPLY" %s %s %s :%s"
|
||||||
|
|
||||||
|
#define RPL_LINKS "364"
|
||||||
|
#define RPL_LINKS_MSG RPL_LINKS" %s %s %s :%d %s"
|
||||||
|
|
||||||
|
#define RPL_ENDOFLINKS "365"
|
||||||
|
#define RPL_ENDOFLINKS_MSG RPL_ENDOFLINKS" %s %s :End of LINKS list"
|
||||||
|
|
||||||
#define RPL_ENDOFNAMES "366"
|
#define RPL_ENDOFNAMES "366"
|
||||||
#define RPL_ENDOFNAMES_MSG RPL_ENDOFNAMES" %s %s :End of NAMES list"
|
#define RPL_ENDOFNAMES_MSG RPL_ENDOFNAMES" %s %s :End of NAMES list"
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,14 @@
|
||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: parse.c,v 1.19 2002/01/09 01:08:42 alex Exp $
|
* $Id: parse.c,v 1.20 2002/01/11 23:50:55 alex Exp $
|
||||||
*
|
*
|
||||||
* parse.c: Parsen der Client-Anfragen
|
* parse.c: Parsen der Client-Anfragen
|
||||||
*
|
*
|
||||||
* $Log: parse.c,v $
|
* $Log: parse.c,v $
|
||||||
|
* Revision 1.20 2002/01/11 23:50:55 alex
|
||||||
|
* - LINKS implementiert, LUSERS begonnen.
|
||||||
|
*
|
||||||
* Revision 1.19 2002/01/09 01:08:42 alex
|
* Revision 1.19 2002/01/09 01:08:42 alex
|
||||||
* - Parses handhabt Leerzeichen zw. Parametern nun etwas "lockerer".
|
* - Parses handhabt Leerzeichen zw. Parametern nun etwas "lockerer".
|
||||||
*
|
*
|
||||||
|
@ -353,6 +356,8 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
|
||||||
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
|
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
|
||||||
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
|
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
|
||||||
else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
|
else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "LUSERS" ) == 0 ) return IRC_LUSERS( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "LINKS" ) == 0 ) return IRC_LINKS( client, Req );
|
||||||
|
|
||||||
/* Unbekannter Befehl */
|
/* Unbekannter Befehl */
|
||||||
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
|
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
|
||||||
|
|
Loading…
Reference in New Issue