- Parser auf Befehlstabelle umgestellt.

This commit is contained in:
Alexander Barton 2002-11-30 15:04:57 +00:00
parent e93f545c74
commit 1e59617d2c
9 changed files with 101 additions and 131 deletions

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: client.h,v 1.30 2002/10/09 16:53:02 alex Exp $
* $Id: client.h,v 1.31 2002/11/30 15:04:57 alex Exp $
*
* client.h: Konfiguration des ngircd (Header)
*/
@ -19,18 +19,17 @@
#define __client_h__
typedef enum
{
CLIENT_UNKNOWN, /* Verbindung mit (noch) unbekanntem Typ */
CLIENT_GOTPASS, /* Client hat PASS gesendet */
CLIENT_GOTNICK, /* Client hat NICK gesendet */
CLIENT_GOTUSER, /* Client hat USER gesendet */
CLIENT_USER, /* Client ist ein Benutzer (USER wurde gesendet) */
CLIENT_UNKNOWNSERVER, /* unregistrierte Server-Verbindung */
CLIENT_GOTPASSSERVER, /* Client hat PASS nach "Server-Art" gesendet */
CLIENT_SERVER, /* Client ist ein Server */
CLIENT_SERVICE /* Client ist ein Service */
} CLIENT_TYPE;
#define CLIENT_UNKNOWN 1 /* Verbindung mit (noch) unbekanntem Typ */
#define CLIENT_GOTPASS 2 /* Client hat PASS gesendet */
#define CLIENT_GOTNICK 4 /* Client hat NICK gesendet */
#define CLIENT_GOTUSER 8 /* Client hat USER gesendet */
#define CLIENT_USER 16 /* Client ist ein Benutzer (USER wurde gesendet) */
#define CLIENT_UNKNOWNSERVER 32 /* unregistrierte Server-Verbindung */
#define CLIENT_GOTPASSSERVER 64 /* Client hat PASS nach "Server-Art" gesendet */
#define CLIENT_SERVER 128 /* Client ist ein Server */
#define CLIENT_SERVICE 256 /* Client ist ein Service */
#define CLIENT_TYPE INT
#if defined(__client_c__) | defined(S_SPLINT_S)

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-channel.c,v 1.15 2002/09/16 09:16:17 alex Exp $
* $Id: irc-channel.c,v 1.16 2002/11/30 15:04:57 alex Exp $
*
* irc-channel.c: IRC-Channel-Befehle
*/
@ -48,8 +48,6 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
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 > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -189,8 +187,6 @@ IRC_PART( CLIENT *Client, REQUEST *Req )
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 );
@ -227,8 +223,6 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
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 < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -280,8 +274,6 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
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 );
@ -340,8 +332,6 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-login.c,v 1.23 2002/11/26 23:07:24 alex Exp $
* $Id: irc-login.c,v 1.24 2002/11/30 15:04:57 alex Exp $
*
* irc-login.c: Anmeldung und Abmeldung im IRC
*/
@ -362,8 +362,6 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
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 < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
#ifdef STRICT_RFC
@ -398,8 +396,6 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
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 < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-mode.c,v 1.15 2002/11/22 18:28:22 alex Exp $
* $Id: irc-mode.c,v 1.16 2002/11/30 15:04:57 alex Exp $
*
* irc-mode.c: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...)
*/
@ -60,9 +60,6 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
cl = chan_cl = prefix = NULL;
chan = NULL;
/* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Keine Parameter? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -438,8 +435,6 @@ IRC_AWAY( 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 > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-op.c,v 1.9 2002/09/08 17:06:54 alex Exp $
* $Id: irc-op.c,v 1.10 2002/11/30 15:04:57 alex Exp $
*
* irc-op.c: Befehle zur Channel-Verwaltung
*/
@ -44,9 +44,6 @@ IRC_KICK( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Valider Client? */
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) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -73,9 +70,6 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Valider Client? */
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 );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-oper.c,v 1.10 2002/11/22 23:32:29 alex Exp $
* $Id: irc-oper.c,v 1.11 2002/11/30 15:04:57 alex Exp $
*
* irc-oper.c: IRC-Operator-Befehle
*/
@ -44,8 +44,6 @@ IRC_OPER( 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 );
@ -88,8 +86,6 @@ IRC_DIE( 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 != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -107,8 +103,6 @@ IRC_REHASH( 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 != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -127,8 +121,6 @@ IRC_RESTART( 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 != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -149,8 +141,6 @@ IRC_CONNECT(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 != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-server.c,v 1.22 2002/11/28 14:31:43 alex Exp $
* $Id: irc-server.c,v 1.23 2002/11/30 15:04:57 alex Exp $
*
* irc-server.c: IRC-Befehle fuer Server-Links
*/
@ -282,8 +282,6 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTEREDSERVER_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -347,9 +345,6 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* SQUIT ist nur fuer Server erlaubt */
if( 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 );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc.c,v 1.102 2002/11/24 18:45:53 alex Exp $
* $Id: irc.c,v 1.103 2002/11/30 15:04:57 alex Exp $
*
* irc.c: IRC-Befehle
*/
@ -50,8 +50,6 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
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 > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -86,8 +84,6 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
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 == 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, ERR_NOTEXTTOSEND_MSG, Client_ID( Client ));
@ -159,8 +155,6 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
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 );
@ -256,8 +250,6 @@ IRC_ISON( 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 < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -295,8 +287,6 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
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 < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -388,8 +378,6 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
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 < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -411,8 +399,6 @@ IRC_WHO( 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 );
@ -487,8 +473,6 @@ IRC_USERHOST( 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 < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -540,8 +524,6 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
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 );
@ -578,8 +560,6 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req )
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 );
@ -662,8 +642,6 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( 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 );
@ -701,8 +679,6 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
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 > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@ -745,8 +721,6 @@ IRC_TIME( CLIENT *Client, REQUEST *Req )
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 > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: parse.c,v 1.47 2002/11/28 11:02:50 alex Exp $
* $Id: parse.c,v 1.48 2002/11/30 15:04:57 alex Exp $
*
* parse.c: Parsen der Client-Anfragen
*/
@ -48,6 +48,62 @@
#include "exp.h"
typedef struct _COMMAND
{
CHAR *name; /* Name des Befehls */
BOOLEAN (*function)( CLIENT *Client, REQUEST *Request );
CLIENT_TYPE type; /* Erlaubte Client-Typen (Bitmaske) */
LONG count; /* Anzahl der Aufrufe */
} COMMAND;
COMMAND My_Commands[] =
{
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0 },
{ "AWAY", IRC_AWAY, CLIENT_USER, 0 },
{ "CONNECT", IRC_CONNECT, CLIENT_USER, 0 },
{ "DIE", IRC_DIE, CLIENT_USER, 0 },
{ "ERROR", IRC_ERROR, 0xFFFF, 0 },
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0 },
{ "ISON", IRC_ISON, CLIENT_USER, 0 },
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0 },
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0 },
{ "KILL", IRC_KILL, CLIENT_SERVER, 0 },
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0 },
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0 },
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0 },
{ "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0 },
{ "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0 },
{ "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0 },
{ "NICK", IRC_NICK, 0xFFFF, 0 },
{ "NJOIN", IRC_NJOIN, CLIENT_SERVER, 0 },
{ "NOTICE", IRC_NOTICE, 0xFFFF, 0 },
{ "OPER", IRC_OPER, CLIENT_USER, 0 },
{ "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0 },
{ "PASS", IRC_PASS, 0xFFFF, 0 },
{ "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0 },
{ "PONG", IRC_PONG, CLIENT_USER|CLIENT_SERVER, 0 },
{ "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0 },
{ "QUIT", IRC_QUIT, 0xFFFF, 0 },
{ "REHASH", IRC_REHASH, CLIENT_USER, 0 },
{ "RESTART", IRC_RESTART, CLIENT_USER, 0 },
{ "SERVER", IRC_SERVER, 0xFFFF, 0 },
{ "SQUIT", IRC_SQUIT, CLIENT_SERVER, 0 },
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0 },
{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0 },
{ "USER", IRC_USER, 0xFFFF, 0 },
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0 },
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0 },
{ "WHO", IRC_WHO, CLIENT_USER, 0 },
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0 },
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0 },
#ifdef IRCPLUS
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0 },
#endif
{ NULL, NULL, 0 } /* Ende-Marke */
};
LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ));
@ -260,6 +316,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
CLIENT *client, *target, *prefix;
CHAR str[LINE_LEN];
COMMAND *cmd;
INT i;
assert( Idx >= 0 );
@ -313,53 +370,33 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
}
if( strcasecmp( Req->command, "ADMIN" ) == 0 ) return IRC_ADMIN( client, Req );
else if( strcasecmp( Req->command, "AWAY" ) == 0 ) return IRC_AWAY( client, Req );
else if( strcasecmp( Req->command, "CONNECT" ) == 0 ) return IRC_CONNECT( client, Req );
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
else if( strcasecmp( Req->command, "INVITE" ) == 0 ) return IRC_INVITE( client, Req );
else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
else if( strcasecmp( Req->command, "JOIN" ) == 0 ) return IRC_JOIN( client, Req );
else if( strcasecmp( Req->command, "KICK" ) == 0 ) return IRC_KICK( client, Req );
else if( strcasecmp( Req->command, "KILL" ) == 0 ) return IRC_KILL( client, Req );
else if( strcasecmp( Req->command, "LINKS" ) == 0 ) return IRC_LINKS( client, Req );
else if( strcasecmp( Req->command, "LIST" ) == 0 ) return IRC_LIST( client, Req );
else if( strcasecmp( Req->command, "LUSERS" ) == 0 ) return IRC_LUSERS( client, Req );
else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req );
else if( strcasecmp( Req->command, "NICK" ) == 0 ) return IRC_NICK( client, Req );
else if( strcasecmp( Req->command, "NJOIN" ) == 0 ) return IRC_NJOIN( client, Req );
else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( client, Req );
else if( strcasecmp( Req->command, "PART" ) == 0 ) return IRC_PART( client, Req );
else if( strcasecmp( Req->command, "PASS" ) == 0 ) return IRC_PASS( client, Req );
else if( strcasecmp( Req->command, "PING" ) == 0 ) return IRC_PING( client, Req );
else if( strcasecmp( Req->command, "PONG" ) == 0 ) return IRC_PONG( client, Req );
else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
else if( strcasecmp( Req->command, "QUIT" ) == 0 ) return IRC_QUIT( client, Req );
else if( strcasecmp( Req->command, "REHASH" ) == 0 ) return IRC_REHASH( client, Req );
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
else if( strcasecmp( Req->command, "SERVER" ) == 0 ) return IRC_SERVER( client, Req );
else if( strcasecmp( Req->command, "SQUIT" ) == 0 ) return IRC_SQUIT( client, Req );
else if( strcasecmp( Req->command, "TIME" ) == 0 ) return IRC_TIME( client, Req );
else if( strcasecmp( Req->command, "TOPIC" ) == 0 ) return IRC_TOPIC( client, Req );
else if( strcasecmp( Req->command, "USER" ) == 0 ) return IRC_USER( client, Req );
else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
else if( strcasecmp( Req->command, "VERSION" ) == 0 ) return IRC_VERSION( client, Req );
else if( strcasecmp( Req->command, "WHO" ) == 0 ) return IRC_WHO( client, Req );
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
else if( strcasecmp( Req->command, "WHOWAS" ) == 0 ) return IRC_WHOWAS( client, Req );
#ifdef IRCPLUS
else if( strcasecmp( Req->command, "CHANINFO" ) == 0 ) return IRC_CHANINFO( client, Req );
#endif
cmd = My_Commands;
while( cmd->name )
{
/* Befehl suchen */
if( strcasecmp( Req->command, cmd->name ) != 0 )
{
cmd++; continue;
}
if( Client_Type( client ) & cmd->type )
{
/* Der Befehl ist fuer diesen Client-Typ erlaubt.
* Entsprechende Funktion zaehlen nun aufrufen: */
cmd->count++;
return (cmd->function)( client, Req );
}
else
{
/* Befehl ist fuer diesen Client-Typ nicht erlaubt! */
return IRC_WriteStrClient( client, ERR_NOTREGISTERED_MSG, Client_ID( client ));
}
}
/* Unbekannter Befehl */
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
return TRUE;
if( Client_Type( client ) != CLIENT_SERVER ) return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
else return TRUE;
} /* Handle_Request */