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=560a933766a4f5f0d704f45b73091c095fcd4410;hb=356683ff6ea1c770f481483ddf7013cd03a1ef2e;hpb=b6254bbbb37e0d22290380feb5afda825bfde0a8 diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index 560a9337..ef845964 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -9,11 +9,17 @@ * 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.11 2002/01/02 02:43:22 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. @@ -125,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; } @@ -171,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 */ @@ -197,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 */ @@ -245,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 ); @@ -262,8 +268,8 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *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 */