* 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.55 2002/05/27 13:09:26 alex Exp $
+ * $Id: client.c,v 1.61 2002/10/04 12:39:58 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 ));
if( ! This_Server )
{
Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
- Log( LOG_ALERT, PACKAGE" exiting due to fatal errors!" );
+ Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
CLIENT *c, *next;
INT cnt;
- Client_Destroy( This_Server, "Server going down.", NULL, FALSE );
+ if( NGIRCd_Restart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE );
+ else Client_Destroy( This_Server, "Server going down.", NULL, FALSE );
cnt = 0;
c = My_Clients;
else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :" );
}
}
- Channel_RemoveClient( c, FwdMsg ? FwdMsg : c->id );
+ Channel_Quit( c, FwdMsg ? FwdMsg : c->id );
}
else if( c->type == CLIENT_SERVER )
{
GLOBAL VOID
Client_SetModes( CLIENT *Client, CHAR *Modes )
{
- /* Hostname eines Clients setzen */
+ /* Modes eines Clients setzen */
assert( Client != NULL );
assert( Modes != NULL );
} /* Client_SetModes */
+GLOBAL VOID
+Client_SetFlags( CLIENT *Client, CHAR *Flags )
+{
+ /* Flags eines Clients setzen */
+
+ assert( Client != NULL );
+ assert( Flags != NULL );
+
+ strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
+ Client->modes[CLIENT_FLAGS_LEN - 1] = '\0';
+} /* Client_SetFlags */
+
+
GLOBAL VOID
Client_SetPassword( CLIENT *Client, CHAR *Pwd )
{
} /* Client_Modes */
+GLOBAL CHAR *
+Client_Flags( CLIENT *Client )
+{
+ assert( Client != NULL );
+ return Client->flags;
+} /* Client_Flags */
+
+
GLOBAL BOOLEAN
Client_OperByMe( CLIENT *Client )
{
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 */
{
/* Ist der Nick gueltig? */
- CHAR *ptr, goodchars[] = ";0123456789-";
+ CHAR *ptr, goodchars[20];
assert( Nick != NULL );
+ strcpy( goodchars, ";0123456789-" );
+
if( Nick[0] == '#' ) return FALSE;
if( strchr( goodchars, Nick[0] )) return FALSE;
if( strlen( Nick ) >= CLIENT_NICK_LEN ) return FALSE;
c = malloc( sizeof( CLIENT ));
if( ! c )
{
- Log( LOG_EMERG, "Can't allocate memory!" );
+ Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
return NULL;
}
c->token = -1;
c->mytoken = -1;
strcpy( c->away, "" );
+ strcpy( c->flags, "" );
return c;
} /* New_Client */