Commit Diff


commit - 5a0f118df0cc90aff432afc42aa99a8b87225436
commit + 1ab92bb9cb89b2b62e98ec5f2995c80eef8cd4ab
blob - f646cc0733dc01883d6d5e8b4cb88e0fcabfe4fa
blob + 7866742c79d8e97de9dcbad6ff216c541c638ad4
--- src/ngircd/client.c
+++ src/ngircd/client.c
@@ -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.c,v 1.34 2002/01/27 22:07:36 alex Exp $
+ * $Id: client.c,v 1.35 2002/01/29 00:14:49 alex Exp $
  *
  * client.c: Management aller Clients
  *
@@ -21,6 +21,9 @@
  * Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
  *
  * $Log: client.c,v $
+ * Revision 1.35  2002/01/29 00:14:49  alex
+ * - neue Funktion Client_TopServer(), Client_NewXXX() angepasst.
+ *
  * Revision 1.34  2002/01/27 22:07:36  alex
  * - Client_GetFromID() besser dokumentiert, kleinere Aenderungen.
  *
@@ -232,25 +235,25 @@ GLOBAL CLIENT *Client_ThisServer( VOID )
 GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )
 {
 	/* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */
-	return Client_New( Idx, This_Server, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
+	return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
 } /* Client_NewLocal */
 
 
-GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )
+GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )
 {
 	/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
-	return Client_New( NONE, Introducer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
+	return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
 } /* Client_NewRemoteServer */
 
 
 GLOBAL CLIENT *Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )
 {
 	/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
-	return Client_New( NONE, Introducer, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
+	return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
 } /* Client_NewRemoteUser */
 
 
-GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )
+GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )
 {
 	CLIENT *client;
 
@@ -264,6 +267,7 @@ GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introd
 	/* Initialisieren */
 	client->conn_id = Idx;
 	client->introducer = Introducer;
+	client->topserver = TopServer;
 	client->type = Type;
 	if( ID ) Client_SetID( client, ID );
 	if( User ) Client_SetUser( client, User, Idented );
@@ -688,6 +692,13 @@ GLOBAL CLIENT *Client_Introducer( CLIENT *Client )
 } /* Client_Introducer */
 
 
+GLOBAL CLIENT *Client_TopServer( CLIENT *Client )
+{
+	assert( Client != NULL );
+	return Client->topserver;
+} /* Client_TopServer */
+
+
 GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mode )
 {
 	assert( Client != NULL );
@@ -911,6 +922,7 @@ LOCAL CLIENT *New_Client_Struct( VOID )
 	c->type = CLIENT_UNKNOWN;
 	c->conn_id = NONE;
 	c->introducer = NULL;
+	c->topserver = NULL;
 	strcpy( c->id, "" );
 	strcpy( c->pwd, "" );
 	strcpy( c->host, "" );
blob - 2add5ab06d4534873306a57f16b450f98293a7fc
blob + 83063a874de0a46a8bda490caddee2f61a29e06e
--- src/ngircd/client.h
+++ src/ngircd/client.h
@@ -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: client.h,v 1.20 2002/01/21 00:06:49 alex Exp $
+ * $Id: client.h,v 1.21 2002/01/29 00:14:49 alex Exp $
  *
  * client.h: Konfiguration des ngircd (Header)
  *
  * $Log: client.h,v $
+ * Revision 1.21  2002/01/29 00:14:49  alex
+ * - neue Funktion Client_TopServer(), Client_NewXXX() angepasst.
+ *
  * Revision 1.20  2002/01/21 00:06:49  alex
  * - Channel-Pointer aus Client-Struktur entfernt. Wird nun dynamisch verwaltet :-)
  *
@@ -111,6 +114,7 @@ typedef struct _CLIENT
 	CLIENT_TYPE type;		/* Typ des Client, vgl. CLIENT_TYPE */
 	CONN_ID conn_id;		/* ID der Connection (wenn lokal) bzw. NONE (remote) */
 	struct _CLIENT *introducer;	/* ID des Servers, der die Verbindung hat */
+	struct _CLIENT *topserver;	/* Toplevel-Servers (nur gueltig, wenn Client ein Server ist) */
 	CHAR pwd[CLIENT_PASS_LEN];	/* Passwort, welches der Client angegeben hat */
 	CHAR host[CLIENT_HOST_LEN];	/* Hostname des Client */
 	CHAR user[CLIENT_USER_LEN];	/* Benutzername ("Login") */
@@ -128,9 +132,9 @@ GLOBAL VOID Client_Init( VOID );
 GLOBAL VOID Client_Exit( VOID );
 
 GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented );
-GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented );
+GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented );
 GLOBAL CLIENT *Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented );
-GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented );
+GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented );
 
 GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg );
 
@@ -158,6 +162,7 @@ GLOBAL BOOLEAN Client_OperByMe( CLIENT *Client );
 GLOBAL INT Client_Hops( CLIENT *Client );
 GLOBAL INT Client_Token( CLIENT *Client );
 GLOBAL INT Client_MyToken( CLIENT *Client );
+GLOBAL CLIENT *Client_TopServer( CLIENT *Client );
 GLOBAL CLIENT *Client_NextHop( CLIENT *Client );
 
 GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mode );