diff --git a/ChangeLog b/ChangeLog index 36b1854f..d3644a3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,8 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rant - Fixed Compile warning in adns on BSD systems - Fixed up /msg neostats@stats.neostats.net messages to work correctly - Fixed a big arse bug with Multiple SJOIN's for the same channel, and incorrect channel status modes getting set on users. - + - StatServ now only Wallops records in a configurable amount of time. eg, 5 records in 5 minutes + - Some of statserv stats were never displayed, fixed that * NeoStats * Shmad & Fish * Version 2.5.0-Release Candidate 2 - Misc. Updates (S) diff --git a/TODO b/TODO index 136c15c6..d69edf80 100644 --- a/TODO +++ b/TODO @@ -5,10 +5,7 @@ NeoStats - TODO Log: Shmad: ------ -- Fix crash on split rejoin some people experience -- Fix netname not being passed correctly fx: Chaos-Networks gets passed to Ultimate2 as Chaos for some reason. -- Fix neo segfaulting if a moron kills it with /kill <- This doesnt replicate for me at all. :P - +- Add WALLOP_INTERVAL to makeconf file HostServ TODO: diff --git a/dl/statserv/ChangeLog b/dl/statserv/ChangeLog index 412e58b5..f04f7985 100644 --- a/dl/statserv/ChangeLog +++ b/dl/statserv/ChangeLog @@ -2,6 +2,11 @@ StatServ Module for NeoStats 2.x ChangeLog Shmad & ^Enigma & Fish^ (S) denotes Shmad (E) denotes ^Enigma^ (F) denotes Fish +* Version 3.5 * December 13th, 2002 (F) + - StatServ now has the option to only wallop 5 records broken in a particular timeframe. + eg, 5 wallops per 5 minutes, any more, and statserv doesn't say a thing. + set WALLOP_INTERVAL in neostats.cfg to the interval time + - Some Stats that we were collecting was never displayed, added it to the output and html display * Version 3.42 * September 3rd, 2002 (S) - Fixed make insall now copies the template too diff --git a/dl/statserv/htmlstats.c b/dl/statserv/htmlstats.c index 3638c187..2ac0d5ec 100644 --- a/dl/statserv/htmlstats.c +++ b/dl/statserv/htmlstats.c @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: htmlstats.c,v 1.21 2002/09/04 08:40:29 fishwaldo Exp $ +** $Id: htmlstats.c,v 1.22 2002/12/13 10:50:09 fishwaldo Exp $ */ #include "statserv.h" @@ -262,6 +262,7 @@ void get_srvlistdet() { if (!ss) fprintf(opf, "Last Seen:%s\n", sftime(s->lastseen)); if (ss) fprintf(opf, "Current Users:%d (%2.0f%%)Max %ld at %s\n", s->users, (float)s->users / (float)stats_network.users * 100, s->maxusers, sftime(s->t_maxusers)); if (ss) fprintf(opf, "Current Opers:%d (%2.0f%%)Max %d at %s\n", s->opers, (float)s->opers / (float)stats_network.opers *100, s->maxopers, sftime(s->t_maxopers)); + fprintf(opf, "Total Users Connected:%ld", s->totusers); fprintf(opf, "IrcOp Kills%d", s->operkills); fprintf(opf, "Server Kills%d", s->serverkills); fprintf(opf, "Highest Ping%dat %s", s->highest_ping, sftime(s->t_highest_ping)); @@ -279,7 +280,8 @@ void get_netstats() { fprintf(opf, "Current Users: \n"); fprintf(opf, " %ld \n", stats_network.users); fprintf(opf, "Maximum Users: \n"); - fprintf(opf, " %ld [%s] \n", stats_network.maxusers, sftime(stats_network.t_maxusers)); + fprintf(opf, " %ld [%s] \n", stats_network.maxusers, sftime(stats_network.t_maxusers)); + fprintf(opf, "Total Users Ever Connected%ld", stats_network.totusers); fprintf(opf, "Current Opers: \n"); fprintf(opf, " %i \n", stats_network.opers); fprintf(opf, "Maximum Opers: \n"); @@ -299,6 +301,8 @@ void get_dailystats() { fprintf(opf, "Daily Network Statistics:\n"); fprintf(opf, "Max Daily Users: \n"); fprintf(opf, " %-2d %s \n", daily.users, sftime(daily.t_users)); + fprintf(opf, "Total Users Connected:\n"); + fprintf(opf, " %-2d\n", daily.tot_users); fprintf(opf, "Max Daily Opers: \n"); fprintf(opf, " %-2d %s \n", daily.opers, sftime(daily.t_opers)); fprintf(opf, "Max Daily Servers: \n"); diff --git a/dl/statserv/m_stats.h b/dl/statserv/m_stats.h index c8cd9d45..ade46f0f 100644 --- a/dl/statserv/m_stats.h +++ b/dl/statserv/m_stats.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: m_stats.h,v 1.7 2002/09/04 08:40:29 fishwaldo Exp $ +** $Id: m_stats.h,v 1.8 2002/12/13 10:50:09 fishwaldo Exp $ */ #ifndef M_STATS_H @@ -31,7 +31,7 @@ #define DecreaseServers() stats_network.servers--; #define IncreaseOpers(x) x->opers++; stats_network.opers++; -#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; stats_network.totusers++; +#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; stats_network.totusers++; daily.tot_users++; #define IncreaseServers() stats_network.servers++; #define IncreaseKicks(x) x->kicks++; x->members--; x->maxkickstoday++; diff --git a/dl/statserv/stats.c b/dl/statserv/stats.c index 5b9638f0..0b789fe1 100755 --- a/dl/statserv/stats.c +++ b/dl/statserv/stats.c @@ -20,11 +20,31 @@ ** USA ** ** NeoStats CVS Identification -** $Id: stats.c,v 1.25 2002/10/14 01:06:23 shmad Exp $ +** $Id: stats.c,v 1.26 2002/12/13 10:50:09 fishwaldo Exp $ */ #include "statserv.h" +int ok_to_wallop() { + static int lasttime; + static int count; + + if (!StatServ.newdb && StatServ.onchan && me.synced) { + return 0; + } + if (time(NULL) - lasttime < StatServ.interval) { + if (++count > 5) + return 0; + } else { + lasttime = time(NULL); + count = 0; + } + return 1; + +} + + + int s_chan_new(char **av, int ac) { long count; IncreaseChans(); @@ -32,7 +52,7 @@ int s_chan_new(char **av, int ac) { if (count > stats_network.maxchans) { stats_network.maxchans = count; stats_network.t_chans = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2NEW CHANNEL RECORD\2 Wow, there is now %d Channels on the Network", stats_network.maxchans); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2NEW CHANNEL RECORD\2 Wow, there is now %d Channels on the Network", stats_network.maxchans); } if (count > daily.chans) { daily.chans = count; @@ -182,13 +202,13 @@ int s_new_server(char **av, int ac) { if (stats_network.maxservers < stats_network.servers) { stats_network.maxservers = stats_network.servers; stats_network.t_maxservers = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2NEW SERVER RECORD\2 Wow, there are now %d Servers on the Network", stats_network.servers); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2NEW SERVER RECORD\2 Wow, there are now %d Servers on the Network", stats_network.servers); } if (stats_network.servers > daily.servers) { daily.servers = stats_network.servers; daily.t_servers = time(NULL); } - if (ok_to_wallop) chanalert(s_StatServ, "\2SERVER\2 %s has joined the Network at %s", s->name, s->uplink); + if (ok_to_wallop()) chanalert(s_StatServ, "\2SERVER\2 %s has joined the Network at %s", s->name, s->uplink); return 1; } @@ -200,7 +220,7 @@ int s_del_server(char **av, int ac) { s = findserver(av[0]); if (!s) return 0; DecreaseServers(); - if (ok_to_wallop) chanalert(s_StatServ, "\2SERVER\2 %s has left the Network at %s", s->name, s->uplink); + if (ok_to_wallop()) chanalert(s_StatServ, "\2SERVER\2 %s has left the Network at %s", s->name, s->uplink); ss = findstats(s->name); if (s->name != me.uplink) ss->numsplits = ss->numsplits +1; @@ -273,12 +293,12 @@ int s_user_modes(char **av, int ac) { if (stats_network.maxopers < stats_network.opers) { stats_network.maxopers = stats_network.opers; stats_network.t_maxopers = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2Oper Record\2 The Network has reached a New Record for Opers at %d", stats_network.opers); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2Oper Record\2 The Network has reached a New Record for Opers at %d", stats_network.opers); } if (s->maxopers < s->opers) { s->maxopers = s->opers; s->t_maxopers = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s->name, s->opers); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s->name, s->opers); } if (s->opers > daily.opers) { daily.opers = s->opers; @@ -360,13 +380,13 @@ int s_new_user(char **av, int ac) { /* New User Record */ s->maxusers = s->users; s->t_maxusers = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", s->name, s->users); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", s->name, s->users); } if (stats_network.maxusers < stats_network.users) { stats_network.maxusers = stats_network.users; stats_network.t_maxusers = time(NULL); - if (ok_to_wallop) swallops_cmd(s_StatServ, "\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %d users!", stats_network.users); + if (ok_to_wallop()) swallops_cmd(s_StatServ, "\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %d users!", stats_network.users); } if (stats_network.users > daily.users) { @@ -374,6 +394,7 @@ int s_new_user(char **av, int ac) { daily.t_users = time(NULL); } + AddTLD(u); return 1; } @@ -412,7 +433,7 @@ int pong(char **av, int ac) { /* ok, updated the statistics, now lets see if this server is "lagged out" */ if (StatServ.lag > 0) { if (s->ping > StatServ.lag) { - if (ok_to_wallop) globops(s_StatServ, "\2%s\2 is Lagged out with a ping of %d", s->name, s->ping); + if (ok_to_wallop()) globops(s_StatServ, "\2%s\2 is Lagged out with a ping of %d", s->name, s->ping); } } return 1; @@ -440,6 +461,7 @@ int Online(char **av, int ac) { add_mod_timer("Is_Midnight", "Daily_Stats_Reset", SSMNAME, 60); add_mod_timer("DelOldChan", "DelOldStatServChans", SSMNAME, 3600); + return 1; } diff --git a/dl/statserv/statserv.c b/dl/statserv/statserv.c index f43b2651..7b980782 100644 --- a/dl/statserv/statserv.c +++ b/dl/statserv/statserv.c @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: statserv.c,v 1.53 2002/10/16 03:13:59 fishwaldo Exp $ +** $Id: statserv.c,v 1.54 2002/12/13 10:50:09 fishwaldo Exp $ */ #include @@ -54,7 +54,7 @@ char s_StatServ[MAXNICK] = "StatServ"; Module_Info Statserv_Info[] = { { SSMNAME, "Statistical Bot For NeoStats", - "3.42" + "3.5" } }; @@ -106,7 +106,8 @@ static config_option options[] = { { "STATSERV_HOST", ARG_STR, ss_cb_Config, 2}, { "STATSERV_LAG", ARG_STR, ss_cb_Config, 3}, { "HTML_STATS", ARG_STR, ss_cb_Config, 4}, -{ "HTML_PATH", ARG_STR, ss_cb_Config, 5} +{ "HTML_PATH", ARG_STR, ss_cb_Config, 5}, +{ "WALLOP_INTERVAL", ARG_STR, ss_cb_Config, 6} }; @@ -114,7 +115,6 @@ void ss_cb_Config(char *arg, int configtype) { strcpy(segv_location, "StatServ-ss_cb_Config"); - if (configtype == 0) { /* Nick */ memcpy(StatServ.nick, arg, MAXNICK); @@ -134,7 +134,10 @@ void ss_cb_Config(char *arg, int configtype) { } else if (configtype == 5) { /* htmlpath */ strcpy(StatServ.htmlpath, arg); + } else if (configtype == 6) { + StatServ.interval = atoi(arg); } + } @@ -165,6 +168,7 @@ void _init() { memcpy(StatServ.host, Servbot.host, MAXHOST); StatServ.lag = 0; StatServ.html = 0; + StatServ.interval = 0; if (!config_read("neostats.cfg", options) == 0) { log("Error, Statserv could not be configured"); chanalert(s_Services, "Error, Statserv could not be configured"); @@ -569,6 +573,7 @@ static void ss_netstats(User *u) { prefmsg(u->nick, s_StatServ, "Network Statistics:-----"); prefmsg(u->nick, s_StatServ, "Current Users: %ld", stats_network.users); prefmsg(u->nick, s_StatServ, "Maximum Users: %ld [%s]", stats_network.maxusers, sftime(stats_network.t_maxusers)); + prefmsg(u->nick, s_StatServ, "Total Users Connected: %ld", stats_network.totusers); prefmsg(u->nick, s_StatServ, "Current Channels %ld", stats_network.chans); prefmsg(u->nick, s_StatServ, "Maximum Channels %ld [%s]", stats_network.maxchans, sftime(stats_network.t_chans)); prefmsg(u->nick, s_StatServ, "Current Opers: %ld", stats_network.opers); @@ -587,6 +592,7 @@ static void ss_daily(User *u) { prefmsg(u->nick, s_StatServ, "Maximum Users: %-2d %s", daily.users, sftime(daily.t_users)); prefmsg(u->nick, s_StatServ, "Maximum Chans: %-2d %s", daily.chans, sftime(daily.t_chans)); prefmsg(u->nick, s_StatServ, "Maximum Opers: %-2d %s", daily.opers, sftime(daily.t_opers)); + prefmsg(u->nick, s_StatServ, "Total Users Connected: %-2d", daily.tot_users); prefmsg(u->nick, s_StatServ, "All Daily Statistics are reset at Midnight"); prefmsg(u->nick, s_StatServ, "End of Information."); } @@ -665,6 +671,7 @@ static void ss_server(User *u, char *server) { if (!s) prefmsg(u->nick, s_StatServ, "Server Last Seen: %s", sftime(ss->lastseen)); if (s) prefmsg(u->nick, s_StatServ, "Current Users: %-3ld (%2.0f%%)", ss->users, (float)ss->users / (float)stats_network.users * 100); prefmsg(u->nick, s_StatServ, "Maximum Users: %-3ld at %s", ss->maxusers, sftime(ss->t_maxusers)); + prefmsg(u->nick, s_StatServ, "Total Users Connected: %-3ld", ss->totusers); if (s) prefmsg(u->nick, s_StatServ, "Current Opers: %-3ld", ss->opers); prefmsg(u->nick, s_StatServ, "Maximum Opers: %-3ld at %s", ss->maxopers, sftime(ss->t_maxopers)); prefmsg(u->nick, s_StatServ, "IRCop Kills: %d", ss->operkills); diff --git a/dl/statserv/statserv.h b/dl/statserv/statserv.h index e3d81cdf..96a04d2a 100644 --- a/dl/statserv/statserv.h +++ b/dl/statserv/statserv.h @@ -33,8 +33,6 @@ list_t *Chead; TLD *tldhead; -#define ok_to_wallop !StatServ.newdb && StatServ.onchan && me.synced - extern const char version_date[], version_time[]; @@ -66,6 +64,7 @@ struct StatServ { char htmlpath[BUFSIZE]; int onchan; int newdb; + int interval; } StatServ; @@ -167,6 +166,7 @@ CStats *AddChanStats(char *); void DelOldChan(); int s_topic_change(char **av, int ac); int s_chan_kick(char **av, int ac); + int ok_to_wallop(); /* ss_help.c */ diff --git a/main.c b/main.c index deaa9ca3..6cee5b28 100755 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: main.c,v 1.74 2002/11/18 14:04:19 fishwaldo Exp $ +** $Id: main.c,v 1.75 2002/12/13 10:50:08 fishwaldo Exp $ */ #include @@ -37,15 +37,15 @@ char s_Services[MAXNICK] = "NeoStats"; #ifdef UNREAL -const char version[] = "NeoStats-2.5-RC2(U)"; +const char version[] = "NeoStats-2.5-RC3(U)"; #elif ULTIMATE3 -const char version[] = "NeoStats-2.5-RC2(UL3)"; +const char version[] = "NeoStats-2.5-RC3(UL3)"; #elif ULTIMATE -const char version[] = "NeoStats-2.5-RC2(UL)"; +const char version[] = "NeoStats-2.5-RC3(UL)"; #elif HYBRID7 -const char version[] = "NeoStats-2.5-RC2(H)"; +const char version[] = "NeoStats-2.5-RC3(H)"; #elif NEOIRCD -const char version[] = "NeoStats-2.5-RC2(N)"; +const char version[] = "NeoStats-2.5-RC3(N)"; #endif