diff --git a/ChangeLog b/ChangeLog index 9bedb230..0549a5bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +- Fixed up StatServ some more, now it displays all the information that +previous versions of NeoStats did, although, it might not be accurate yet +(still working on it) +- Fixed up Module Bots not working if the recieved Nick case was different +to what was in the hash table! + NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rants) * NeoStats * Fish * Its Under CVS Control now... Still a Beta/Alpha Version though! - Implemented Levels for Users, and finally fixed it all up.. if your diff --git a/Makefile.in b/Makefile.in index ed5e2b44..22926caf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ # Makefile for GeoStats # GeoStats CVS Identification -# $Id: Makefile.in,v 1.2 2000/03/02 01:31:24 fishwaldo Exp $ +# $Id: Makefile.in,v 1.3 2000/03/29 13:05:56 fishwaldo Exp $ # makefile originally created by Andy Church. CC=@CC@ @@ -32,12 +32,13 @@ stats: $(OBJS) # Catch any changes in compilation options at the top of this file $(OBJS): Makefile -main.o: main.c stats.h -sock.o: sock.c stats.h -conf.o: conf.c stats.h -ircd.o: ircd.c stats.h -timer.o: timer.c stats.h -statserv.o: statserv.c stats.h -users.o: users.c stats.h -stats.o: stats.c stats.h -help.o: help.c stats.h +dotconf.o: dotconf.c stats.h config.h dotconf.h +services.o: services.c stats.h config.h dl.h Unreal.h +main.o: main.c stats.h config.h dl.h +sock.o: sock.c stats.h config.h dl.h +conf.o: conf.c stats.h config.h dotconf.h dl.h +ircd.o: ircd.c stats.h config.h dl.h +timer.o: timer.c stats.h config.h dl.h +users.o: users.c stats.h config.h +ns_help.o: ns_help.c stats.h config.h +dl.o: dl.c stats.h config.h dl.h diff --git a/conf.c b/conf.c index 294dfc67..d9fd1a91 100644 --- a/conf.c +++ b/conf.c @@ -5,11 +5,12 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: conf.c,v 1.3 2000/02/22 03:32:32 fishwaldo Exp $ +** $Id: conf.c,v 1.4 2000/03/29 13:05:56 fishwaldo Exp $ */ #include "stats.h" #include "dotconf.h" +#include "dl.h" static void cb_Server(char *, int); static void cb_Module(char *, int); @@ -63,24 +64,26 @@ done_mods = 0; } void cb_Module(char *arg, int configtype) { int i; - segv_location="cb_Module"; + segv_location= sstrdup("cb_Module"); for (i = 1; (i < NUM_MODULES) && (load_mods[i] != 0); i++) { if (!strcasecmp(load_mods[i], arg)) { return; } } load_mods[i] = sstrdup(arg); - log("Added Module %s", load_mods[i]); + log("Added Module %d :%s", i, load_mods[i]); } int init_modules() { int i; int rval; - User *u=NULL; - - segv_location="init_modules"; + + segv_location=sstrdup("init_modules"); for (i = 1; (i < NUM_MODULES) && (load_mods[i] !=0); i++) { - rval = load_module(load_mods[i], u); +#ifdef DEBUG + log("Loading Module %s", load_mods[i]); +#endif + rval = load_module(load_mods[i], NULL); if (!rval) { log("Successfully Loaded Module %s", load_mods[i]); } else { @@ -122,9 +125,9 @@ void cb_Server(char *arg, int configtype) { } else if (configtype == 9) { me.want_privmsg = 1; } else if (configtype == 10) { - me.chan = sstrdup(arg); + memcpy(me.chan,arg, sizeof(me.chan)); } else if (configtype == 11) { - me.modpath = sstrdup(arg); + memcpy(me.modpath, arg, sizeof(me.chan)); add_ld_path(me.modpath); } else if (configtype == 12) { me.onlyopers = 1; diff --git a/configure b/configure index 6219a916..264e5b11 100755 --- a/configure +++ b/configure @@ -24,6 +24,8 @@ ac_help="$ac_help --enablee-icq - Do Compile Icq Module" ac_help="$ac_help --enable-version - Do Compile Version Module (API example)" +ac_help="$ac_help + --enable-netinfo - Do Compile NetInfo Module" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -544,7 +546,7 @@ CFLAGS="$CFLAGS -O2 -Wall" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:548: checking for $ac_word" >&5 +echo "configure:550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -574,7 +576,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:578: checking for $ac_word" >&5 +echo "configure:580: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -625,7 +627,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:629: checking for $ac_word" >&5 +echo "configure:631: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -657,7 +659,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:661: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:663: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -668,12 +670,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 672 "configure" +#line 674 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -699,12 +701,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:703: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:705: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:708: checking whether we are using GNU C" >&5 +echo "configure:710: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -713,7 +715,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -732,7 +734,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:736: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:738: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -765,7 +767,7 @@ fi echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6 -echo "configure:769: checking for main in -ldl" >&5 +echo "configure:771: checking for main in -ldl" >&5 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -773,14 +775,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -809,7 +811,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:813: checking how to run the C preprocessor" >&5 +echo "configure:815: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -824,13 +826,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -841,13 +843,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -858,13 +860,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -889,12 +891,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:893: checking for ANSI C header files" >&5 +echo "configure:895: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -902,7 +904,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -919,7 +921,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -937,7 +939,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -958,7 +960,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -969,7 +971,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -993,12 +995,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:997: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:999: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1014,7 +1016,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1038,17 +1040,17 @@ for ac_hdr in sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1042: checking for $ac_hdr" >&5 +echo "configure:1044: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1076,12 +1078,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1080: checking for working const" >&5 +echo "configure:1082: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1151,12 +1153,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1155: checking for size_t" >&5 +echo "configure:1157: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1184,12 +1186,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1188: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1190: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1198,7 +1200,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1219,12 +1221,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1223: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:1225: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1232,7 +1234,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:1236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -1254,7 +1256,7 @@ fi echo $ac_n "checking for working fnmatch""... $ac_c" 1>&6 -echo "configure:1258: checking for working fnmatch" >&5 +echo "configure:1260: checking for working fnmatch" >&5 if eval "test \"`echo '$''{'ac_cv_func_fnmatch_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1265,11 +1267,11 @@ if test "$cross_compiling" = yes; then ac_cv_func_fnmatch_works=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_fnmatch_works=yes else @@ -1292,12 +1294,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1296: checking return type of signal handlers" >&5 +echo "configure:1298: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1314,7 +1316,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1333,12 +1335,12 @@ EOF echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:1337: checking for strftime" >&5 +echo "configure:1339: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -1383,7 +1385,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:1387: checking for strftime in -lintl" >&5 +echo "configure:1389: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1391,7 +1393,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1431,12 +1433,12 @@ fi for ac_func in regcomp select socket strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1435: checking for $ac_func" >&5 +echo "configure:1437: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1485,7 +1487,7 @@ done echo $ac_n "checking Whether to Enable Debuging...""... $ac_c" 1>&6 -echo "configure:1489: checking Whether to Enable Debuging..." >&5 +echo "configure:1491: checking Whether to Enable Debuging..." >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -1509,7 +1511,7 @@ fi echo $ac_n "checking Whether to Enable Unreal IRCD Support...""... $ac_c" 1>&6 -echo "configure:1513: checking Whether to Enable Unreal IRCD Support..." >&5 +echo "configure:1515: checking Whether to Enable Unreal IRCD Support..." >&5 # Check whether --enable-unreal or --disable-unreal was given. if test "${enable_unreal+set}" = set; then enableval="$enable_unreal" @@ -1541,7 +1543,7 @@ fi echo $ac_n "checking Whether to Enable StatServ Module?""... $ac_c" 1>&6 -echo "configure:1545: checking Whether to Enable StatServ Module?" >&5 +echo "configure:1547: checking Whether to Enable StatServ Module?" >&5 # Check whether --enable-statserv or --disable-statserv was given. if test "${enable_statserv+set}" = set; then enableval="$enable_statserv" @@ -1562,7 +1564,7 @@ fi echo $ac_n "checking Whether to Enable Spam Module?""... $ac_c" 1>&6 -echo "configure:1566: checking Whether to Enable Spam Module?" >&5 +echo "configure:1568: checking Whether to Enable Spam Module?" >&5 # Check whether --enable-spam or --disable-spam was given. if test "${enable_spam+set}" = set; then enableval="$enable_spam" @@ -1583,7 +1585,7 @@ fi echo $ac_n "checking Whether to Enable Icq Module?""... $ac_c" 1>&6 -echo "configure:1587: checking Whether to Enable Icq Module?" >&5 +echo "configure:1589: checking Whether to Enable Icq Module?" >&5 # Check whether --enable-icq or --disable-icq was given. if test "${enable_icq+set}" = set; then enableval="$enable_icq" @@ -1603,7 +1605,7 @@ fi echo $ac_n "checking Whether to Enable Version Module?""... $ac_c" 1>&6 -echo "configure:1607: checking Whether to Enable Version Module?" >&5 +echo "configure:1609: checking Whether to Enable Version Module?" >&5 # Check whether --enable-version or --disable-version was given. if test "${enable_version+set}" = set; then enableval="$enable_version" @@ -1622,9 +1624,29 @@ else fi +echo $ac_n "checking Whether to Enable Netinfo Module?""... $ac_c" 1>&6 +echo "configure:1629: checking Whether to Enable Netinfo Module?" >&5 +# Check whether --enable-netinfo or --disable-netinfo was given. +if test "${enable_netinfo+set}" = set; then + enableval="$enable_netinfo" + case "$enableval" in + yes) + MODULES="$MODULES netinfo" + echo "$ac_t""yes" 1>&6 + ;; + *) + echo "$ac_t""no" 1>&6 + ;; +esac +else + echo "$ac_t""no" 1>&6 + +fi + + echo $ac_n "checking Your Current Bank Balance""... $ac_c" 1>&6 -echo "configure:1628: checking Your Current Bank Balance" >&5 +echo "configure:1650: checking Your Current Bank Balance" >&5 echo "$ac_t""Thats Impressive!!!" 1>&6 @@ -1731,7 +1753,7 @@ done ac_given_srcdir=$srcdir -trap 'rm -fr `echo "dl/statserv/Makefile dl/services/Makefile dl/icq/Makefile dl/version/Makefile dl/Makefile dl/spam/Makefile Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "dl/statserv/Makefile dl/services/Makefile dl/icq/Makefile dl/version/Makefile dl/Makefile dl/spam/Makefile dl/netinfo/Makefile Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 590f96f4..47fe0cf9 100644 --- a/configure.in +++ b/configure.in @@ -130,6 +130,21 @@ esac], [AC_MSG_RESULT(no)] ) +AC_MSG_CHECKING(Whether to Enable Netinfo Module?) +AC_ARG_ENABLE(netinfo, +[ --enable-netinfo - Do Compile NetInfo Module], +[ case "$enableval" in + yes) + MODULES="$MODULES netinfo" + AC_MSG_RESULT(yes) + ;; + *) + AC_MSG_RESULT(no) + ;; +esac], +[AC_MSG_RESULT(no)] +) + AC_MSG_CHECKING(Your Current Bank Balance) AC_MSG_RESULT(Thats Impressive!!!) @@ -138,4 +153,4 @@ AC_MSG_RESULT(Thats Impressive!!!) AC_SUBST(IRCD_FILES) AC_SUBST(MODULES) -AC_OUTPUT(dl/statserv/Makefile dl/services/Makefile dl/icq/Makefile dl/version/Makefile dl/Makefile dl/spam/Makefile Makefile) +AC_OUTPUT(dl/statserv/Makefile dl/services/Makefile dl/icq/Makefile dl/version/Makefile dl/Makefile dl/spam/Makefile dl/netinfo/Makefile Makefile) diff --git a/data/nstats.db b/data/nstats.db index d93cd7be..094f4738 100644 --- a/data/nstats.db +++ b/data/nstats.db @@ -1 +1 @@ -12 66 14 951223103 951750894 951223097 866 +2 5 3 953652958 953653581 953652958 35 diff --git a/data/stats.db b/data/stats.db index 02e8b6a3..9dcfa0e3 100644 --- a/data/stats.db +++ b/data/stats.db @@ -1,15 +1,2 @@ -stats.dynam.ac 0 3 951989206 1 951997902 952001193 951989206 0 0 49 -temp-c.global-irc.net 0 1 951989206 1 951989206 952001193 951989206 0 0 16 -stats-c.dynam.ac 0 3 951223096 0 951223096 951750201 951223096 0 0 39 -irc.dynam.ac 0 3 951223143 2 951223102 951750202 951223096 0 0 39 -stardust.riox.net 0 5 951747976 0 951223096 951750202 951223096 0 0 27 -oxygen.phrozen.org 0 2 951223108 1 951223103 951750202 951223096 0 0 8 -chat.local.ie 0 15 951750303 2 951747971 951750202 951223096 0 0 140 -irc.hs-bremen.de 0 11 951223102 0 951223096 951750202 951223096 0 0 120 -services.roxnet.org 0 9 951747995 2 951223098 951750202 951223096 0 0 105 -irc.flirt.org 0 12 951748223 2 951223099 951750202 951223096 0 0 96 -muah2x.penguinpowered.com 0 11 951223114 2 951223099 951750202 951223097 0 0 129 -irc.pahang.dhs.org 0 7 951223122 2 951223100 951226195 951223097 0 0 56 -irc.alphapop.de 0 3 951747975 0 951223097 951750202 951223097 0 0 12 -stats.local.ie 0 3 951223103 0 951223097 951750202 951223097 0 0 30 -irc-coding.flirt.org 0 0 951223097 0 951223097 951226195 951223097 0 0 0 +stats.dynam.ac 0 4 953653581 1 953652958 953656763 953652958 0 0 28 +temp-c.global-irc.net 0 1 953652958 1 953652958 953656763 953652958 0 0 7 diff --git a/dl.c b/dl.c index b03db017..d882c7b2 100644 --- a/dl.c +++ b/dl.c @@ -9,6 +9,7 @@ #include #include "dl.h" #include "stats.h" +#include "config.h" Module *module_list; LD_Path *ld_path_list; @@ -19,7 +20,7 @@ void __init_mod_list() { Mod_User *u, *Uprev; Sock_List *s, *Sprev; - segv_location = "__init_mod_list"; + segv_location = sstrdup("__init_mod_list"); module_list = (Module *)malloc(sizeof(Module)); bzero(module_list, sizeof(Module)); module_list->prev = NULL; @@ -63,7 +64,7 @@ void __init_mod_list() { int add_ld_path(char *path) { LD_Path *path_ent, *list; - segv_location = "add_ld_path"; + segv_location = sstrdup("add_ld_path"); path_ent = (LD_Path *)malloc(sizeof(LD_Path)); bzero(path_ent, sizeof(LD_Path)); @@ -104,7 +105,9 @@ static Mod_Timer *new_timer(char *timer_name) { Mod_Timer *t; +#ifdef DEBUG log("New Timer: %s", timer_name); +#endif t = smalloc(sizeof(Mod_Timer)); if (!timer_name) timer_name=""; @@ -125,7 +128,7 @@ int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interva Mod_Timer *Mod_timer_list; Module *list_ptr; - segv_location = "add_mod_timer"; + segv_location = sstrdup("add_mod_timer"); Mod_timer_list = new_timer(timer_name); @@ -143,7 +146,9 @@ int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interva return -1; } Mod_timer_list->function = dlsym(list_ptr->dl_handle, func_name); +#ifdef DEBUG log("Registered Module %s with timer for Function %s", list_ptr->info->module_name, func_name); +#endif return 1; } list_ptr = list_ptr->next; @@ -154,8 +159,7 @@ int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interva int del_mod_timer(char *timer_name) { Mod_Timer *list; - segv_location = "del_mod_timer"; - log("unloadtimer"); + segv_location = sstrdup("del_mod_timer"); list = findtimer(timer_name); @@ -173,7 +177,7 @@ int del_mod_timer(char *timer_name) { void list_module_timer(User *u) { Mod_Timer *mod_ptr = NULL; register int j; - segv_location = "list_module_timer"; + segv_location = sstrdup("list_module_timer"); privmsg(u->nick,s_Services,"Module timer List:"); for (j = 0; j < T_TABLE_SIZE; j++) { for (mod_ptr = module_timer_lists[j]; mod_ptr; mod_ptr = mod_ptr->next) { @@ -212,8 +216,9 @@ static void del_sock_from_hash_table(char *sockname, Sock_List *s) { static Sock_List *new_sock(char *sock_name) { Sock_List *s; - +#ifdef DEBUG log("New Socket: %s", sock_name); +#endif s = smalloc(sizeof(Sock_List)); if (!sock_name) sock_name=""; @@ -234,7 +239,7 @@ int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name) { Sock_List *Sockets_mod_list; Module *list_ptr; - segv_location = "add_Socket"; + segv_location = sstrdup("add_Socket"); Sockets_mod_list = new_sock(sock_name); @@ -251,7 +256,9 @@ int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name) { return -1; } Sockets_mod_list->function = dlsym(list_ptr->dl_handle, func_name); +#ifdef DEBUG log("Registered Module %s with Socket for Function %s", list_ptr->info->module_name, func_name); +#endif return 1; } list_ptr = list_ptr->next; @@ -262,7 +269,7 @@ int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name) { int del_socket(char *sock_name) { Sock_List *list; - segv_location = "del_mod_timer"; + segv_location = sstrdup("del_mod_timer"); #ifdef DEBUG log("Del_Sock"); #endif @@ -283,7 +290,7 @@ int del_socket(char *sock_name) { void list_sockets(User *u) { Sock_List *mod_ptr = NULL; register int j; - segv_location = "list_sockets"; + segv_location = sstrdup("list_sockets"); privmsg(u->nick,s_Services,"Sockets List:"); for (j = 0; j < MAX_SOCKS; j++) { for (mod_ptr = Socket_lists[j]; mod_ptr; mod_ptr = mod_ptr->next) { @@ -323,8 +330,9 @@ static void del_bot_from_hash_table(char *bot_name, Mod_User *u) { static Mod_User *new_bot(char *bot_name) { Mod_User *u; - +#ifdef DEBUG log("New Bot: %s", bot_name); +#endif u = smalloc(sizeof(Mod_User)); if (!bot_name) bot_name=""; @@ -335,16 +343,20 @@ static Mod_User *new_bot(char *bot_name) Mod_User *findbot(char *bot_name) { Mod_User *u; + int i; - u = module_bot_lists[HASH(bot_name, B_TABLE_SIZE)]; - while (u && strcasecmp(u->nick, bot_name) != 0) - u = u->next; - return u; + for (i = 0; i < B_TABLE_SIZE; i++) { + for (u = module_bot_lists[i]; u; u = u->next) { + if (!strcasecmp(u->nick, bot_name)) + return u; + } + } + return NULL; } int del_mod_user(char *bot_name) { Mod_User *list; - segv_location = "del_mod_user"; + segv_location = sstrdup("del_mod_user"); list = findbot(bot_name); @@ -364,7 +376,7 @@ int bot_nick_change(char *oldnick, char *newnick) { User *u; Mod_User *mod_tmp, *mod_ptr = NULL; - segv_location = "bot_nick_change"; + segv_location = sstrdup("bot_nick_change"); /* First, try to find out if the newnick is unique! */ #ifdef DEBUG @@ -403,7 +415,7 @@ int add_mod_user(char *nick, char *mod_name) { Mod_User *Mod_Usr_list; Module *list_ptr; - segv_location = "add_mod_user"; + segv_location = sstrdup("add_mod_user"); Mod_Usr_list = new_bot(nick); @@ -425,7 +437,7 @@ int add_mod_user(char *nick, char *mod_name) { void list_module_bots(User *u) { Mod_User *mod_ptr = NULL; register int j; - segv_location = "list_module_bots"; + segv_location = sstrdup("list_module_bots"); privmsg(u->nick,s_Services,"Module Bot List:"); @@ -454,7 +466,7 @@ int load_module(char *path1, User *u) { EventFnList *event_fn_ptr = NULL; Module *mod_ptr = NULL, *list_ptr = NULL; - segv_location = "load_module"; + segv_location = sstrdup("load_module"); if (u == NULL) { do_msg = 0; } else { @@ -564,7 +576,7 @@ int load_module(char *path1, User *u) { }; void list_module(User *u) { Module *mod_ptr = NULL; - segv_location = "list_module"; + segv_location = sstrdup("list_module"); mod_ptr = module_list->next; privmsg(u->nick,s_Services,"Module List:"); while(mod_ptr != NULL) { @@ -582,7 +594,7 @@ int unload_module(char *module_name, User *u) { Mod_Timer *mod_tmr = NULL; register int j; - segv_location = "unload_module"; + segv_location = sstrdup("unload_module"); /* Check to see if this Module has any timers registered.... */ for (j = 0; j < T_TABLE_SIZE; j++ ) { for (mod_tmr = module_timer_lists[j]; mod_tmr; mod_tmr = mod_tmr->next) { diff --git a/dl.h b/dl.h index bc6acc46..ac78fb87 100755 --- a/dl.h +++ b/dl.h @@ -100,5 +100,20 @@ struct path { typedef struct path LD_Path; +extern void __init_mod_list(); +extern int load_module(char *path,User *u); +extern int unload_module(char *module_name,User *u); +extern int add_ld_path(char *path); +extern void list_module(User *); +extern void list_module_bots(User *); +extern int add_mod_user(char *nick, char *mod_name); +extern int del_mod_user(char *nick); +extern int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interval); +extern int del_mod_timer(char *timer_name); +extern void list_module_timer(User *); +extern int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name); +extern int del_socket(char *sockname); +extern void list_sockets(User *); +extern Mod_User *findbot(char *); #endif /* !_dl_h_ */ diff --git a/dl/icq/icq.c b/dl/icq/icq.c index b00b2a0c..06babf9c 100644 --- a/dl/icq/icq.c +++ b/dl/icq/icq.c @@ -153,8 +153,9 @@ void __Bot_Message(char *origin, char *coreLine) { char *cmd, *rest; User *u; - +#ifdef DEBUG log("origin %s, coreline %s", origin, coreLine); +#endif u = finduser(origin); if (!u) { log("Unable to finduser %s (IcqServ)", origin); @@ -212,7 +213,9 @@ return 1; int do_connect(const char *server, int port) { +#ifdef DEBUG log("Connecting to: %s:%d",server,port); +#endif icq_UnsetProxy(); icq_Connect(server,port); add_socket("icq_HandleServerResponse", "ICQ Port 400UDP", icq_Sok, my_info[0].module_name); diff --git a/dl/spam/spam.c b/dl/spam/spam.c index eba1b307..fc861079 100644 --- a/dl/spam/spam.c +++ b/dl/spam/spam.c @@ -4,7 +4,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: spam.c,v 1.1 2000/02/18 02:10:29 fishwaldo Exp $ +** $Id: spam.c,v 1.2 2000/03/29 13:05:56 fishwaldo Exp $ */ @@ -83,7 +83,6 @@ int __Bot_Message(char *origin, char *coreLine, int type) int Online(Server *data) { - log("testing %s", data->name); if (init_bot(s_Spam,"please",me.name,"Chat to me", "+xd", my_info[0].module_name) == -1 ) { /* Nick was in use!!!! */ s_Spam = strcat(s_Spam, "_"); diff --git a/dl/statserv/m_stats.h b/dl/statserv/m_stats.h index c6ef166a..a01db22f 100644 --- a/dl/statserv/m_stats.h +++ b/dl/statserv/m_stats.h @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: m_stats.h,v 1.2 2000/02/18 00:42:25 fishwaldo Exp $ +** $Id: m_stats.h,v 1.3 2000/03/29 13:05:57 fishwaldo Exp $ */ #ifndef M_STATS_H @@ -15,8 +15,8 @@ #define DecreaseUsers(x) x->users--; stats_network.users--; #define DecreaseServers() stats_network.servers--; -#define IncreaseOpers(x) x->opers++; stats_network.opers++; -#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; x->daily_totusers++; stats_network.totusers++; -#define IncreaseServers() stats_network.servers++; +#define IncreaseOpers(x) x->opers++; stats_network.opers++; daily.opers++; +#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; x->daily_totusers++; stats_network.totusers++; daily.users++; +#define IncreaseServers() stats_network.servers++; daily.servers++; #endif diff --git a/dl/statserv/statserv.c b/dl/statserv/statserv.c index 2eb6496a..da27d00a 100644 --- a/dl/statserv/statserv.c +++ b/dl/statserv/statserv.c @@ -4,7 +4,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: statserv.c,v 1.11 2000/03/05 06:44:47 fishwaldo Exp $ +** $Id: statserv.c,v 1.12 2000/03/29 13:05:57 fishwaldo Exp $ */ #include "statserv.h" @@ -15,8 +15,12 @@ TLD *tldhead; extern const char version_date[], version_time[]; +static void ss_daily(User *u); +static void ss_reset(User *u); +static void ss_stats(User *u, char *cmd, char *arg, char *arg2); static void ss_JOIN(User *u, char *chan); static void ss_tld(User *u, char *tld); +static void ss_tld_map(User *u) ; static void ss_operlist(User *origuser, char *flags, char *server); static void ss_botlist(User *origuser); static void ss_version(User *u); @@ -29,9 +33,11 @@ static int s_new_server(Server *); static int s_new_user(User *); static int s_del_user(User *); static int s_user_modes(User *); +static int s_user_kill(User *); int s_bot_kill(char *); static void ss_cb_Config(char *, int); static int new_m_version(char *av, char *tmp); +static void DelTLD(User *u); char s_StatServ[MAXNICK] = "StatServ"; @@ -57,6 +63,7 @@ EventFnList StatServ_Event_List[] = { {"UMODE", s_user_modes}, {"SIGNOFF", s_del_user}, {"BOTKILL", s_bot_kill}, + {"KILL", s_user_kill}, { NULL, NULL} }; @@ -86,12 +93,37 @@ int new_m_version(char *av, char *tmp) { } void _init() { + Server *ss; + User *u; + int i; + synced = 0; sts(":%s GLOBOPS :StatServ Module Loaded", me.name); LoadTLD(); init_tld(); LoadStats(); + for (i=0; i < S_TABLE_SIZE; i++) { + for (ss = serverlist[i]; ss; ss = ss->next) { + /* do server table stuff */ + s_new_server(ss); +#ifdef DEBUG + log("Added Server %s to StatServ List", ss->name); +#endif + } + } + + for (i=0; i < U_TABLE_SIZE; i++) { + for (u = userlist[i]; u; u = u->next) { + /* do User stuff, as yet, we have nuffin... :( */ + /* Should also process Usermodes and fun stuff like that (maybe?) */ + s_new_user(u); + s_user_modes(u); +#ifdef DEBUG + log("Adduser user %s to StatServ List", u->nick); +#endif + } + } } @@ -107,12 +139,39 @@ static int s_new_server(Server *s) { if (stats_network.maxservers < stats_network.servers) { stats_network.maxservers = stats_network.servers; stats_network.t_maxservers = time(NULL); - if (synced) sts("%s WALLOPS :\2NEW SERVER RECORD\2 Wow, there are now %d Servers on the Network", s_StatServ, stats_network.servers); + if (synced) sts(":%s WALLOPS :\2NEW SERVER RECORD\2 Wow, there are now %d Servers on the Network", s_StatServ, stats_network.servers); } if (synced) notice(s_StatServ, "\2SERVER\2 %s has joined the Network at %s", s->name, s->uplink); return 1; } +static int s_user_kill(User *u) { + SStats *s; + char *cmd, *who; +#ifdef DEBUG + log(" Server %s", u->server->name); +#endif + s=findstats(u->server->name); + if (UserLevel(u) >= 40) { + DecreaseOpers(s); + } + DecreaseUsers(s); + DelTLD(u); + cmd = sstrdup(recbuf); + who = strtok(cmd, " "); + cmd = strtok(NULL, " "); + cmd = strtok(NULL, " "); + cmd = strtok(NULL, ""); + cmd++; + who++; + if (finduser(who)) { + /* it was a User that killed the target */ + if (synced) notice(s_StatServ, "\2KILL\2 %s was Killed by %s --> %s", u->nick, who, cmd); + } else if (findserver(who)) { + if (synced) notice(s_StatServ, "\2SERVER KILL\2 %s was Killed by the Server %s --> %s", u->nick, who, cmd); + } + return 1; +} static int s_user_modes(User *u) { int add = 0; @@ -123,12 +182,13 @@ static int s_user_modes(User *u) { log("Changing modes for unknown user: %s", u->nick); return -1; } -/* if (!u->modes) return -1; */ + if (!u->modes) return -1; modes = u->modes; - log("s_modes %s", modes); /* Don't bother if we are not synceded yet */ while (*modes++) { - log("Doing Modes %c", *modes); +#ifdef DEBUG + log("s_modes %c", *modes); +#endif switch(*modes) { case '+': add = 1; break; case '-': add = 0; break; @@ -210,17 +270,19 @@ static int s_user_modes(User *u) { if (stats_network.maxopers < stats_network.opers) { stats_network.maxopers = stats_network.opers; stats_network.t_maxopers = time(NULL); - if (synced) sts("%s WALLOPS :\2Oper Record\2 The Network has reached a New Record for Opers at %d", s_StatServ, stats_network.opers); + if (synced) sts(":%s WALLOPS :\2Oper Record\2 The Network has reached a New Record for Opers at %d", s_StatServ, stats_network.opers); } if (s->maxopers < s->opers) { s->maxopers = s->opers; s->t_maxopers = time(NULL); - if (synced) sts("%s WALLOPS :\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s_StatServ, s->name, s->opers); + if (synced) sts(":%s WALLOPS :\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s_StatServ, s->name, s->opers); } } else { if (synced) notice(s_StatServ, "\2Oper\2 %s is No Longer a Oper on %s (-o)", u->nick, u->server->name); DecreaseOpers(findstats(u->server->name)); +#ifdef DEBUG log("Decrease Opers"); +#endif } break; case 'O': @@ -231,17 +293,19 @@ static int s_user_modes(User *u) { if (stats_network.maxopers < stats_network.opers) { stats_network.maxopers = stats_network.opers; stats_network.t_maxopers = time(NULL); - if (synced) sts("%s WALLOPS :\2Oper Record\2 The Network has reached a New Record for Opers at %d", s_StatServ, stats_network.opers); + if (synced) sts(":%s WALLOPS :\2Oper Record\2 The Network has reached a New Record for Opers at %d", s_StatServ, stats_network.opers); } if (s->maxopers < s->opers) { s->maxopers = s->opers; s->t_maxopers = time(NULL); - if (synced) sts("%s WALLOPS :\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s_StatServ, s->name, s->opers); + if (synced) sts(":%s WALLOPS :\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", s_StatServ, s->name, s->opers); } } else { if (synced) notice(s_StatServ, "\2Oper\2 %s is No Longer a Oper on %s (-o)", u->nick, u->server->name); DecreaseOpers(findstats(u->server->name)); +#ifdef DEBUG log("Decrease Opers"); +#endif } break; default: @@ -254,12 +318,14 @@ int s_bot_kill(char *nick) { User *u; SStats *s; + u=finduser(nick); log("Oh Oh, the StatServ Bot Got Killed! - Re-Initializing"); s=findstats(u->server->name); if (UserLevel(u) >= 40) { DecreaseOpers(s); } + DelTLD(u); DecreaseUsers(s); /* we have to remove it from our List */ del_mod_user(nick); @@ -284,6 +350,7 @@ static int s_del_user(User *u) { DecreaseOpers(s); } DecreaseUsers(s); + DelTLD(u); cmd = sstrdup(recbuf); cmd = strtok(cmd, " "); cmd = strtok(NULL, " "); @@ -306,15 +373,16 @@ static int s_new_user(User *u) { /* New User Record */ s->maxusers = s->users; s->t_maxusers = time(NULL); - if (synced) sts("%s WALLOPS :\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", s_StatServ, s->name, s->users); + if (synced) sts(":%s WALLOPS :\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", s_StatServ, s->name, s->users); } if (stats_network.maxusers < stats_network.users) { stats_network.maxusers = stats_network.users; stats_network.t_maxusers = time(NULL); - if (synced) sts("%s WALLOPS :\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %d users!", s_StatServ, stats_network.users); + if (synced) sts(":%s WALLOPS :\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %d users!", s_StatServ, stats_network.users); } if (synced) notice(s_StatServ, "\2SIGNON\2 %s(%s@%s) has Signed on at %s", u->nick, u->username, u->hostname, u->server->name); + AddTLD(u); return 1; } @@ -352,9 +420,6 @@ int pong(Server *s) { } int Online(Server *s) { - Server *ss; - User *u; - int i; memcpy(StatServ.user, Servbot.user, 8); memcpy(StatServ.host, Servbot.host, MAXHOST); StatServ.lag = 0; @@ -366,34 +431,10 @@ int Online(Server *s) { init_bot(s_StatServ, StatServ.user,StatServ.host,"/msg Statserv HELP", "+oikSdwgle", Statserv_Info[0].module_name); } -/* We should go the the existing server/user lists and add them to stats, cause its possible - that this has been called after the server already connected */ - - for (i=0; i < S_TABLE_SIZE; i++) { - for (ss = serverlist[i]; ss; ss = ss->next) { - /* do server table stuff */ - s_new_server(ss); -#ifdef DEBUG - log("Added Server %s to StatServ List", ss->name); -#endif - } - } - - for (i=0; i < U_TABLE_SIZE; i++) { - for (u = userlist[i]; u; u = u->next) { - /* do User stuff, as yet, we have nuffin... :( */ - /* Should also process Usermodes and fun stuff like that (maybe?) */ - s_new_user(u); - s_user_modes(u); -#ifdef DEBUG - log("Adduser user %s to StatServ List", u->nick); -#endif - } - } - /* now that we are online, setup the timer to save the Stats database every so often */ add_mod_timer("SaveStats", "Save_Stats_DB", Statserv_Info[0].module_name, 600); - +/* also add a timer to check if its midnight (to reset the daily stats */ + add_mod_timer("Is_Midnight", "Daily_Stats_Reset", Statserv_Info[0].module_name, 60); synced = 1; return 1; @@ -404,7 +445,6 @@ void ss_cb_Config(char *arg, int configtype) { /* Nick */ memcpy(StatServ.nick, arg, MAXNICK); memcpy(s_StatServ, StatServ.nick, MAXNICK); - log("Statserv nick :%s ", arg); } else if (configtype == 1) { /* User */ memcpy(StatServ.user, arg, 8); @@ -434,8 +474,7 @@ int __Bot_Message(char *origin, char *coreLine, int type) return -1; log("%s received message from %s: %s", s_StatServ, u->nick, coreLine); - - log("OnlyOpers %d", me.onlyopers); + if (me.onlyopers && UserLevel(u) < 40) { privmsg(u->nick, s_StatServ, "This service is only available to IRCops."); @@ -446,7 +485,11 @@ int __Bot_Message(char *origin, char *coreLine, int type) if (!strcasecmp(cmd, "HELP")) { coreLine = strtok(NULL, " "); - notice(s_StatServ,"%s is a Dummy and wanted help on %s",u->nick, coreLine); + if(!coreLine) { + notice(s_StatServ, "%s is a Dummy and wanted Help", u->nick); + } else { + notice(s_StatServ,"%s is a Dummy and wanted help on %s",u->nick, coreLine); + } if (!coreLine) { privmsg_list(u->nick, s_StatServ, ss_help); if (UserLevel(u) >= 150) @@ -494,18 +537,16 @@ int __Bot_Message(char *origin, char *coreLine, int type) } else if (!strcasecmp(cmd, "NETSTATS")) { ss_netstats(u); notice(s_StatServ,"%s Wanted to see the NetStats ",u->nick); -/* } else if (!strcasecmp(cmd, "DAILY")) { + } else if (!strcasecmp(cmd, "DAILY")) { ss_daily(u); notice(s_StatServ,"%s Wanted to see the Daily NetStats ",u->nick); -*/ } else if (!strcasecmp(cmd, "TLD")) { cmd = strtok(NULL, " "); ss_tld(u, cmd); notice(s_StatServ,"%s Wanted to find the Country that is Represented by %s ",u->nick,cmd); -/* } else if (!strcasecmp(cmd, "TLDMAP")) { + } else if (!strcasecmp(cmd, "TLDMAP")) { ss_tld_map(u); notice(s_StatServ,"%s Wanted to see a Country Breakdown",u->nick); -*/ } else if (!strcasecmp(cmd, "OPERLIST")) { char *t; cmd = strtok(NULL, " "); @@ -514,7 +555,7 @@ int __Bot_Message(char *origin, char *coreLine, int type) } else if (!strcasecmp(cmd, "BOTLIST")) { ss_botlist(u); notice(s_StatServ,"%s Wanted to see the Bot List",u->nick); -/* } else if (!strcasecmp(cmd, "STATS")) { + } else if (!strcasecmp(cmd, "STATS")) { char *t, *m; m = strtok(NULL, " "); cmd = strtok(NULL, " "); @@ -524,7 +565,6 @@ int __Bot_Message(char *origin, char *coreLine, int type) } else if (!strcasecmp(cmd, "RESET")) { notice(s_StatServ,"%s Wants me to RESET the databases.. here goes..",u->nick); ss_reset(u); -*/ } else { privmsg(u->nick, s_StatServ, "Unknown Command: \2%s\2", cmd); @@ -533,11 +573,42 @@ int __Bot_Message(char *origin, char *coreLine, int type) return 1; } +void Is_Midnight() { + time_t current = time(NULL); + struct tm *ltm = localtime(¤t); + TLD *t; + if (ltm->tm_hour == 0) { + if (ltm->tm_min == 0) { + /* its Midnight! */ + notice(s_StatServ, "Reseting Daily Statistics - Its Midnight here!"); + log("Resetting Daily Statistics"); + daily.servers = 0; + daily.t_servers = time(NULL); + daily.users = 0; + daily.t_users = time(NULL); + daily.opers = 0; + daily.t_opers = time(NULL); + for (t = tldhead; t; t = t->next) + t->daily_users = 0; + + } + } +} +static void ss_tld_map(User *u) { + TLD *t; + + privmsg(u->nick, s_StatServ, "Top Level Domain Statistics:"); + for (t = tldhead; t; t = t->next) { + if (t->users != 0) + privmsg(u->nick, s_StatServ, "%3s \2%3d\2 (%2.0f%%) -> %s ---> Daily Total: %d", t->tld, t->users, (float)t->users / (float)stats_network.users * 100, t->country, t->daily_users); + } + privmsg(u->nick, s_StatServ, "End of List"); +} + static void ss_version(User *u) { privmsg(u->nick, s_StatServ, "\2StatServ Version Information\2"); - privmsg(u->nick, s_StatServ, "%s - %s", me.name, version, - me.name, version_date, version_time); + privmsg(u->nick, s_StatServ, "%s - %s Compiled %s at %s", me.name, Statserv_Info[0].module_version, version_date, version_time); privmsg(u->nick, s_StatServ, "http://www.neostats.net"); } static void ss_netstats(User *u) { @@ -551,6 +622,14 @@ static void ss_netstats(User *u) { privmsg(u->nick, s_StatServ, "Maximum Servers: %d [%s]", stats_network.maxservers, sftime(stats_network.t_maxservers)); privmsg(u->nick, s_StatServ, "--- End of List ---"); } +static void ss_daily(User *u) { + privmsg(u->nick, s_StatServ, "Daily Network Statistics:"); + privmsg(u->nick, s_StatServ, "Maximum Servers: %-2d %s", daily.servers, sftime(daily.t_servers)); + privmsg(u->nick, s_StatServ, "Maximum Users: %-2d %s", daily.users, sftime(daily.t_users)); + privmsg(u->nick, s_StatServ, "Maximum Opers: %-2d %s", daily.opers, sftime(daily.t_opers)); + privmsg(u->nick, s_StatServ, "All Daily Statistics are reset at Midnight"); + privmsg(u->nick, s_StatServ, "End of Information."); +} static void ss_map(User *u) { SStats *ss; @@ -660,7 +739,7 @@ static void ss_operlist(User *origuser, char *flags, char *server) continue; if (!strcasecmp(u->server->name, me.services_name)) continue; - if (UserLevel(u) < 40) + if (tech < 40) continue; if (!server) { if (UserLevel(u) < 40) continue; @@ -686,27 +765,25 @@ static void ss_botlist(User *origuser) { register int i, j = 0; register User *u; - int bot = 1; privmsg(origuser->nick, s_StatServ, "On-Line Bots:"); for (i = 0; i < U_TABLE_SIZE; i++) { for (u = userlist[i]; u; u = u->next) { - if (bot && UserLevel(u) == 10) - continue; + if (u->Umode & UMODE_BOT) { j++; - privmsg(origuser->nick, s_StatServ, "[%2d] %-15s %s",j, u->nick, - u->server->name); + privmsg(origuser->nick, s_StatServ, "[%2d] %-15s %s",j, u->nick, u->server->name); continue; + } } } privmsg(origuser->nick, s_StatServ, "End of Listing."); } -/* + static void ss_stats(User *u, char *cmd, char *arg, char *arg2) { - Stats *st; + SStats *st; - if (!u->is_tecmin) { + if (UserLevel(u) < 190) { log("Access Denied (STATS) to %s", u->nick); privmsg(u->nick, s_StatServ, "Access Denied."); return; @@ -722,14 +799,14 @@ static void ss_stats(User *u, char *cmd, char *arg, char *arg2) if (!strcasecmp(cmd, "LIST")) { int i = 1; privmsg(u->nick, s_StatServ, "Statistics Database:"); - for (st = shead; st; st = st->next) { + for (st = Shead; st; st = st->next) { privmsg(u->nick, s_StatServ, "[%-2d] %s", i, st->name); i++; } privmsg(u->nick, s_StatServ, "End of List."); log("%s requested STATS LIST.", u->nick); } else if (!strcasecmp(cmd, "DEL")) { - Stats *m = NULL; + SStats *m = NULL; if (!arg) { privmsg(u->nick, s_StatServ, "Syntax: /msg %s STATS DEL ", s_StatServ); @@ -743,7 +820,7 @@ static void ss_stats(User *u, char *cmd, char *arg, char *arg2) arg); return; } - for (st = shead; st; st = st->next) { + for (st = Shead; st; st = st->next) { if (!strcasecmp(arg, st->name)) break; m = st; @@ -751,7 +828,7 @@ static void ss_stats(User *u, char *cmd, char *arg, char *arg2) if (m) m->next = st->next; else - shead = st->next; + Shead = st->next; free(st); privmsg(u->nick, s_StatServ, "Removed %s from the database.", arg); log("%s requested STATS DEL %s", u->nick, arg); @@ -780,9 +857,6 @@ static void ss_stats(User *u, char *cmd, char *arg, char *arg2) } s = NULL; memcpy(st->name, arg2, sizeof(st->name)); - s = findserver(st->name); - if (s) - s->stats = st; privmsg(u->nick, s_StatServ, "Moved database entry for %s to %s", arg, arg2); log("%s requested STATS COPY %s -> %s", u->nick, arg, arg2); @@ -791,11 +865,10 @@ static void ss_stats(User *u, char *cmd, char *arg, char *arg2) privmsg(u->nick, s_StatServ, "For help, /msg %s HELP", s_StatServ); } } -*/ -/* + static void ss_reset(User *u) { - if (!u->is_tecmin) { + if (UserLevel(u) < 190) { log("Access Denied (RELOAD) to %s", u->nick); privmsg(u->nick, s_StatServ, "Access Denied."); return; @@ -805,11 +878,12 @@ static void ss_reset(User *u) globops(s_StatServ, "%s requested \2RESET\2 databases.", u->nick); log("%s requested RESET.", u->nick); globops(s_StatServ, "Rebuilding Statistics DataBase after RESET..."); + privmsg(u->nick, s_StatServ, "Databases Reset! I hope you wanted to really do that!"); } -*/ + static void ss_JOIN(User *u, char *chan) { - if (UserLevel(u) >= 190) { + if (UserLevel(u) < 190) { log("Access Denied (JOIN) to %s", u->nick); privmsg(u->nick, s_StatServ, "Access Denied."); notice(s_StatServ,"%s Requested JOIN, but is not a god!",u->nick); @@ -823,11 +897,36 @@ static void ss_JOIN(User *u, char *chan) privmsg(me.chan, s_StatServ, "%s Asked me to Join %s, So, I'm Leaving %s", u->nick, chan, me.chan); sts(":%s part %s", s_StatServ, me.chan); log("%s!%s@%s Asked me to Join %s, I was on %s", u->nick, u->username, u->hostname, chan, me.chan); - sprintf(me.chan,"%s",chan); sts(":%s JOIN %s",s_StatServ,chan); sts(":%s MODE %s +o %s",me.name,chan,s_StatServ); } +void DelTLD(User *u) { + TLD *t = NULL; + char *m; + + m = strrchr(u->hostname, '.'); + + if (!m) + t = findtld("num"); + else + m++; + + if (!t) { + if (!isdigit(*m)) + t = findtld(m); + else + t = findtld("num"); + } + + if (!t) { + log("Unable to find TLD entry for %s (%s)", u->nick, m); + log("*** NOTICE *** Please send a copy of this logfile to " + "net@lite.net"); + return; + } + t->users--; +} /* "net" -- not DOT"net" */ TLD *findtld(char *tld) @@ -868,6 +967,7 @@ TLD *AddTLD(User *u) return NULL; } t->users++; + t->daily_users++; return t; } diff --git a/dl/statserv/statserv.h b/dl/statserv/statserv.h index d236a0fb..e63f24f3 100644 --- a/dl/statserv/statserv.h +++ b/dl/statserv/statserv.h @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: statserv.h,v 1.5 2000/02/23 05:39:25 fishwaldo Exp $ +** $Id: statserv.h,v 1.6 2000/03/29 13:05:57 fishwaldo Exp $ */ #ifndef STATSERV_H @@ -84,6 +84,7 @@ struct tld_ { char tld[4]; char *country; int users; + int daily_users; }; /* statserv.c */ diff --git a/dotconf.c b/dotconf.c index 1a25b321..73420bd0 100644 --- a/dotconf.c +++ b/dotconf.c @@ -94,7 +94,7 @@ void config_substitute_env(char *str) else while ( (cp1 != eos) && (*cp1 != '}') ) cp1++; if (*cp1 != '}') - fprintf(stderr, "%s:%ld: Unbalanced '{'\n", + fprintf(stderr, "%s:%d: Unbalanced '{'\n", dotconf_file, dotconf_line); else { @@ -342,7 +342,7 @@ int config_parse(FILE *config) } } } - + return -1; } /* * open and parse the config-file using the config_options list diff --git a/ircd.c b/ircd.c index 2f9c7fcf..27b7307f 100755 --- a/ircd.c +++ b/ircd.c @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: ircd.c,v 1.10 2000/03/03 06:03:42 fishwaldo Exp $ +** $Id: ircd.c,v 1.11 2000/03/29 13:05:56 fishwaldo Exp $ */ #include "stats.h" @@ -80,8 +80,8 @@ IntCommands cmd_list[] = { {TOK_MODE, Usr_Mode, 1}, {MSG_SVSMODE, Usr_Smode, 1}, {TOK_SVSMODE, Usr_Smode, 1}, - {MSG_SVS2MODE, Usr_Mode, 1}, - {TOK_SVS2MODE, Usr_Mode, 1}, + {MSG_SVS2MODE, Usr_Smode, 1}, + {TOK_SVS2MODE, Usr_Smode, 1}, {MSG_KILL, Usr_Kill, 1}, {TOK_KILL, Usr_Kill, 1}, {MSG_PONG, Usr_Pong, 1}, @@ -121,13 +121,12 @@ int init_bot(char *nick, char *user, char *host, char *rname, char *modes, char { User *u; char tmp[512]; - segv_location = "init_bot"; + segv_location = sstrdup("init_bot"); u = finduser(nick); if (u) { log("Attempting to Login with a Nickname that already Exists: %s",nick); return -1; } - log("about to addnick %s",nick); add_mod_user(nick, mod_name); sts("NICK %s 1 %d %s %s %s 0 :%s", nick, time(NULL), user, host, me.name, rname); AddUser(nick, user, host, me.name); @@ -137,19 +136,23 @@ int init_bot(char *nick, char *user, char *host, char *rname, char *modes, char sts(":%s MODE %s +a %s",nick,me.chan,nick); sprintf(tmp, ":%s", modes); UserMode(nick, tmp); + Module_Event("SIGNON", finduser(nick)); return 1; } int del_bot(char *nick, char *reason) { User *u; - segv_location = "del_bot"; + segv_location = sstrdup("del_bot"); u = finduser(nick); +#ifdef DEBUG log("Killing %s for %s",nick,reason); +#endif if (!u) { log("Attempting to Logoff with a Nickname that does not Exists: %s",nick); return -1; } + Module_Event("SIGNOFF", finduser(nick)); sts(":%s QUIT :%s",nick,reason); DelUser(nick); del_mod_user(nick); @@ -164,7 +167,7 @@ void Module_Event(char *event, void *data) { EventFnList *ev_list; - segv_location = "Module_Event"; + segv_location = sstrdup("Module_Event"); module_ptr = module_list->next; while (module_ptr != NULL) { /* this goes through each Module */ @@ -175,9 +178,9 @@ void Module_Event(char *event, void *data) { #ifdef DEBUG log("Running Module %s for Comamnd %s -> %s",module_ptr->info->module_name, event, ev_list->cmd_name); #endif - segv_location = module_ptr->info->module_name; + segv_location = sstrdup(module_ptr->info->module_name); ev_list->function(data); - segv_location = "Module_Event_Return"; + segv_location = sstrdup("Module_Event_Return"); break; } ev_list++; @@ -195,15 +198,13 @@ void parse(char *line) Functions *fn_list; Mod_User *list; - segv_location = "parse"; + segv_location = sstrdup("parse"); strip(line); - recbuf = strdup(line); + strcpy(recbuf, line); if (!(*line)) return; - coreLine = sstrdup(line); - #ifdef DEBUG log("R: %s", line); #endif @@ -223,11 +224,11 @@ void parse(char *line) coreLine = strtok(NULL, ""); coreLine++; /* coreLine contains the Actual Message now, cmd, is who its too */ - if (!strcmp(s_Services,cmd)) { + if (!strcasecmp(s_Services,cmd)) { /* its to the Internal Services Bot */ - segv_location = "servicesbot"; + segv_location = sstrdup("servicesbot"); servicesbot(origin,coreLine); - segv_location = "ServicesBot_return"; + segv_location = sstrdup("ServicesBot_return"); return; } else { list = findbot(cmd); @@ -236,24 +237,27 @@ void parse(char *line) #ifdef DEBUG log("nicks: %s", list->nick); #endif - segv_location = list->modname; + segv_location = sstrdup(list->modname); list->function(origin, coreLine); + return; } log("Recieved a Message for %s, but that user is not registered with us!!!", cmd); } } /* now, Parse the Command to the Internal Functions... */ + segv_location = sstrdup("Parse - Internal Functions"); for (I=0; I < ((sizeof(cmd_list) / sizeof(cmd_list[0])) -1); I++) { if (!strcasecmp(cmd_list[I].name, cmd)) { if (cmd_list[I].srvmsg == cmdptr) { - segv_location = cmd_list[I].name; + segv_location = sstrdup(cmd_list[I].name); cmd_list[I].function(origin, coreLine); break; log("should never get here-Parse"); } } } /* K, now Parse it to the Module functions */ + segv_location = sstrdup("Parse - Module Functions"); module_ptr = module_list->next; while (module_ptr != NULL) { /* this goes through each Module */ @@ -265,9 +269,9 @@ void parse(char *line) #ifdef DEBUG log("Running Module %s for Function %s", module_ptr->info->module_name, fn_list->cmd_name); #endif - segv_location = module_ptr->info->module_name; + segv_location = sstrdup(module_ptr->info->module_name); fn_list->function(origin, coreLine); - segv_location = "Parse_Return_Module"; + segv_location = sstrdup("Parse_Return_Module"); break; log("Should never get here-Parse"); } @@ -341,10 +345,12 @@ void Usr_DelUser(char *origin, char *coreLine) { DelUser(origin); } void Usr_Smode(char *origin, char *coreLine) { - char *cmd, *mode; + char *cmd, *mode, tmp[25]; cmd = strtok(coreLine, " "); mode = strtok(NULL, ""); - UserMode(cmd, mode); + /* this is a hack */ + sprintf(tmp, ":%s", mode); + UserMode(cmd, tmp); Module_Event("UMODE", finduser(cmd)); } @@ -404,12 +410,16 @@ void Usr_Pong(char *origin, char *coreLine) { } void Usr_Away(char *origin, char *coreLine) { User *u = finduser(origin); - if (u->is_away) { - u->is_away = 0; + if (u) { + if (u->is_away) { + u->is_away = 0; + } else { + u->is_away = 1; + } + Module_Event("AWAY", u); } else { - u->is_away = 1; + log("Warning, Unable to find User %s for Away", origin); } - Module_Event("AWAY", u); } void Usr_Nick(char *origin, char *coreLine) { char *cmd; @@ -454,7 +464,7 @@ void Usr_Join(char *origin, char *coreLine) { void Usr_Part(char *origin, char *coreLine) { } void Srv_Ping(char *origin, char *coreLine) { - log("Ping: %s", coreLine); + sts("PONG %s", coreLine); } void Srv_Netinfo(char *origin, char *coreLine) { @@ -494,7 +504,6 @@ void Srv_Squit(char *origin, char *coreLine) { } void Srv_Nick(char *origin, char *coreLine) { char *user, *host, *server, *cmd; - log("start"); cmd = strtok(coreLine, " "); user = strtok(NULL, " "); user = strtok(NULL, " "); @@ -598,9 +607,9 @@ static void ShowMOTD(char *nick) sts(":%s 375 %s :- %s Message of the Day", me.name, nick, me.name); sts(":%s 372 %s :- ", me.name, nick); - sts(":%s 372 %s :- Origonal Version Copyright:", me.name, nick); + sts(":%s 372 %s :- Version Copyright:", me.name, nick); sts(":%s 372 %s :- %s", me.name, nick, copyright); - sts(":%s 372 %s :- Grab your copy at codebase.kamserve.com", me.name, nick); + sts(":%s 372 %s :- Grab your copy at www.neostats.net", me.name, nick); sts(":%s 376 %s :End of /MOTD command.", me.name, nick); } static void Showcredits(char *nick) diff --git a/main.c b/main.c index dd90c9a1..f067d8b2 100755 --- a/main.c +++ b/main.c @@ -21,22 +21,22 @@ #include "stats.h" #include "signal.h" - +#include "dl.h" char s_Debug[MAXNICK] = "Stats_Debug"; char s_Services[MAXNICK] = "NeoStats"; -const char version[] = "NeoStats-2.0-Alpha4"; +const char version[] = "NeoStats-2.0b2"; const char version_date[] = __DATE__; const char version_time[] = __TIME__; static void start(); static void setup_signals(); +int forked = 0; int main() { - int forked = 0; FILE *fp; - segv_location = "main"; + segv_location = sstrdup("main"); me.onchan = 0; printf("%s Loading...\n", version); printf("-----------------------------------------------\n"); @@ -113,14 +113,13 @@ RETSIGTYPE serv_segv() { /* Broadcast it out! */ globops(me.name,"Ohhh Crap, Server Terminating, Segmentation Fault. Buffer: %s, Approx Location %s", recbuf, segv_location); notice(s_Services, "Damn IT, Server Terminating, Segmentation Fault. Buffer: %s, Approx Location %s", recbuf, segv_location); + globops(me.name,"Dumped Core to netstats.debug, Please Read the Readme file to find out what to do with it!"); sts("SQUIT %s",me.name); - /* Should put some clean up code in here, but for the moment, just die... */ - printf("Ouch, Segmentation Fault, Server Terminating Check Log file for details\n"); sleep(2); - exit(0); - - + kill(forked, 3); + kill(forked, 9); + exit(-1); } @@ -159,7 +158,7 @@ void start() { static int attempts = 0; - segv_location = "start"; + segv_location = sstrdup("start"); TimerReset(); init_server_hash(); init_user_hash(); @@ -195,7 +194,7 @@ void start() void login() { - segv_location = "login"; + segv_location = sstrdup("login"); sts("PASS %s", me.pass); sts("SERVER %s 1 :%s", me.name,me.infoline); sts("PROTOCTL TOKEN"); @@ -205,27 +204,23 @@ void login() void init_ServBot() { - segv_location = "init_ServBot"; + segv_location = sstrdup("init_ServBot"); sts("NICK %s 1 %d %s %s %s 0 :/msg %s \2HELP\2", s_Services, time(NULL), Servbot.user, Servbot.host, me.name, s_Services); AddUser(s_Services, Servbot.user, Servbot.host, me.name); - segv_location = "init_ServBot"; sts(":%s MODE %s +Sqd", s_Services, s_Services); sts(":%s JOIN %s",s_Services ,me.chan); sts(":%s MODE %s +o %s",me.name,me.chan,s_Services); sts(":%s MODE %s +a %s",s_Services,me.chan,s_Services); UserMode(s_Services, ":+Sqd"); - -#ifdef DEBUG - log ("Return from Mode"); -#endif + Module_Event("SIGNON", finduser(s_Services)); } void *smalloc(long size) { void *buf; - segv_location = "smalloc"; + segv_location = sstrdup("smalloc"); if (!size) { log("smalloc(): illegal attempt to allocate 0 bytes!"); size = 1; diff --git a/services.c b/services.c index 84457e1c..fde2cec2 100644 --- a/services.c +++ b/services.c @@ -4,7 +4,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: services.c,v 1.8 2000/03/02 01:31:24 fishwaldo Exp $ +** $Id: services.c,v 1.9 2000/03/29 13:05:56 fishwaldo Exp $ */ #include "stats.h" @@ -217,35 +217,32 @@ char *uptime(time_t when) { char *buf = NULL; time_t u = time(NULL) - when; +#ifdef DEBUG log("time %d",u); +#endif if (u > 86400) { - log("first"); sprintf(buf, "Statistics up \2%ld\2 day%s, \2%02ld:%02ld\2", u/86400, (u/86400 == 1) ? "" : "s", (u/3600) % 24, (u/60) % 60); } else if (u > 3600) { - log("second"); sprintf(buf, "Statistics up \2%ld hour%s, %ld minute%s\2", u/3600, u/3600==1 ? "" : "s", (u/60) % 60, (u/60)%60 == 1 ? "" : "s"); } else if (u > 60) { - log("third"); sprintf(buf, "Statistics up \2%ld minute%s, %ld second%s\2", u/60, u/60 == 1 ? "" : "s", u%60, u%60 == 1 ? "" : "s"); } else { - log("forth"); sprintf(buf, "Statistics up \2%ld second%s\2", u, u == 1 ? "" : "s"); } - log("buf: %s", buf); return buf; } extern void ns_shutdown(User *u, char *reason) { Module *mod_ptr = NULL; - segv_location = "ns_shutdown"; + segv_location = sstrdup("ns_shutdown"); if (strcasecmp(u->nick, s_Services)) { if (!(UserLevel(u) >= 190)) { log("Access Denied (SHUTDOWN) to %s", u->nick); @@ -268,9 +265,6 @@ extern void ns_shutdown(User *u, char *reason) sts("SQUIT %s",me.name); sleep(1); close(servsock); -/* - SaveStats(); -*/ log("%s [%s](%s) requested SHUTDOWN.", u->nick, u->username, u->hostname); exit(0); @@ -278,7 +272,7 @@ extern void ns_shutdown(User *u, char *reason) static void ns_reload(User *u, char *reason) { - segv_location = "ns_reload"; + segv_location = sstrdup("ns_reload"); if (!(UserLevel(u) >= 190)) { log("Access Denied (RELOAD) to %s", u->nick); privmsg(u->nick, s_Services, "Access Denied."); @@ -330,14 +324,13 @@ static void ns_logs(User *u) FILE *fp; char buf[512]; - segv_location = "ns_logs"; + segv_location = sstrdup("ns_logs"); if (!(UserLevel(u) >= 190)) { log("Access Denied (LOGS) to %s", u->nick); privmsg(u->nick, s_Services, "Access Denied."); return; } - log("%s requested LOGS", u->nick); fp = fopen("stats.log", "r"); if (!fp) { privmsg(u->nick, s_Services, "Unable to open stats.log"); @@ -353,7 +346,7 @@ static void ns_logs(User *u) static void ns_jupe(User *u, char *server) { - segv_location = "ns_jupe"; + segv_location = sstrdup("ns_jupe"); if (!(UserLevel(u) >= 190)) { privmsg(u->nick, s_Services, "Access Denied."); return; @@ -369,7 +362,7 @@ static void ns_jupe(User *u, char *server) static void ns_JOIN(User *u, char *chan) { - segv_location = "ns_JOIN"; + segv_location = sstrdup("ns_JOIN"); if (!(UserLevel(u) >= 190)) { log("Access Denied (JOIN) to %s", u->nick); privmsg(u->nick, s_Services, "Access Denied."); @@ -390,7 +383,7 @@ static void ns_JOIN(User *u, char *chan) } void ns_debug_to_coders(char *u) { - segv_location = "ns_debug_to_coders"; + segv_location = sstrdup("ns_debug_to_coders"); if (!me.coder_debug) { me.coder_debug = 1; globops(me.name, "\2DEBUG MODE\2 Activated by %s",u); @@ -411,7 +404,7 @@ void ns_debug_to_coders(char *u) } static void ns_raw(User *u, char *message) { - segv_location = "ns_raw"; + segv_location = sstrdup("ns_raw"); if (!(UserLevel(u) >= 190)) { privmsg(u->nick, s_Services, "Permission Denied, you need to be a TechAdmin to do that!"); return; @@ -421,7 +414,7 @@ static void ns_raw(User *u, char *message) } static void ns_user_dump(User *u) { - segv_location = "ns_user_dump"; + segv_location = sstrdup("ns_user_dump"); if (!(UserLevel(u) >= 200)) { privmsg(u->nick, s_Services, "Permission Denied, you need to be a Coder to Enable Debug Mode!"); return; @@ -431,7 +424,7 @@ static void ns_user_dump(User *u) } static void ns_server_dump(User *u) { - segv_location = "ns_server_dump"; + segv_location = sstrdup("ns_server_dump"); if (!(UserLevel(u) >= 200)) { privmsg(u->nick, s_Services, "Permission Denied, you need to be a Coder to Enable Debug Mode!"); return; @@ -441,7 +434,7 @@ static void ns_server_dump(User *u) } static void ns_chan_dump(User *u) { - segv_location = "ns_chan_dump"; + segv_location = sstrdup("ns_chan_dump"); if (!(UserLevel(u) >= 200)) { privmsg(u->nick, s_Services, "Permission Denied, you need to be a Coder to Enable Debug Mode!"); @@ -452,20 +445,13 @@ static void ns_chan_dump(User *u) } static void ns_uptime(User *u) { - struct rusage *prog_stats; - segv_location = "ns_uptime"; - - if (getrusage(RUSAGE_SELF, prog_stats) == 1) { - log("GetRusage Failed"); - } + segv_location = sstrdup("ns_uptime"); log("time %d", me.t_start); privmsg(u->nick, s_Services, "Statistics Information:"); /* Broken atm */ - - privmsg(u->nick, s_Services, "Kernel User Time: %ld",prog_stats->ru_utime); - privmsg(u->nick, s_Services, "Kernel System Time: %ld", prog_stats->ru_stime); - privmsg(u->nick, s_Services, "Signals Recieved: %ld", prog_stats->ru_nsignals); + privmsg(u->nick, s_Services, "Sent %ld Messages Totaling %ld Bytes", me.SendM, me.SendBytes); + privmsg(u->nick, s_Services, "Recieved %ld Messages, Totaling %ld Bytes", me.RcveM, me.RcveBytes); /* privmsg(u->nick, s_Services, "%s", uptime(me.t_start)); */ privmsg(u->nick, s_Services, "Reconnect Time: %d", me.r_time); privmsg(u->nick, s_Services, "Statistic Requests: %d", me.requests); @@ -478,9 +464,9 @@ static void ns_uptime(User *u) } static void ns_version(User *u) { - segv_location = "ns_version"; + segv_location = sstrdup("ns_version"); privmsg(u->nick, s_Services, "\2StatServ Version Information\2"); privmsg(u->nick, s_Services, "%s - %s", me.name, version, me.name, version_date, version_time); - privmsg(u->nick, s_Services, "http://codeworks.kamserve.com"); + privmsg(u->nick, s_Services, "http://www.neostats.net"); } diff --git a/sock.c b/sock.c index 94dcd018..ed8ce2f6 100755 --- a/sock.c +++ b/sock.c @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: sock.c,v 1.5 2000/03/03 06:03:42 fishwaldo Exp $ +** $Id: sock.c,v 1.6 2000/03/29 13:05:56 fishwaldo Exp $ */ #include "stats.h" @@ -49,10 +49,10 @@ void read_loop() Sock_List *mod_sock; while (1) { - segv_location = "Read_Loop"; + segv_location = sstrdup("Read_Loop"); memset(buf, '\0', BUFSIZE); chk(); - segv_location = "Read_Loop"; + segv_location = sstrdup("Read_Loop2"); FD_ZERO(&readfds); TimeOut.tv_sec = 1; TimeOut.tv_usec = 0; @@ -90,7 +90,6 @@ void read_loop() } } } -/* log("FDISSET failed"); */ break; } } @@ -184,7 +183,7 @@ void ResetLogs() char tmp[25]; time_t t = time(NULL); - segv_location = "ResetLogs"; + segv_location = sstrdup("ResetLogs"); strftime(tmp, 25, "logs/stats-%m-%d.log", localtime(&t)); rename("stats.log", tmp); log("Started fresh logfile."); diff --git a/stats.h b/stats.h index 5d77607f..93a4725d 100644 --- a/stats.h +++ b/stats.h @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: stats.h,v 1.10 2000/03/03 06:03:42 fishwaldo Exp $ +** $Id: stats.h,v 1.11 2000/03/29 13:05:56 fishwaldo Exp $ */ #ifndef STATS_H @@ -54,7 +54,7 @@ int servsock; int times; extern char s_Debug[MAXNICK], s_Services[MAXNICK]; extern const char version[]; -char *recbuf, *segv_location; +char recbuf[BUFSIZE], *segv_location; typedef struct server_ Server; typedef struct user_ User; @@ -65,7 +65,7 @@ typedef struct config_mod_ Config_Mod; struct me { char name[MAXHOST]; - char *modpath; + char modpath[BUFSIZE]; int port; int r_time; int lag_time; @@ -84,8 +84,8 @@ struct me { unsigned int coder_debug : 1; unsigned int noticelag : 1; int action; - char *message; - char *chan; + char message[BUFSIZE]; + char chan[BUFSIZE]; unsigned int onchan : 1; unsigned int usesmo : 1; Server *s; @@ -108,7 +108,7 @@ struct chans_ { char name[CHANLEN]; long cur_users; long hash; - char *modes; + char modes[BUFSIZE]; unsigned int is_priv : 1; unsigned int is_secret : 1; unsigned int is_invite : 1; @@ -125,8 +125,8 @@ struct chans_ { unsigned int is_noinvite : 1; unsigned int is_stripcolor : 1; User *users; - char *topic; - char *topicowner; + char topic[BUFSIZE]; + char topicowner[BUFSIZE]; } chans_; @@ -144,16 +144,16 @@ struct server_ { struct user_ { User *next, *prev; char nick[MAXNICK]; - char *hostname; - char *username; + char hostname[BUFSIZE]; + char username[BUFSIZE]; Server *server; MyUser *myuser; int flood; int is_away; time_t t_flood; long hash; - char *modes; - int *ulevel; + char modes[BUFSIZE]; + int ulevel; long Umode; }; @@ -165,8 +165,8 @@ struct ping { struct myuser_ { MyUser *next; - char *username; - char *password; + char username[BUFSIZE]; + char password[BUFSIZE]; time_t lastseen; unsigned int ison : 1; }; @@ -273,23 +273,6 @@ extern int icq_start(); extern int doICQProtocol(); #endif -/* dl.c */ -extern void __init_mod_list(); -extern int load_module(char *path,User *u); -extern int unload_module(char *module_name,User *u); -extern int add_ld_path(char *path); -extern void list_module(User *); -extern void list_module_bots(User *); -extern int add_mod_user(char *nick, char *mod_name); -extern int del_mod_user(char *nick); -extern int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interval); -extern int del_mod_timer(char *timer_name); -extern void list_module_timer(User *); -extern int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name); -extern int del_socket(char *sockname); -extern void list_sockets(User *); - - /* services.c */ diff --git a/timer.c b/timer.c index bb51f204..06e1541a 100644 --- a/timer.c +++ b/timer.c @@ -5,7 +5,7 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: timer.c,v 1.4 2000/03/02 01:31:24 fishwaldo Exp $ +** $Id: timer.c,v 1.5 2000/03/29 13:05:56 fishwaldo Exp $ */ #include "stats.h" @@ -21,7 +21,7 @@ void chk() Mod_Timer *mod_ptr = NULL; time_t current = time(NULL); register int j; - segv_location = "chk"; + segv_location = sstrdup("chk"); /* First, lets see if any modules have a function that is due to run..... */ for (j = 0; j < T_TABLE_SIZE; j++) { for (mod_ptr = module_timer_lists[j]; mod_ptr; mod_ptr = mod_ptr->next) { @@ -95,16 +95,3 @@ int is_midnight() return 0; } -void WriteStats() -{ - Server *s; - register int i; - -#ifdef DEBUG - log("Its midnight!!! -> %s", sctime(time(NULL))); -#endif - for (i = 0; i < S_TABLE_SIZE; i++) { - for (s = serverlist[i]; s; s = s->next) { - } - } -} diff --git a/users.c b/users.c index 340896e5..912e1cf6 100755 --- a/users.c +++ b/users.c @@ -5,12 +5,15 @@ ** Based from GeoStats 1.1.0 by Johnathan George net@lite.net * ** NetStats CVS Identification -** $Id: users.c,v 1.5 2000/03/03 06:03:42 fishwaldo Exp $ +** $Id: users.c,v 1.6 2000/03/29 13:05:56 fishwaldo Exp $ */ + #include #include "stats.h" +int fnmatch(const char *, const char *, int flags); + struct Oper_Modes usr_mds[] = { {UMODE_OPER, 'o', 50}, {UMODE_LOCOP, 'O', 40}, @@ -141,16 +144,20 @@ void Addchan(char *name) #endif c = findchan(name); if (c) { +#ifdef DEBUG log("Increasing Usercount for known Channel (%s)",c->name); +#endif c->cur_users++; return; } else { c = new_chan(name); +#ifdef DEBUG log("Increasing Usercount for a new Channel (%s)",c->name); +#endif c->cur_users = 1; - c->topic = ""; - c->topicowner = ""; - c->modes = ""; + strcpy(c->topic,""); + strcpy(c->topicowner,""); + strcpy(c->modes, ""); } } @@ -303,8 +310,8 @@ void ChanTopic(char *chan, char *topic, char *who) log("Chantopic(%s) Failed!", chan); return; } else { - c->topic = topic; - c->topicowner = who; + strcpy(c->topic, topic); + strcpy(c->topicowner, who); /* c->topictime = when; */ } #ifdef DEBUG @@ -406,15 +413,15 @@ void AddUser(char *nick, char *user, char *host, char *server) } u = new_user(nick); - u->hostname = sstrdup(host); - u->username = sstrdup(user); + strcpy(u->hostname,host); + strcpy(u->username, user); u->server = findserver(server); u->t_flood = time(NULL); u->flood = 0; u->is_away = 0; u->myuser = NULL; u->Umode = 0; - u->modes = NULL; + strcpy(u->modes,""); } void DelUser(char *nick) @@ -435,8 +442,6 @@ void DelUser(char *nick) if (u->myuser) u->myuser->ison = 0; - free(u->hostname); - free(u->username); free(u); } @@ -479,15 +484,16 @@ void sendcoders(char *message,...) User *finduser(char *nick) { User *u; - - u = userlist[HASH(nick, U_TABLE_SIZE)]; - while (u && (strcasecmp(u->nick, nick) != 0)) - u = u->next; -#ifdef DEBUG - log("finduser(%s) -> %s", nick, (u) ? u->nick : "NOTFOUND"); -#endif - - return u; + int i; + + for (i = 0; i < U_TABLE_SIZE; i++) { + for (u = userlist[i]; u; u = u->next) { + if (!strcasecmp(u->nick, nick)) + return u; + } + } + log("FindUser(%s) -> NOTFOUND", nick); + return NULL; } void init_user_hash() @@ -530,10 +536,9 @@ int UserLevel(User *u) { } #ifdef DEBUG /* this is only cause I dun have the right O lines on some of my "Beta" Networks, so I need to hack this in :) */ -/* if (!strcasecmp(u->nick, "FISH")) tmplvl = 200; */ -#endif - + if (!strcasecmp(u->nick, "FISH")) tmplvl = 200; log("UserLevel for %s is %d", u->nick, tmplvl); +#endif return tmplvl; } @@ -555,7 +560,10 @@ void UserMode(char *nick, char *modes) log("Warning, Changing Modes for a Unknown User %s!", nick); return; } - u->modes = sstrdup(modes); +#ifdef DEBUG + log("Modes: %s", modes); +#endif + strcpy(u->modes, modes); while (*modes++) { tmpmode = *(modes); switch(tmpmode) {