]> arthur.barton.de Git - ngircd-alex.git/commitdiff
- Client-Strukruren werden nur noch ueber Funktionen angesprochen.
authorAlexander Barton <alex@barton.de>
Fri, 4 Jan 2002 01:20:02 +0000 (01:20 +0000)
committerAlexander Barton <alex@barton.de>
Fri, 4 Jan 2002 01:20:02 +0000 (01:20 +0000)
src/ngircd/conn.c
src/ngircd/parse.c

index c05f820f58a01a2fda2447a0f6afe37a98441cc1..c939d1b54a94f67bf19ce1631fcf9d3af4837bbd 100644 (file)
@@ -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.
  *
  * 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 $
  *
  * 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.
  *
  * 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 */
        }
 
        /* 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 );
        {
                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( 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 )
                {
                        /* 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 );
                                /* 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
                        }
                }
                else
@@ -967,7 +970,7 @@ LOCAL VOID New_Server( INT Server, CONN_ID Idx )
        }
 
        /* Client-Struktur initialisieren */
        }
 
        /* 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 );
        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;
        }
                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;
        
        /* Verbindung registrieren */
        My_Connections[Idx].sock = new_sock;
index 131cc74b468a2af6fd592fdf23da633dcf38e728..ef8459645acb10a63f9d6bc37f4997cdd8f413e1 100644 (file)
@@ -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.
  *
  * 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 $
  *
  * 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.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, ' ' );
                /* 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;
        }
                *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. */
        
         * TRUE: Connection wurde durch diese Funktion nicht geschlossen,
         * FALSE: Connection wurde terminiert. */
        
-       CHAR msg[256];
-       
        assert( Idx >= 0 );
        assert( Error != NULL );
 
        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 */
 
 
 } /* 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 */
        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 */
 
        return TRUE;
 } /* Handle_Request */