From: Alexander Barton Date: Fri, 4 Jan 2002 01:20:02 +0000 (+0000) Subject: - Client-Strukruren werden nur noch ueber Funktionen angesprochen. X-Git-Tag: rel-0-0-2~31 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=commitdiff_plain;h=356683ff6ea1c770f481483ddf7013cd03a1ef2e - Client-Strukruren werden nur noch ueber Funktionen angesprochen. --- diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index c05f820f..c939d1b5 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -9,11 +9,14 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: conn.c,v 1.27 2002/01/03 02:25:36 alex Exp $ + * $Id: conn.c,v 1.28 2002/01/04 01:20:23 alex Exp $ * * connect.h: Verwaltung aller Netz-Verbindungen ("connections") * * $Log: conn.c,v $ + * Revision 1.28 2002/01/04 01:20:23 alex + * - Client-Strukruren werden nur noch ueber Funktionen angesprochen. + * * Revision 1.27 2002/01/03 02:25:36 alex * - diverse Aenderungen und Umsetellungen fuer Server-Links. * @@ -653,7 +656,7 @@ LOCAL VOID New_Connection( INT Sock ) } /* Client-Struktur initialisieren */ - if( ! Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr ))) + if( ! Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWN )) { Log( LOG_ALERT, "Can't accept connection: can't create client structure!" ); close( new_sock ); @@ -817,7 +820,7 @@ LOCAL VOID Check_Connections( VOID ) if( My_Connections[i].sock == NONE ) continue; c = Client_GetFromConn( i ); - if( c && (( c->type == CLIENT_USER ) || ( c->type == CLIENT_SERVER ) || ( c->type == CLIENT_SERVICE ))) + if( c && (( Client_Type( c ) == CLIENT_USER ) || ( Client_Type( c ) == CLIENT_SERVER ) || ( Client_Type( c ) == CLIENT_SERVICE ))) { /* verbundener User, Server oder Service */ if( My_Connections[i].lastping > My_Connections[i].lastdata ) @@ -835,7 +838,7 @@ LOCAL VOID Check_Connections( VOID ) /* es muss ein PING gesendet werden */ Log( LOG_DEBUG, "Connection %d: sending PING ...", i ); My_Connections[i].lastping = time( NULL ); - Conn_WriteStr( i, "PING :%s", This_Server->nick ); + Conn_WriteStr( i, "PING :%s", Client_ID( Client_ThisServer( ))); } } else @@ -967,7 +970,7 @@ LOCAL VOID New_Server( INT Server, CONN_ID Idx ) } /* Client-Struktur initialisieren */ - c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr )); + c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWNSERVER ); if( ! c ) { close( new_sock ); @@ -975,7 +978,7 @@ LOCAL VOID New_Server( INT Server, CONN_ID Idx ) Log( LOG_ALERT, "Can't establish connection: can't create client structure!" ); return; } - c->type = CLIENT_UNKNOWNSERVER; + Client_SetIntroducer( c, c ); /* Verbindung registrieren */ My_Connections[Idx].sock = new_sock; diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index 131cc74b..ef845964 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -9,11 +9,14 @@ * 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.12 2002/01/03 02:24:49 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. * @@ -128,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; } @@ -200,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 */ @@ -267,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 */