[srvx-commits] CVS: services/src opserv.c,1.278,1.279
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-10-16 03:37:27
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv10225/src
Modified Files:
opserv.c
Log Message:
Don't activate join flood countermeasures unless the number of users in the channel is above a threshold, and add a stats uplink command.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.278
retrieving revision 1.279
diff -C2 -r1.278 -r1.279
*** opserv.c 11 Oct 2002 03:08:43 -0000 1.278
--- opserv.c 16 Oct 2002 03:37:23 -0000 1.279
***************
*** 40,43 ****
--- 40,44 ----
#define KEY_PURGE_LOCK_DELAY "purge_lock_delay"
#define KEY_JOIN_FLOOD_MODERATE "join_flood_moderate"
+ #define KEY_JOIN_FLOOD_MODERATE_THRESH "join_flood_moderate_threshold"
#define KEY_NICK "nick"
#define KEY_TRIGGER "trigger"
***************
*** 228,231 ****
--- 229,234 ----
#define OSMSG_INVALID_UPLINK "$b%s$b is not a valid uplink name."
#define OSMSG_UPLINK_DISABLED "$b%s$b is a disabled or unavailable uplink."
+ #define OSMSG_UPLINK_START "Uplink $b%s$b:"
+ #define OSMSG_UPLINK_ADDRESS "Address: %s:%d"
#define OSMSG_STUPID_GLINE "Gline %s? Now $bthat$b would be smooth."
***************
*** 274,277 ****
--- 277,281 ----
unsigned long purge_lock_delay;
unsigned long join_flood_moderate;
+ unsigned long join_flood_moderate_threshold;
unsigned char trigger_char;
} opserv_conf;
***************
*** 1472,1475 ****
--- 1476,1492 ----
}
+ static MODCMD_FUNC(cmd_stats_uplink) {
+ extern struct cManagerNode cManager;
+ struct uplinkNode *uplink;
+
+ (void)argv;
+ uplink = cManager.uplink;
+
+ reply(OSMSG_UPLINK_START, uplink->name);
+ reply(OSMSG_UPLINK_ADDRESS, uplink->host, uplink->port);
+
+ return 1;
+ }
+
static MODCMD_FUNC(cmd_stats_uptime) {
char uptime[INTERVALLEN];
***************
*** 1867,1871 ****
if (!channel->join_flooded) {
channel->join_flooded = 1;
! if(opserv_conf.join_flood_moderate) {
if(!GetUserMode(channel, opserv)) {
AddChannelUser(opserv, channel);
--- 1884,1888 ----
if (!channel->join_flooded) {
channel->join_flooded = 1;
! if(opserv_conf.join_flood_moderate && (channel->members.used > opserv_conf.join_flood_moderate_threshold)) {
if(!GetUserMode(channel, opserv)) {
AddChannelUser(opserv, channel);
***************
*** 3849,3852 ****
--- 3866,3871 ----
str = database_get_data(conf_node, KEY_JOIN_FLOOD_MODERATE, RECDB_QSTRING);
opserv_conf.join_flood_moderate = str ? strtoul(str, NULL, 0) : 1;
+ str = database_get_data(conf_node, KEY_JOIN_FLOOD_MODERATE_THRESH, RECDB_QSTRING);
+ opserv_conf.join_flood_moderate_threshold = str ? strtoul(str, NULL, 0) : 50;
str = database_get_data(conf_node, KEY_NICK, RECDB_QSTRING);
if (str) NickChange(opserv, str, 0);
***************
*** 4014,4017 ****
--- 4033,4037 ----
opserv_define_func("STATS TIMEQ", cmd_stats_timeq, 0, 0);
opserv_define_func("STATS TRUSTED", cmd_stats_trusted, 0, 0);
+ opserv_define_func("STATS UPLINK", cmd_stats_uplink, 0, 0);
opserv_define_func("STATS UPTIME", cmd_stats_uptime, 0, 0);
opserv_define_func("STATS WARN", cmd_stats_warn, 0, 0);
|