* 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.60 2002/09/03 18:54:31 alex Exp $
+ * $Id: client.c,v 1.64 2002/12/03 18:57:44 alex Exp $
*
* client.c: Management aller Clients
*
#include <exp.h>
+#define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
+
+
LOCAL CLIENT *This_Server, *My_Clients;
-LOCAL CHAR GetID_Buffer[CLIENT_ID_LEN];
+LOCAL CHAR GetID_Buffer[GETID_LEN];
-LOCAL INT Count PARAMS(( CLIENT_TYPE Type ));
-LOCAL INT MyCount PARAMS(( CLIENT_TYPE Type ));
+LOCAL LONG Count PARAMS(( CLIENT_TYPE Type ));
+LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
assert( Flags != NULL );
strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
- Client->modes[CLIENT_FLAGS_LEN - 1] = '\0';
+ Client->flags[CLIENT_FLAGS_LEN - 1] = '\0';
} /* Client_SetFlags */
if( Client->type == CLIENT_SERVER ) return Client->id;
- sprintf( GetID_Buffer, "%s!%s@%s", Client->id, Client->user, Client->host );
+ snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
return GetID_Buffer;
} /* Client_Mask */
if( strcasecmp( c->id, ID ) == 0 )
{
/* die Server-ID gibt es bereits */
- sprintf( str, "ID \"%s\" already registered!", ID );
- Log( LOG_ERR, "%s (on connection %d)", str, Client->conn_id );
+ sprintf( str, "ID \"%s\" already registered", ID );
+ if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
+ else Log( LOG_ERR, "%s (via network)!", str );
Conn_Close( Client->conn_id, str, str, TRUE );
return FALSE;
}
} /* Client_Next */
-GLOBAL INT
+GLOBAL LONG
Client_UserCount( VOID )
{
return Count( CLIENT_USER );
} /* Client_UserCount */
-GLOBAL INT
+GLOBAL LONG
Client_ServiceCount( VOID )
{
return Count( CLIENT_SERVICE );;
} /* Client_ServiceCount */
-GLOBAL INT
+GLOBAL LONG
Client_ServerCount( VOID )
{
return Count( CLIENT_SERVER );
} /* Client_ServerCount */
-GLOBAL INT
+GLOBAL LONG
Client_MyUserCount( VOID )
{
return MyCount( CLIENT_USER );
} /* Client_MyUserCount */
-GLOBAL INT
+GLOBAL LONG
Client_MyServiceCount( VOID )
{
return MyCount( CLIENT_SERVICE );
} /* Client_MyServiceCount */
-GLOBAL INT
+GLOBAL LONG
Client_MyServerCount( VOID )
{
CLIENT *c;
- INT cnt;
+ LONG cnt;
cnt = 0;
c = My_Clients;
} /* Client_MyServerCount */
-GLOBAL INT
+GLOBAL LONG
Client_OperCount( VOID )
{
CLIENT *c;
- INT cnt;
+ LONG cnt;
cnt = 0;
c = My_Clients;
} /* Client_OperCount */
-GLOBAL INT
+GLOBAL LONG
Client_UnknownCount( VOID )
{
CLIENT *c;
- INT cnt;
+ LONG cnt;
cnt = 0;
c = My_Clients;
} /* Client_IsValidNick */
-LOCAL INT
+LOCAL LONG
Count( CLIENT_TYPE Type )
{
CLIENT *c;
- INT cnt;
+ LONG cnt;
cnt = 0;
c = My_Clients;
} /* Count */
-LOCAL INT
+LOCAL LONG
MyCount( CLIENT_TYPE Type )
{
CLIENT *c;
- INT cnt;
+ LONG cnt;
cnt = 0;
c = My_Clients;