fix some of statservs bugs, and wallops

This commit is contained in:
fishwaldo 2002-12-13 10:50:10 +00:00
parent 80a7d00ca9
commit 75632fa84a
9 changed files with 67 additions and 31 deletions

View file

@ -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)

5
TODO
View file

@ -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:

View file

@ -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

View file

@ -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, "<tr><td>Last Seen:</td><td colspan = 2>%s</td></tr>\n", sftime(s->lastseen));
if (ss) fprintf(opf, "<tr><td>Current Users:</td><td>%d (%2.0f%%)</td><td>Max %ld at %s</td></tr>\n", s->users, (float)s->users / (float)stats_network.users * 100, s->maxusers, sftime(s->t_maxusers));
if (ss) fprintf(opf, "<tr><td>Current Opers:</td><td>%d (%2.0f%%)</td><td>Max %d at %s</td></tr>\n", s->opers, (float)s->opers / (float)stats_network.opers *100, s->maxopers, sftime(s->t_maxopers));
fprintf(opf, "<tr><td>Total Users Connected:</td><td colspan = 2>%ld</td></tr>", s->totusers);
fprintf(opf, "<tr><td>IrcOp Kills</td><td colspan = 2>%d</td></tr>", s->operkills);
fprintf(opf, "<tr><td>Server Kills</td><td colspan = 2>%d</td></tr>", s->serverkills);
fprintf(opf, "<tr><td>Highest Ping</td><td>%d</td><td>at %s</td></tr>", s->highest_ping, sftime(s->t_highest_ping));
@ -279,7 +280,8 @@ void get_netstats() {
fprintf(opf, "<td>Current Users: </td>\n");
fprintf(opf, "<td> %ld </td>\n", stats_network.users);
fprintf(opf, "<td>Maximum Users: </td>\n");
fprintf(opf, "<td> %ld [%s] </td>\n", stats_network.maxusers, sftime(stats_network.t_maxusers));
fprintf(opf, "<td> %ld [%s] </td></tr>\n", stats_network.maxusers, sftime(stats_network.t_maxusers));
fprintf(opf, "<tr><td colspan=2>Total Users Ever Connected</td><td colspan=2>%ld</td></tr>", stats_network.totusers);
fprintf(opf, "<tr><td>Current Opers: </td>\n");
fprintf(opf, "<td> %i </td>\n", stats_network.opers);
fprintf(opf, "<td>Maximum Opers: </td>\n");
@ -299,6 +301,8 @@ void get_dailystats() {
fprintf(opf, "<tr><th colspan=\"4\"><b>Daily Network Statistics:</b></th></tr>\n");
fprintf(opf, "<tr><td colspan=\"2\">Max Daily Users: </td>\n");
fprintf(opf, "<td colspan=\"2\"> %-2d %s </td></tr>\n", daily.users, sftime(daily.t_users));
fprintf(opf, "<tr><td colspan=\"2\">Total Users Connected:</td>\n");
fprintf(opf, "<td colspan=\"2\"> %-2d</td></tr>\n", daily.tot_users);
fprintf(opf, "<tr><td colspan=\"2\">Max Daily Opers: </td>\n");
fprintf(opf, "<td colspan=\"2\"> %-2d %s </td></tr>\n", daily.opers, sftime(daily.t_opers));
fprintf(opf, "<tr><td colspan=\"2\">Max Daily Servers: </td>\n");

View file

@ -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++;

View file

@ -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;
}

View file

@ -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 <stdio.h>
@ -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);

View file

@ -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 */

12
main.c
View file

@ -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 <setjmp.h>
@ -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