X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fparse.c;h=ef8459645acb10a63f9d6bc37f4997cdd8f413e1;hp=cbe01f6c69ed9a8ecff828f7c1f81fa85bd0b130;hb=356683ff6ea1c770f481483ddf7013cd03a1ef2e;hpb=804b1ec4987ed3beb4759cc480b2c6c911627b7e diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index cbe01f6c..ef845964 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001 by Alexander Barton (alex@barton.de) + * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen * der GNU General Public License (GPL), wie von der Free Software Foundation @@ -9,11 +9,25 @@ * 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.9 2001/12/31 02:18:51 alex Exp $ + * $Id: parse.c,v 1.13 2002/01/04 01:20:02 alex Exp $ * * parse.c: Parsen der Client-Anfragen * * $Log: parse.c,v $ + * Revision 1.13 2002/01/04 01:20:02 alex + * - Client-Strukruren werden nur noch ueber Funktionen angesprochen. + * + * Revision 1.12 2002/01/03 02:24:49 alex + * - neue Befehle NJOIN und SERVER begonnen. + * + * Revision 1.11 2002/01/02 02:43:22 alex + * - Copyright-Texte aktualisiert. + * - neuer Befehl ERROR. + * + * Revision 1.10 2001/12/31 15:33:13 alex + * - neuer Befehl NAMES, kleinere Bugfixes. + * - Bug bei PING behoben: war zu restriktiv implementiert :-) + * * Revision 1.9 2001/12/31 02:18:51 alex * - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART), * - neuen Header "defines.h" mit (fast) allen Konstanten. @@ -117,7 +131,7 @@ GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request ) /* Prefix vorhanden */ req.prefix = Request + 1; ptr = strchr( Request, ' ' ); - if( ! ptr ) return Parse_Error( Idx, "Invalid prefix (command missing!?)" ); + if( ! ptr ) return Parse_Error( Idx, "Prefix without command!?" ); *ptr = '\0'; start = ptr + 1; } @@ -163,7 +177,7 @@ GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request ) } if( ! Validate_Args( &req )) return Parse_Error( Idx, "Invalid argument(s)" ); - + return Handle_Request( Idx, &req ); } /* Parse_Request */ @@ -189,13 +203,11 @@ LOCAL BOOLEAN Parse_Error( CONN_ID Idx, CHAR *Error ) * TRUE: Connection wurde durch diese Funktion nicht geschlossen, * FALSE: Connection wurde terminiert. */ - CHAR msg[256]; - assert( Idx >= 0 ); assert( Error != NULL ); - sprintf( msg, "Parse error: %s!", Error ); - return Conn_WriteStr( Idx, msg ); + Log( LOG_DEBUG, "Connection %d: Parse error: %s", Idx, Error ); + return Conn_WriteStr( Idx, "ERROR :Parse error: %s", Error ); } /* Parse_Error */ @@ -237,6 +249,8 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req ) if( strcasecmp( Req->command, "PASS" ) == 0 ) return IRC_PASS( client, Req ); else if( strcasecmp( Req->command, "NICK" ) == 0 ) return IRC_NICK( client, Req ); else if( strcasecmp( Req->command, "USER" ) == 0 ) return IRC_USER( client, Req ); + else if( strcasecmp( Req->command, "SERVER" ) == 0 ) return IRC_SERVER( client, Req ); + else if( strcasecmp( Req->command, "NJOIN" ) == 0 ) return IRC_NJOIN( client, Req ); else if( strcasecmp( Req->command, "QUIT" ) == 0 ) return IRC_QUIT( 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 ); @@ -244,16 +258,18 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req ) else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req ); else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req ); else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req ); + else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req ); else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req ); else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req ); else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req ); else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( 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, "ERROR" ) == 0 ) return IRC_ERROR( client, Req ); /* Unbekannter Befehl */ - IRC_WriteStrClient( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Nick( client ), Req->command ); - Log( LOG_DEBUG, "User \"%s!%s@%s\": Unknown command \"%s\", %d %s,%s prefix.", client->nick, client->user, client->host, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" ); + IRC_WriteStrClient( client, Client_ThisServer( ), ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command ); + Log( LOG_DEBUG, "User \"%s\": Unknown command \"%s\", %d %s,%s prefix.", Client_Mask( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" ); return TRUE; } /* Handle_Request */