From e9faf5c2baa58dcaa8f02492920cc2d5358fd8ee Mon Sep 17 00:00:00 2001 From: Mark <> Date: Wed, 25 Feb 2004 23:39:10 +0000 Subject: [PATCH] berkeley db support for statserv, command processor updates, Unreal EOS support --- ChangeLog | 3 + Makefile.in | 2 +- Unreal.c | 2 +- commands.c | 46 ++++++++++++++- configure | 129 +++++++++++++++++++++++++++++------------ configure.in | 9 +-- dl.h | 2 +- dl/cs/cs.c | 6 +- dl/hostserv/hostserv.c | 10 ++-- dl/hostserv/hs_help.c | 2 +- dl/loveserv/loveserv.c | 10 ++-- dl/ms/ms.c | 10 ++-- dl/statserv/database.c | 76 +++--------------------- dl/statserv/stats.c | 2 +- dl/statserv/statserv.c | 14 +++-- dl/statserv/statserv.h | 4 +- ircd.c | 34 ++++++++--- ircd.h | 3 + stats.h | 55 ++++++++++++------ 19 files changed, 253 insertions(+), 166 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbdd5c69..8776cb81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,9 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rant - TLDmap for statserv now works on IRCd's that don't send a IP address in the connect Message (Unreal etc) (F) - Core will now lookup ip addresses of users connecting to the network if the IRCd doesn't specify it, and a module says it wants it (StatServ, and port OPSB over as well) (F) - StatServ now exports the TLD data to SqlSrv (F) + - Added more types to core command set processor - NICK, USER, HOST, REALNAME, IPV4 and MSG (for multiple strings) (M) + - Add Unreal EOS support for server synchs (M) + - Add Berkeley support for statserv (M) * NeoStats * Fish (F) * Version 2.5.14 - Fix a bug with HostServ unable to load the database diff --git a/Makefile.in b/Makefile.in index a52c464d..fcfe3333 100644 --- a/Makefile.in +++ b/Makefile.in @@ -68,7 +68,7 @@ buildversion: @(if test -f version.sh ; then $(SHELL) version.sh; else echo > version.h; fi) neostats: buildversion $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) @sqlsrvbuild@ $(ADNS_OBJS) $(KEEPER_OBJS) $(PCRE_OBJS) curl/libcurl.a $(EXTRA_LDFLAGS) -o $@ + $(CC) $(LDFLAGS) $(OBJS) @sqlsrvbuild@ $(ADNS_OBJS) $(KEEPER_OBJS) $(PCRE_OBJS) curl/libcurl.a @LIBDB@ $(EXTRA_LDFLAGS) -o $@ # include dependency info @MAKEDEPENDENCIES@ diff --git a/Unreal.c b/Unreal.c index 7b6a5824..99736b16 100644 --- a/Unreal.c +++ b/Unreal.c @@ -684,7 +684,7 @@ m_netinfo (char *origin, char **argv, int argc, int srv) static void m_eos (char *origin, char **argv, int argc, int srv) { - + do_eos (origin); } #endif diff --git a/commands.c b/commands.c index 7b38cea3..3c1154ea 100755 --- a/commands.c +++ b/commands.c @@ -607,12 +607,14 @@ bot_cmd_set (ModUser* bot_ptr, User * u, char **av, int ac) prefmsg(u->nick, bot_ptr->nick, "%s: %d", set_ptr->option, *(int*)set_ptr->varptr); } - break; + break; + case SET_TYPE_MSG: case SET_TYPE_STRING: case SET_TYPE_NICK: case SET_TYPE_USER: case SET_TYPE_HOST: case SET_TYPE_REALNAME: + case SET_TYPE_IPV4: prefmsg(u->nick, bot_ptr->nick, "%s: %s", set_ptr->option, (char*)set_ptr->varptr); break; @@ -730,6 +732,22 @@ bot_cmd_set (ModUser* bot_ptr, User * u, char **av, int ac) prefmsg(u->nick, bot_ptr->nick, "%s set to %s", set_ptr->option, av[3]); break; + case SET_TYPE_MSG: + { + char *buf; + + buf = joinbuf(av, ac, 3); + strlcpy((char*)set_ptr->varptr, buf, set_ptr->max); + SetConf((void *)buf, CFGSTR, set_ptr->confitem); + chanalert(bot_ptr->nick, "%s set to %s by \2%s\2", + set_ptr->option, buf, u->nick); + nlog(LOG_NORMAL, LOG_MOD, "%s!%s@%s set %s to %s", + u->nick, u->username, u->hostname, set_ptr->option, buf); + prefmsg(u->nick, bot_ptr->nick, + "%s set to %s", set_ptr->option, buf); + free(buf); + } + break; case SET_TYPE_NICK: if(validate_nick (av[3]) == NS_FAILURE) { prefmsg(u->nick, bot_ptr->nick, @@ -761,6 +779,11 @@ bot_cmd_set (ModUser* bot_ptr, User * u, char **av, int ac) "%s set to %s", set_ptr->option, av[3]); break; case SET_TYPE_HOST: + if (!index(av[3], '.')) { + prefmsg(u->nick, bot_ptr->nick, + "%s is an invalid hostname", av[3]); + break; + } if(validate_host (av[3]) == NS_FAILURE) { prefmsg(u->nick, bot_ptr->nick, "%s contains invalid characters", av[3]); @@ -791,6 +814,21 @@ bot_cmd_set (ModUser* bot_ptr, User * u, char **av, int ac) free(buf); } break; + case SET_TYPE_IPV4: + if (!inet_addr(av[3])) { + prefmsg(u->nick, bot_ptr->nick, + "Invalid IPV4 format. Should be dotted quad, e.g. 1.2.3.4"); + return 0; + } + strlcpy((char*)set_ptr->varptr, av[3], set_ptr->max); + SetConf((void *)av[3], CFGSTR, set_ptr->confitem); + chanalert(bot_ptr->nick, "%s set to %s by \2%s\2", + set_ptr->option, av[3], u->nick); + nlog(LOG_NORMAL, LOG_MOD, "%s!%s@%s set %s to %s", + u->nick, u->username, u->hostname, set_ptr->option, av[3]); + prefmsg(u->nick, bot_ptr->nick, + "%s set to %s", set_ptr->option, av[3]); + break; case SET_TYPE_CUSTOM: if(set_ptr->handler) { set_ptr->handler(u, av, ac); @@ -805,6 +843,12 @@ bot_cmd_set (ModUser* bot_ptr, User * u, char **av, int ac) set_ptr->type, set_ptr->option, av[3]); break; } + /* Call back after SET so that a module can "react" to a change in a setting */ + if(set_ptr->type != SET_TYPE_CUSTOM) { + if(set_ptr->handler) { + set_ptr->handler(u, av, ac); + } + } return 1; } diff --git a/configure b/configure index 024fba09..bc3671a6 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LEX LEXLIB LEX_OUTPUT_ROOT YACC RANLIB ac_ct_RANLIB CPP EGREP sqlsrvbuild buildsqlsrv GTK_CONFIG build_configtool MAKEDEPENDENCIES DIRINST MODLDFLAGS LINK_SIZE MATCH_LIMIT NEWLINE PCRE_MAJOR PCRE_MINOR PCRE_DATE PCRE_VERSION PCRE_LIB_VERSION PCRE_POSIXLIB_VERSION POSIX_MALLOC_THRESHOLD UTF8 IRCD_FILES_SRC IRCD_FILES_OBJS IRCD_FILES_INC MODULES EXTAUTH_SRC EXTAUTH_OBJS PACKAGE VERSION LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LEX LEXLIB LEX_OUTPUT_ROOT YACC RANLIB ac_ct_RANLIB CPP EGREP sqlsrvbuild buildsqlsrv GTK_CONFIG build_configtool LIBDB MAKEDEPENDENCIES DIRINST MODLDFLAGS LINK_SIZE MATCH_LIMIT NEWLINE PCRE_MAJOR PCRE_MINOR PCRE_DATE PCRE_VERSION PCRE_LIB_VERSION PCRE_POSIXLIB_VERSION POSIX_MALLOC_THRESHOLD UTF8 IRCD_FILES_SRC IRCD_FILES_OBJS IRCD_FILES_INC MODULES EXTAUTH_SRC EXTAUTH_OBJS PACKAGE VERSION LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5817,22 +5817,18 @@ _ACEOF fi - -for ac_header in db.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +if test "${ac_cv_header_db_h+set}" = set; then + echo "$as_me:$LINENO: checking for db.h" >&5 +echo $ECHO_N "checking for db.h... $ECHO_C" >&6 +if test "${ac_cv_header_db_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_db_h" >&5 +echo "${ECHO_T}$ac_cv_header_db_h" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking db.h usability" >&5 +echo $ECHO_N "checking db.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ @@ -5841,7 +5837,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include <$ac_header> +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5867,8 +5863,8 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking db.h presence" >&5 +echo $ECHO_N "checking db.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ @@ -5876,7 +5872,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5909,10 +5905,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: db.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: db.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5923,12 +5919,12 @@ _ASBOX sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: db.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: db.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: db.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5939,25 +5935,82 @@ _ASBOX sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +echo "$as_me:$LINENO: checking for db.h" >&5 +echo $ECHO_N "checking for db.h... $ECHO_C" >&6 +if test "${ac_cv_header_db_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + ac_cv_header_db_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_db_h" >&5 +echo "${ECHO_T}$ac_cv_header_db_h" >&6 fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +if test $ac_cv_header_db_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_H 1 _ACEOF + echo "$as_me:$LINENO: checking for db_create in -ldb" >&5 +echo $ECHO_N "checking for db_create in -ldb... $ECHO_C" >&6 +if test "${ac_cv_lib_db_db_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldb $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char db_create (); +int +main () +{ +db_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_db_db_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_db_db_create=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_db_db_create" >&5 +echo "${ECHO_T}$ac_cv_lib_db_db_create" >&6 +if test $ac_cv_lib_db_db_create = yes; then + LIBDB="-ldb" fi -done +fi @@ -6697,6 +6750,7 @@ fi + cat >>confdefs.h <<\_ACEOF #define POSIX_MALLOC_THRESHOLD 10 _ACEOF @@ -7367,6 +7421,7 @@ s,@sqlsrvbuild@,$sqlsrvbuild,;t t s,@buildsqlsrv@,$buildsqlsrv,;t t s,@GTK_CONFIG@,$GTK_CONFIG,;t t s,@build_configtool@,$build_configtool,;t t +s,@LIBDB@,$LIBDB,;t t s,@MAKEDEPENDENCIES@,$MAKEDEPENDENCIES,;t t s,@DIRINST@,$DIRINST,;t t s,@MODLDFLAGS@,$MODLDFLAGS,;t t diff --git a/configure.in b/configure.in index 3524be1e..91b82630 100644 --- a/configure.in +++ b/configure.in @@ -140,10 +140,10 @@ then AC_DEFINE(NEED_UNDERSCORE_PREFIX) fi -dnl check for berkely db.h support -AC_CHECK_HEADERS(db.h) - - +dnl check for berkeley db support +AC_CHECK_HEADER(db.h, AC_DEFINE(HAVE_DB_H, 1, [Define to 1 if you have the header file.]) + AC_CHECK_LIB(db, db_create, LIBDB="-ldb")) + PCRE_MAJOR=4 PCRE_MINOR=3 PCRE_DATE=21-May-2003 @@ -540,6 +540,7 @@ else AC_DEFINE_UNQUOTED(NEO_PREFIX, "${prefix}") fi +AC_SUBST(LIBDB) AC_SUBST(MAKEDEPENDENCIES) AC_SUBST(DIRINST) AC_SUBST(CFLAGS) diff --git a/dl.h b/dl.h index f044ebf6..94ff87bd 100644 --- a/dl.h +++ b/dl.h @@ -250,7 +250,7 @@ void verify_hashes(void); int add_bot_cmd_list(ModUser *bot_ptr, bot_cmd *bot_cmd_list); int del_bot_cmd_list(ModUser *bot_ptr, bot_cmd *bot_cmd_list); int run_bot_cmd (ModUser *bot_ptr, User *u, char **av, int ac); -ModUser * init_mod_bot (char * nick, char * user, char * host, char * rname, const char *modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list, char * modname); +ModUser * init_mod_bot (char * nick, char * user, char * host, char * realname, const char *modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list, char * modname); int CloakHost (ModUser *bot_ptr); int del_mod_bot (ModUser *bot_ptr, char * reason); void finiModuleHash(); diff --git a/dl/cs/cs.c b/dl/cs/cs.c index a6b36ead..df240608 100644 --- a/dl/cs/cs.c +++ b/dl/cs/cs.c @@ -96,7 +96,7 @@ struct cs_cfg { int modnum; char user[MAXUSER]; char host[MAXHOST]; - char rname[MAXREALNAME]; + char realname[MAXREALNAME]; } cs_cfg; static char s_ConnectServ[MAXNICK]; @@ -123,7 +123,7 @@ static bot_setting cs_settings[]= {"NICK", &s_ConnectServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick }, {"USER", &cs_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user }, {"HOST", &cs_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host }, - {"REALNAME", &cs_cfg.rname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, + {"REALNAME", &cs_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, {"SIGNWATCH", &cs_cfg.sign_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "SignWatch", NULL, cs_help_set_signwatch }, {"KILLWATCH", &cs_cfg.kill_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KillWatch", NULL, cs_help_set_killwatch }, {"MODEWATCH", &cs_cfg.mode_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "ModeWatch", NULL, cs_help_set_modewatch }, @@ -141,7 +141,7 @@ static int cs_about(User * u, char **av, int ac) static int Online(char **av, int ac) { - cs_bot = init_mod_bot(s_ConnectServ, cs_cfg.user, cs_cfg.host, cs_cfg.rname, + cs_bot = init_mod_bot(s_ConnectServ, cs_cfg.user, cs_cfg.host, cs_cfg.realname, services_bot_modes, BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, cs_commands, cs_settings, __module_info.module_name); if(cs_bot) cs_online = 1; diff --git a/dl/hostserv/hostserv.c b/dl/hostserv/hostserv.c index ffbd6326..b3f85e2d 100644 --- a/dl/hostserv/hostserv.c +++ b/dl/hostserv/hostserv.c @@ -66,7 +66,7 @@ struct hs_cfg { int modnum; char user[MAXUSER]; char host[MAXHOST]; - char rname[MAXREALNAME]; + char realname[MAXREALNAME]; } hs_cfg; #ifdef UMODE_REGNICK @@ -141,7 +141,7 @@ static bot_setting hs_settings[]= {"NICK", &s_HostServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick }, {"USER", &hs_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user }, {"HOST", &hs_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host }, - {"REALNAME", &hs_cfg.rname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, + {"REALNAME", &hs_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, {"EXPIRE", &hs_cfg.old, SET_TYPE_INT, 0, 99, NS_ULEVEL_ADMIN, "ExpireDays", "days", hs_help_set_expire }, {"HIDDENHOST", &hs_cfg.regnick, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "UnetVhosts", NULL, hs_help_set_hiddenhost }, {"HOSTNAME", &hs_cfg.vhostdom, SET_TYPE_STRING, 0, MAXHOST, NS_ULEVEL_ADMIN, "UnetDomain", NULL, hs_help_set_hostname }, @@ -243,7 +243,7 @@ static int hs_sign_on(char **av, int ac) static int Online(char **av, int ac) { - hs_bot = init_mod_bot(s_HostServ, hs_cfg.user, hs_cfg.host, hs_cfg.rname, + hs_bot = init_mod_bot(s_HostServ, hs_cfg.user, hs_cfg.host, hs_cfg.realname, services_bot_modes, BOT_FLAG_DEAF, hs_commands, hs_settings, __module_info.module_name); add_mod_timer("CleanupHosts", "Cleanup_Old_Vhosts", __module_info.module_name, 7200); @@ -1005,10 +1005,10 @@ static void LoadConfig(void) free(temp); } if(GetConf((void *) &temp, CFGSTR, "RealName") < 0) { - strlcpy(hs_cfg.rname, "Network Virtual Host Service", MAXREALNAME); + strlcpy(hs_cfg.realname, "Network Virtual Host Service", MAXREALNAME); } else { - strlcpy(hs_cfg.rname, temp, MAXREALNAME); + strlcpy(hs_cfg.realname, temp, MAXREALNAME); free(temp); } diff --git a/dl/hostserv/hs_help.c b/dl/hostserv/hs_help.c index 214d0962..322d77ae 100644 --- a/dl/hostserv/hs_help.c +++ b/dl/hostserv/hs_help.c @@ -157,6 +157,6 @@ const char *hs_help_set_hiddenhost[] = { const char *hs_help_set_hostname[] = { "\2SET HOSTNAME \2", "The hidden host you want to set on users.", - "Users will then be set to ..", + "Users will then be set to nick..", NULL }; diff --git a/dl/loveserv/loveserv.c b/dl/loveserv/loveserv.c index 538451b5..28a50db6 100644 --- a/dl/loveserv/loveserv.c +++ b/dl/loveserv/loveserv.c @@ -32,7 +32,7 @@ static ModUser *ls_bot; struct ls_cfg { char user[MAXUSER]; char host[MAXHOST]; - char rname[MAXREALNAME]; + char realname[MAXREALNAME]; } ls_cfg; static int ls_rose(User * u, char **av, int ac); @@ -78,12 +78,12 @@ static bot_setting ls_settings[]= {"NICK", &s_LoveServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick }, {"USER", &ls_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user }, {"HOST", &ls_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host }, - {"REALNAME", &ls_cfg.rname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, + {"REALNAME", &ls_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, }; static int Online(char **av, int ac) { - ls_bot = init_mod_bot(s_LoveServ, ls_cfg.user, ls_cfg.host, ls_cfg.rname, + ls_bot = init_mod_bot(s_LoveServ, ls_cfg.user, ls_cfg.host, ls_cfg.realname, services_bot_modes, BOT_FLAG_DEAF, ls_commands, ls_settings, __module_info.module_name); return 1; }; @@ -123,10 +123,10 @@ int __ModInit(int modnum, int apiver) free(temp); } if(GetConf((void *) &temp, CFGSTR, "RealName") < 0) { - strlcpy(ls_cfg.rname, "Network Love Service", MAXREALNAME); + strlcpy(ls_cfg.realname, "Network Love Service", MAXREALNAME); } else { - strlcpy(ls_cfg.rname, temp, MAXREALNAME); + strlcpy(ls_cfg.realname, temp, MAXREALNAME); free(temp); } return 1; diff --git a/dl/ms/ms.c b/dl/ms/ms.c index d09188e3..31440092 100644 --- a/dl/ms/ms.c +++ b/dl/ms/ms.c @@ -32,7 +32,7 @@ static ModUser *ms_bot; struct ms_cfg { char user[MAXUSER]; char host[MAXHOST]; - char rname[MAXREALNAME]; + char realname[MAXREALNAME]; } ms_cfg; static int ms_hail(User * u, char **av, int ac); @@ -74,12 +74,12 @@ static bot_setting ms_settings[]= {"NICK", &s_MoraleServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick }, {"USER", &ms_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user }, {"HOST", &ms_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host }, - {"REALNAME", &ms_cfg.rname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, + {"REALNAME", &ms_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, }; static int Online(char **av, int ac) { - ms_bot = init_mod_bot(s_MoraleServ, ms_cfg.user, ms_cfg.host, ms_cfg.rname, + ms_bot = init_mod_bot(s_MoraleServ, ms_cfg.user, ms_cfg.host, ms_cfg.realname, services_bot_modes, BOT_FLAG_DEAF, ms_commands, ms_settings, __module_info.module_name); return 1; }; @@ -119,10 +119,10 @@ int __ModInit(int modnum, int apiver) free(temp); } if(GetConf((void *) &temp, CFGSTR, "RealName") < 0) { - strlcpy(ms_cfg.rname, "A Network Morale Service", MAXREALNAME); + strlcpy(ms_cfg.realname, "A Network Morale Service", MAXREALNAME); } else { - strlcpy(ms_cfg.rname, temp, MAXREALNAME); + strlcpy(ms_cfg.realname, temp, MAXREALNAME); free(temp); } return 1; diff --git a/dl/statserv/database.c b/dl/statserv/database.c index f25987a7..f3afff56 100644 --- a/dl/statserv/database.c +++ b/dl/statserv/database.c @@ -26,18 +26,6 @@ */ #include "statserv.h" -#ifdef HAVE_DB_H -#include -/*#define USE_BERKELEY*/ -#endif - -#ifdef USE_BERKELEY -#define DATABASE "data/statserv.db" -static DB *dbp; -static DBT dbkey; -static DBT dbdata; -static int dbret; -#endif /* define this if you want the old database format.... but beware, its slow */ #undef OLDDATABASE @@ -45,33 +33,6 @@ static int dbret; void LoadOldStats(); -void OpenDatabase(void) -{ -#ifdef USE_BERKELEY - if ((dbret = db_create(&dbp, NULL, 0)) == 0) { - nlog(LOG_DEBUG1, LOG_MOD, "db_create"); - } else { - nlog(LOG_DEBUG1, LOG_MOD, "db_create: %s", db_strerror(dbret)); - return; - } - if ((dbret = dbp->open(dbp, NULL, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) == 0) { - nlog(LOG_DEBUG1, LOG_MOD, "dbp->open"); - } else { - nlog(LOG_DEBUG1, LOG_MOD, "dbp->open: %s", db_strerror(dbret)); - return; - } -#endif -} - -void CloseDatabase(void) -{ -#ifdef USE_BERKELEY - dbp->close(dbp, 0); - nlog(LOG_DEBUG1, LOG_MOD, "dbp->close"); -#endif -} - - void SaveStats() { SStats *s; @@ -299,14 +260,8 @@ CStats *load_chan(char *name) { c = malloc(sizeof(CStats)); strlcpy(c->name, name, CHANLEN); #ifdef USE_BERKELEY - memset(&dbkey, 0, sizeof(dbkey)); - memset(&dbdata, 0, sizeof(dbdata)); - strcpy(dbkey.data, c->name); - dbkey.size = strlen(dbkey.data); - if ((dbret = dbp->get(dbp, NULL, &dbkey, &dbdata, 0)) == 0) - { - nlog(LOG_DEBUG1, LOG_MOD, "dbp->get"); - sscanf(dbdata.data, "%ld %ld %ld %ld %ld %ld %ld %ld %ld", &c->topics, &c->totmem, &c->kicks, &c->maxmems, &c->t_maxmems, &c->maxkicks, &c->t_maxkicks, &c->maxjoins, &c->t_maxjoins, &c->lastseen); + if ((data = DBGetData(c->name)) != NULL) { + sscanf(data, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", &c->topics, &c->totmem, &c->kicks, &c->maxmems, &c->t_maxmems, &c->maxkicks, &c->t_maxkicks, &c->maxjoins, &c->t_maxjoins, &c->lastseen); #else if (GetData((void *)&data, CFGSTR, "ChanStats", c->name, "ChanData") > 0) { /* its the new database format... Good */ @@ -327,9 +282,6 @@ CStats *load_chan(char *name) { DelRow("ChanStats", c->name); #endif } else { -#ifdef USE_BERKELEY - nlog(LOG_DEBUG1, LOG_MOD, "dbp->get: %s", db_strerror(dbret)); -#endif c->totmem = 0; c->topics = 0; c->kicks = 0; @@ -389,8 +341,12 @@ void save_chan(CStats *c) { #ifndef OLDDATABASE char data[BUFSIZE]; +#ifdef USE_BERKELEY + SET_SEGV_LOCATION(); + ircsnprintf(data, BUFSIZE, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", c->topics, c->totmem, c->kicks, c->maxmems, c->t_maxmems, c->maxkicks, c->t_maxkicks, c->maxjoins, c->t_maxjoins, c->lastseen); + DBSetData(c->name, data); +#else SET_SEGV_LOCATION(); - ircsnprintf(data, BUFSIZE, "%d %d %d %d %d %d %d %d %d", (int)c->topics, (int)c->totmem, (int)c->kicks, (int)c->maxmems, (int)c->t_maxmems, (int)c->maxkicks, @@ -398,23 +354,10 @@ void save_chan(CStats *c) { SetData((void *)data, CFGSTR, "ChanStats", c->name, "ChanData"); /* we keep this seperate so we can easily delete old channels */ SetData((void *)c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); - +#endif + #else SET_SEGV_LOCATION(); - -#ifdef USE_BERKELEY - memset(&dbkey, 0, sizeof(dbkey)); - memset(&dbdata, 0, sizeof(dbdata)); - strcpy(dbkey.data, c->name); - dbkey.size = strlen(dbkey.data); - sprintf(dbdata.data, "%ld %ld %ld %ld %ld %ld %ld %ld %ld", &c->topics, &c->totmem, &c->kicks, &c->maxmems, &c->t_maxmems, &c->maxkicks, &c->t_maxkicks, &c->maxjoins, &c->t_maxjoins, &c->lastseen); - dbdata.size = strlen(dbdata.data); - if ((dbret = dbp->put(dbp, NULL, &dbkey, &dbdata, 0)) == 0) { - nlog(LOG_DEBUG1, LOG_MOD, "dbp->put"); - } else { - nlog(LOG_DEBUG1, LOG_MOD, "dbp->put: %s", db_strerror(dbret)); - } -#else SetData((void *)c->topics, CFGINT, "ChanStats", c->name, "Topics"); SetData((void *)c->totmem, CFGINT, "ChanStats", c->name, "TotalMems"); SetData((void *)c->kicks, CFGINT, "ChanStats", c->name, "Kicks"); @@ -425,7 +368,6 @@ void save_chan(CStats *c) { SetData((void *)c->t_maxkicks, CFGINT, "ChanStats", c->name, "MaxKicksTime"); SetData((void *)c->maxjoins, CFGINT, "ChanStats", c->name, "MaxJoins"); SetData((void *)c->t_maxjoins, CFGINT, "ChanStats", c->name, "MaxJoinsTime"); -#endif #endif c->lastsave = me.now; } diff --git a/dl/statserv/stats.c b/dl/statserv/stats.c index cc49e878..10e0e7cb 100755 --- a/dl/statserv/stats.c +++ b/dl/statserv/stats.c @@ -653,7 +653,7 @@ ModUser *ss_bot; int Online(char **av, int ac) { SET_SEGV_LOCATION(); - ss_bot = init_mod_bot(s_StatServ, StatServ.user, StatServ.host, StatServ.rname, + ss_bot = init_mod_bot(s_StatServ, StatServ.user, StatServ.host, StatServ.realname, services_bot_modes, BOT_FLAG_ONLY_OPERS|BOT_FLAG_DEAF, ss_commands, ss_settings, __module_info.module_name); StatServ.onchan = 1; diff --git a/dl/statserv/statserv.c b/dl/statserv/statserv.c index 57600246..ecbd35a6 100644 --- a/dl/statserv/statserv.c +++ b/dl/statserv/statserv.c @@ -103,10 +103,10 @@ static void ss_Config(void) free(tmp); } if (GetConf((void *) &tmp, CFGSTR, "RealName") < 0) { - ircsnprintf(StatServ.rname, MAXREALNAME, "/msg %s help", + ircsnprintf(StatServ.realname, MAXREALNAME, "/msg %s help", s_StatServ); } else { - strlcpy(StatServ.rname, tmp, MAXREALNAME); + strlcpy(StatServ.realname, tmp, MAXREALNAME); free(tmp); } if (GetConf((void *) &StatServ.lagtime, CFGINT, "LagTime") < 0) { @@ -255,7 +255,9 @@ int __ModInit(int modnum, int apiver) rta_add_table(&statserv_daily); #endif - OpenDatabase(); +#ifdef USE_BERKELEY + DBOpenDatabase(); +#endif return 1; } @@ -269,7 +271,9 @@ void __ModFini() list_destroy_nodes(fakedaily); list_destroy_nodes(fakenetwork); #endif - CloseDatabase(); +#ifdef USE_BERKELEY + DBCloseDatabase(); +#endif } @@ -298,7 +302,7 @@ bot_setting ss_settings[]= {"NICK", &s_StatServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick }, {"USER", &StatServ.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user }, {"HOST", &StatServ.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host }, - {"REALNAME", &StatServ.rname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, + {"REALNAME", &StatServ.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname }, {"HTML", &StatServ.html, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "HTML_Enabled", NULL, ss_help_set_html}, {"HTMLPATH", &StatServ.htmlpath, SET_TYPE_STRING, 0, MAXPATH, NS_ULEVEL_ADMIN, "HTML_Path", NULL, ss_help_set_htmlpath }, {"MSGINTERVAL", &StatServ.msginterval, SET_TYPE_INT, 1, 99, NS_ULEVEL_ADMIN, "MsgInterval", "seconds", ss_help_set_msginterval }, diff --git a/dl/statserv/statserv.h b/dl/statserv/statserv.h index 9b9f388c..829c453f 100644 --- a/dl/statserv/statserv.h +++ b/dl/statserv/statserv.h @@ -74,7 +74,7 @@ struct stats_network_ { struct StatServ { char user[MAXUSER]; char host[MAXHOST]; - char rname[MAXREALNAME]; + char realname[MAXREALNAME]; int lagtime; int lagalert; int recordalert; @@ -205,8 +205,6 @@ int s_chan_kick(char **av, int ac); /* database.c */ void save_chan(CStats *c); CStats *load_chan(char *name); -void OpenDatabase(void); -void CloseDatabase(void); /* ss_help.c */ extern const char *ss_help_about[]; diff --git a/ircd.c b/ircd.c index 55544bf8..9fcd41a8 100644 --- a/ircd.c +++ b/ircd.c @@ -54,7 +54,7 @@ static char privmsgbuffer[BUFSIZE]; /* Temp flag for backward compatibility in new splitbuf system */ static int SkipModuleFunction = 0; -static int signon_newbot (const char *nick, const char *user, const char *host, const char *rname, long Umode); +static int signon_newbot (const char *nick, const char *user, const char *host, const char *realname, long Umode); /** @brief init_ircd * @@ -238,9 +238,9 @@ join_bot_to_chan (const char *who, const char *chan, unsigned long chflag) * @return NS_SUCCESS if suceeds, NS_FAILURE if not */ int -signon_newbot (const char *nick, const char *user, const char *host, const char *rname, long Umode) +signon_newbot (const char *nick, const char *user, const char *host, const char *realname, long Umode) { - snewnick_cmd (nick, user, host, rname, Umode); + snewnick_cmd (nick, user, host, realname, Umode); if ((me.allbots > 0) || (Umode & services_bot_umode)) { #ifdef GOTSJOIN ssjoin_cmd (nick, me.chan, CMODE_CHANADMIN); @@ -264,7 +264,7 @@ signon_newbot (const char *nick, const char *user, const char *host, const char * @return NS_SUCCESS if suceeds, NS_FAILURE if not */ int -init_bot (char *nick, char *user, char *host, char *rname, const char *modes, char *mod_name) +init_bot (char *nick, char *user, char *host, char *realname, const char *modes, char *mod_name) { User *u; long Umode; @@ -280,7 +280,7 @@ init_bot (char *nick, char *user, char *host, char *rname, const char *modes, ch return NS_FAILURE; } Umode = UmodeStringToMask(modes, 0); - signon_newbot (nick, user, host, rname, Umode); + signon_newbot (nick, user, host, realname, Umode); /* restore segv_inmodule from SIGNON */ SET_SEGV_INMODULE(mod_name); return NS_SUCCESS; @@ -292,7 +292,7 @@ init_bot (char *nick, char *user, char *host, char *rname, const char *modes, ch * * @return NS_SUCCESS if suceeds, NS_FAILURE if not */ -ModUser * init_mod_bot (char * nick, char * user, char * host, char * rname, +ModUser * init_mod_bot (char * nick, char * user, char * host, char * realname, const char *modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list, char * mod_name) { @@ -312,7 +312,7 @@ ModUser * init_mod_bot (char * nick, char * user, char * host, char * rname, return NULL; } Umode = UmodeStringToMask(modes, 0); - signon_newbot (nick, user, host, rname, Umode); + signon_newbot (nick, user, host, realname, Umode); #ifdef UMODE_DEAF if(flags&BOT_FLAG_DEAF) { sumode_cmd (nick, nick, UMODE_DEAF); @@ -703,9 +703,9 @@ init_services_bot (void) /* nick already exists on the network */ strlcat (s_Services, "1", MAXNICK); } - ircsnprintf (me.rname, MAXREALNAME, "/msg %s \2HELP\2", s_Services); + ircsnprintf (me.realname, MAXREALNAME, "/msg %s \2HELP\2", s_Services); Umode = UmodeStringToMask(services_bot_modes, 0); - signon_newbot (s_Services, me.user, me.host, me.rname, Umode); + signon_newbot (s_Services, me.user, me.host, me.realname, Umode); #ifdef UMODE_DEAF sumode_cmd (s_Services, s_Services, UMODE_DEAF); #endif @@ -1820,6 +1820,22 @@ do_tkl(const char *add, const char *type, const char *user, const char *host, co } #endif +#ifdef MSG_EOS +void +do_eos (const char *name) +{ + Server *s; + + s = findserver (name); + if(s) { + SynchServer(s); + nlog (LOG_DEBUG1, LOG_CORE, "do_eos: server %s is now synched", name); + } else { + nlog (LOG_WARNING, LOG_CORE, "do_eos: server %s not found", name); + } +} +#endif + void send_cmd (char *fmt, ...) { diff --git a/ircd.h b/ircd.h index 4e34e131..a4aedfa1 100644 --- a/ircd.h +++ b/ircd.h @@ -143,6 +143,9 @@ void do_swhois (char *who, char *swhois); #ifdef MSG_TKL void do_tkl(const char *add, const char *type, const char *user, const char *host, const char *setby, const char *tsexpire, const char *tsset, const char *reason); #endif +#ifdef MSG_EOS +void do_eos(const char *name); +#endif /* Defined in ircd specific files but common to all */ void init_ircd (void); diff --git a/stats.h b/stats.h index 93112725..0dc49396 100644 --- a/stats.h +++ b/stats.h @@ -47,6 +47,12 @@ #include #include +#include "config.h" + +#ifdef HAVE_DB_H +/*#define USE_BERKELEY*/ +#endif + /* Temp disable for upcoming release until all external modules * have been released with warnings fixed */ @@ -65,7 +71,6 @@ #include "pcre.h" #include "list.h" #include "hash.h" -#include "config.h" #include "support.h" #include "ircstring.h" #include "events.h" @@ -250,7 +255,8 @@ /* these defines are for the flags for users, channels and servers */ #define NS_FLAGS_EXCLUDED 0x00000001 /* this entry matched a exclusion */ #define NS_FLAGS_ME 0x00000002 /* indicates the server/user is a NeoStats one */ - +#define NS_FLAGS_SYNCHED 0x00000004 /* indicates the server is now synched */ +#define NS_FLAGS_NETJOIN 0x00000008 /* indicates the user is on a net join */ /* Specific errors beyond SUCCESS/FAILURE so that functions can handle errors * Treat as unsigned with top bit set to give us a clear distinction from @@ -366,7 +372,7 @@ struct me { char local[MAXHOST]; char user[MAXUSER]; /* bot user */ char host[MAXHOST]; /* bot host */ - char rname[MAXREALNAME]; /* bot real name */ + char realname[MAXREALNAME]; /* bot real name */ time_t t_start; unsigned int allbots; unsigned int maxsocks; @@ -528,26 +534,28 @@ typedef struct bot_cmd { #define BOT_FLAG_DEAF 0x00000004 /* SET Comand handling */ -/* (Work in progress) */ typedef enum SET_TYPE { - SET_TYPE_BOOLEAN, - SET_TYPE_INT, - SET_TYPE_STRING, - SET_TYPE_NICK, - SET_TYPE_USER, - SET_TYPE_HOST, - SET_TYPE_REALNAME, + SET_TYPE_BOOLEAN, /* ON or OFF */ + SET_TYPE_INT, /* valid integer */ + SET_TYPE_STRING, /* single string */ + SET_TYPE_MSG, /* multiple strings to be treated as a message and stored in one field */ + SET_TYPE_NICK, /* valid nick */ + SET_TYPE_USER, /* valid user */ + SET_TYPE_HOST, /* valid host name */ + SET_TYPE_REALNAME, /* valid realname */ + SET_TYPE_IPV4, /* valid IPv4 dotted quad */ #if 0 /* For future expansion */ SET_TYPE_INTRANGE, SET_TYPE_STRINGRANGE, #endif - SET_TYPE_CUSTOM, + SET_TYPE_CUSTOM, /* handled by module */ }SET_TYPE; -/* "TESTSTRING", &teststring, TYPE_STRING, 0,string_buffer_size - "TESTINT", &testint, TYPE_INT 0, 200 */ +/** @brief bot_setting structure + * defines SET list for bots + */ typedef struct bot_setting { char *option; /* option string */ void* varptr; /* pointer to var */ @@ -594,7 +602,7 @@ int flood (User * u); int join_bot_to_chan (const char *who, const char *chan, unsigned long chflag); /* (M) For backwards compatibility only, bots are moving to a new interface */ -int init_bot (char * nick, char * user, char * host, char * rname, const char *modes, char * modname); +int init_bot (char * nick, char * user, char * host, char * realname, const char *modes, char * modname); int del_bot (char * nick, char * reason); void privmsg_list (char *to, char *from, const char **text); void prefmsg (char * to, const char * from, char * fmt, ...) __attribute__((format(printf,3,4))); /* 3=format 4=params */ @@ -662,10 +670,16 @@ void transfer_status(); int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char *filename, void *data, transfer_callback *callback); /* exclude */ -#define IsExcluded(x) ((x) && (x->flags & NS_FLAGS_EXCLUDED)) +#define IsExcluded(x) ((x) && ((x)->flags & NS_FLAGS_EXCLUDED)) /* Is the user or server a NeoStats one? */ -#define IsMe(x) ((x) && (x->flags & NS_FLAGS_ME)) +#define IsMe(x) ((x) && ((x)->flags & NS_FLAGS_ME)) + +/* Is the user or server synched? */ +#define IsSynched(x) ((x) && ((x)->flags & NS_FLAGS_SYNCHED)) + +/* Mark server as synched */ +#define SynchServer(x) (((x)->flags |= NS_FLAGS_SYNCHED)) /* Some standard text help messages */ extern const char *ns_help_set_nick[]; @@ -677,5 +691,12 @@ int validate_nick (char* nick); int validate_user (char* user); int validate_host (char* host); +#ifdef USE_BERKELEY +void DBOpenDatabase(void); +void DBCloseDatabase(void); +char* DBGetData(char* key); +void DBSetData(char* key, char * data); +#endif + #endif