- New function Client_DestroyNow().

This commit is contained in:
Alexander Barton 2003-01-15 14:28:25 +00:00
parent dccb297678
commit 939767d502
2 changed files with 98 additions and 62 deletions

View File

@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.72 2003/01/08 22:03:21 alex Exp $";
static char UNUSED id[] = "$Id: client.c,v 1.73 2003/01/15 14:28:25 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -59,6 +59,10 @@ LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
#ifndef Client_DestroyNow
GLOBAL VOID Client_DestroyNow PARAMS((CLIENT *Client ));
#endif
LONG Max_Users = 0, My_Max_Users = 0;
@ -292,6 +296,35 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
} /* Client_Destroy */
GLOBAL VOID
Client_DestroyNow( CLIENT *Client )
{
/* Destroy client structure immediately. This function is only
* intended for the connection layer to remove client structures
* of connections that can't be established! */
CLIENT *last, *c;
assert( Client != NULL );
last = NULL;
c = My_Clients;
while( c )
{
if( c == Client )
{
/* Wir haben den Client gefunden: entfernen */
if( last ) last->next = c->next;
else My_Clients = (CLIENT *)c->next;
free( c );
break;
}
last = c;
c = (CLIENT *)c->next;
}
} /* Client_DestroyNow */
GLOBAL VOID
Client_SetHostname( CLIENT *Client, CHAR *Hostname )
{

View File

@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: client.h,v 1.33 2002/12/22 23:29:09 alex Exp $
* $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $
*
* Client management (header)
*/
@ -62,78 +62,81 @@ typedef POINTER CLIENT;
#endif
GLOBAL VOID Client_Init PARAMS((VOID ));
GLOBAL VOID Client_Exit PARAMS((VOID ));
GLOBAL VOID Client_Init PARAMS(( VOID ));
GLOBAL VOID Client_Exit PARAMS(( VOID ));
GLOBAL CLIENT *Client_NewLocal PARAMS((CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteServer PARAMS((CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteUser PARAMS((CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_New PARAMS((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 CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_New PARAMS(( 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 PARAMS((CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
GLOBAL VOID Client_Destroy PARAMS(( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
#ifdef CONN_MODULE
GLOBAL VOID Client_DestroyNow PARAMS(( CLIENT *Client ));
#endif
GLOBAL CLIENT *Client_ThisServer PARAMS((VOID ));
GLOBAL CLIENT *Client_ThisServer PARAMS(( VOID ));
GLOBAL CLIENT *Client_GetFromConn PARAMS((CONN_ID Idx ));
GLOBAL CLIENT *Client_GetFromToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx ));
GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token ));
GLOBAL CLIENT *Client_Search PARAMS((CHAR *ID ));
GLOBAL CLIENT *Client_First PARAMS((VOID ));
GLOBAL CLIENT *Client_Next PARAMS((CLIENT *c ));
GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID ));
GLOBAL CLIENT *Client_First PARAMS(( VOID ));
GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c ));
GLOBAL INT Client_Type PARAMS((CLIENT *Client ));
GLOBAL CONN_ID Client_Conn PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_ID PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Mask PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Info PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_User PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Hostname PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Password PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Modes PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Flags PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_OperByMe PARAMS((CLIENT *Client ));
GLOBAL INT Client_Hops PARAMS((CLIENT *Client ));
GLOBAL INT Client_Token PARAMS((CLIENT *Client ));
GLOBAL INT Client_MyToken PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_TopServer PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_NextHop PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Away PARAMS((CLIENT *Client ));
GLOBAL INT Client_Type PARAMS(( CLIENT *Client ));
GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client ));
GLOBAL INT Client_Hops PARAMS(( CLIENT *Client ));
GLOBAL INT Client_Token PARAMS(( CLIENT *Client ));
GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client ));
GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN Client_HasMode PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode ));
GLOBAL VOID Client_SetHostname PARAMS((CLIENT *Client, CHAR *Hostname ));
GLOBAL VOID Client_SetID PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL VOID Client_SetUser PARAMS((CLIENT *Client, CHAR *User, BOOLEAN Idented ));
GLOBAL VOID Client_SetInfo PARAMS((CLIENT *Client, CHAR *Info ));
GLOBAL VOID Client_SetPassword PARAMS((CLIENT *Client, CHAR *Pwd ));
GLOBAL VOID Client_SetType PARAMS((CLIENT *Client, INT Type ));
GLOBAL VOID Client_SetHops PARAMS((CLIENT *Client, INT Hops ));
GLOBAL VOID Client_SetToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL VOID Client_SetOperByMe PARAMS((CLIENT *Client, BOOLEAN OperByMe ));
GLOBAL VOID Client_SetModes PARAMS((CLIENT *Client, CHAR *Modes ));
GLOBAL VOID Client_SetFlags PARAMS((CLIENT *Client, CHAR *Flags ));
GLOBAL VOID Client_SetIntroducer PARAMS((CLIENT *Client, CLIENT *Introducer ));
GLOBAL VOID Client_SetAway PARAMS((CLIENT *Client, CHAR *Txt ));
GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname ));
GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick ));
GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented ));
GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info ));
GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd ));
GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type ));
GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops ));
GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token ));
GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe ));
GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes ));
GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags ));
GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt ));
GLOBAL BOOLEAN Client_ModeAdd PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeDel PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeAdd PARAMS(( CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeDel PARAMS(( CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_CheckNick PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS((CLIENT *Client, CHAR *ID ));
GLOBAL BOOLEAN Client_CheckNick PARAMS(( CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS(( CLIENT *Client, CHAR *ID ));
GLOBAL LONG Client_UserCount PARAMS((VOID ));
GLOBAL LONG Client_ServiceCount PARAMS((VOID ));
GLOBAL LONG Client_ServerCount PARAMS((VOID ));
GLOBAL LONG Client_OperCount PARAMS((VOID ));
GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
GLOBAL LONG Client_MyServerCount PARAMS((VOID ));
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_UserCount PARAMS(( VOID ));
GLOBAL LONG Client_ServiceCount PARAMS(( VOID ));
GLOBAL LONG Client_ServerCount PARAMS(( VOID ));
GLOBAL LONG Client_OperCount PARAMS(( VOID ));
GLOBAL LONG Client_UnknownCount PARAMS(( VOID ));
GLOBAL LONG Client_MyUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyServiceCount PARAMS(( VOID ));
GLOBAL LONG Client_MyServerCount PARAMS(( VOID ));
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick ));
#endif