1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-01-23 05:46:51 +00:00

- Backports from CVS-HEAD (005-numeric, extended LUSERS reply).

This commit is contained in:
Alexander Barton 2002-12-22 23:42:28 +00:00
parent 3544d1bc40
commit f84cd22fe1
5 changed files with 67 additions and 10 deletions

View File

@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.65 2002/12/12 12:24:18 alex Exp $";
static char UNUSED id[] = "$Id: client.c,v 1.65.2.1 2002/12/22 23:42:28 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -57,6 +57,10 @@ LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
LONG Max_Users = 0, My_Max_Users = 0;
GLOBAL VOID
@ -177,6 +181,9 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
client->next = (POINTER *)My_Clients;
My_Clients = client;
/* Adjust counters */
Adjust_Counters( client );
return client;
} /* Client_New */
@ -414,6 +421,7 @@ Client_SetType( CLIENT *Client, INT Type )
assert( Client != NULL );
Client->type = Type;
if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
Adjust_Counters( Client );
} /* Client_SetType */
@ -919,6 +927,20 @@ Client_UnknownCount( VOID )
} /* Client_UnknownCount */
GLOBAL LONG
Client_MaxUserCount( VOID )
{
return Max_Users;
} /* Client_MaxUserCount */
GLOBAL LONG
Client_MyMaxUserCount( VOID )
{
return My_Max_Users;
} /* Client_MyMaxUserCount */
GLOBAL BOOLEAN
Client_IsValidNick( CHAR *Nick )
{
@ -1041,4 +1063,24 @@ Generate_MyToken( CLIENT *Client )
} /* Generate_MyToken */
LOCAL VOID
Adjust_Counters( CLIENT *Client )
{
LONG count;
assert( Client != NULL );
if( Client->type != CLIENT_USER ) return;
if( Client->conn_id != NONE )
{
/* Local connection */
count = Client_MyUserCount( );
if( count > My_Max_Users ) My_Max_Users = count;
}
count = Client_UserCount( );
if( count > Max_Users ) Max_Users = count;
} /* Adjust_Counters */
/* -eof- */

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.32 2002/12/12 12:23:43 alex Exp $
* $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $
*
* Client management (header)
*/
@ -130,6 +130,8 @@ 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 ));

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.8 2002/12/18 13:55:41 alex Exp $";
static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.1 2002/12/22 23:42:28 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -710,29 +710,36 @@ IRC_Send_LUSERS( CLIENT *Client )
assert( Client != NULL );
/* Users, Services und Serevr im Netz */
/* Users, services and serevers in the network */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
/* IRC-Operatoren im Netz */
/* Number of IRC operators */
cnt = Client_OperCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Unbekannt Verbindungen */
/* Unknown connections */
cnt = Client_UnknownCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Channels im Netz */
/* Number of created channels */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
/* Channels im Netz */
/* Number of local users, services and servers */
if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
#ifndef STRICT_RFC
/* Maximum number of local users */
if( ! IRC_WriteStrClient( Client, RPL_LOCALUSERS_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyMaxUserCount( ))) return DISCONNECTED;
/* Maximum number of users in the network */
if( ! IRC_WriteStrClient( Client, RPL_NETUSERS_MSG, Client_ID( Client ), Client_UserCount( ), Client_MaxUserCount( ))) return DISCONNECTED;
#endif
return CONNECTED;
} /* IRC_Send_LUSERS */

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.27 2002/12/12 12:24:18 alex Exp $";
static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.1 2002/12/22 23:42:28 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -448,6 +448,9 @@ Hello_User( CLIENT *Client )
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, USERMODES, CHANMODES )) return FALSE;
/* Features */
if( ! IRC_WriteStrClient( Client, RPL_FEATURE_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
Client_SetType( Client, CLIENT_USER );
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;

View File

@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: messages.h,v 1.59 2002/12/18 14:03:14 alex Exp $
* $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $
*
* IRC numerics (Header)
*/
@ -22,6 +22,7 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_FEATURE_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server"
#define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld"
#define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld"
#define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report"
@ -35,6 +36,8 @@
#define RPL_ADMINLOC1_MSG "257 %s :%s"
#define RPL_ADMINLOC2_MSG "258 %s :%s"
#define RPL_ADMINEMAIL_MSG "259 %s :%s"
#define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld"
#define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld"
#define RPL_AWAY_MSG "301 %s %s :%s"
#define RPL_USERHOST_MSG "302 %s :"