[srvx-commits] CVS: services/src service.h,NONE,1.1 service.c,NONE,1.1 rules.h,NONE,1.1 rules.c,NONE
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-09-22 16:12:57
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv1705/src Modified Files: tools.c sockcheck.c proto_ircu_p10.c proto_bahamut.c proto.h opserv.c nickserv.c modules.h modules.c main.c hash.h hash.c global.c chanserv.c Makefile.am Added Files: service.h service.c rules.h rules.c Log Message: build in framework to do modular services (does not compile) ***** Error reading new file: [Errno 2] No such file or directory: 'service.h' ***** Error reading new file: [Errno 2] No such file or directory: 'service.c' ***** Error reading new file: [Errno 2] No such file or directory: 'rules.h' ***** Error reading new file: [Errno 2] No such file or directory: 'rules.c' Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** tools.c 2001/09/18 02:13:08 1.94 --- tools.c 2001/09/22 16:12:54 1.95 *************** *** 54,57 **** --- 54,58 ---- #include "log.h" #include "policer.h" + #include "proto.h" #include "recdb.h" #include "tools.h" *************** *** 59,91 **** extern struct policer_params *oper_policer_params, *luser_policer_params; - static oper_func_t *of_list; - static unsigned int of_size, of_used; - - void - reg_oper_func(oper_func_t handler) - { - if (of_used == of_size) { - if (of_size) { - of_size <<= 1; - of_list = realloc(of_list, of_size*sizeof(oper_func_t)); - } else { - of_size = 8; - of_list = malloc(of_size*sizeof(oper_func_t)); - } - } - of_list[of_used++] = handler; - } - - static void - call_oper_funcs(struct userNode *user) - { - unsigned int n; - - for (n=0; n<of_used; n++) - { - of_list[n](user); - } - } - static const unsigned char *user_modes = RFC1459_USER_MODE_CHARS PROTO_USER_MODE_CHARS; static unsigned char user_inverse_modes[256]; --- 60,63 ---- *************** *** 113,151 **** void mod_usermode(struct userNode *user, const char *mode_change) { int add = 1; unsigned char modechar; if (!user || !mode_change || !*mode_change) return; while (1) { - #define do_user_mode(FLAG) do { if (add) user->modes |= FLAG; else user->modes &= ~FLAG; } while (0) switch (modechar = *mode_change++) { case 0: case ' ': return; case '+': add = 1; break; case '-': add = 0; break; - case 'o': - do_user_mode(FLAGS_OPER); - if (add) { - userList_append(&curr_opers, user); - if (user->command_policer) { - policer_set_params(user->command_policer, oper_policer_params); - } - call_oper_funcs(user); - } else { - userList_remove(&curr_opers, user); - if (user->command_policer) { - policer_set_params(user->command_policer, luser_policer_params); - } - } - break; - case 'i': do_user_mode(FLAGS_INVISIBLE); - if (add) invis_clients++; else invis_clients--; - break; default: if (user_inverse_modes[modechar]) { ! do_user_mode((1 << (user_inverse_modes[modechar]-1))); } } #undef do_user_mode } } --- 85,111 ---- void mod_usermode(struct userNode *user, const char *mode_change) { + unsigned long orig_modes; int add = 1; unsigned char modechar; if (!user || !mode_change || !*mode_change) return; + orig_modes = user->modes; while (1) { switch (modechar = *mode_change++) { case 0: case ' ': return; case '+': add = 1; break; case '-': add = 0; break; default: if (user_inverse_modes[modechar]) { ! if (add) { ! user->modes |= (1 << (user_inverse_modes[modechar]-1)); ! } else { ! user->modes &= ~(1 << (user_inverse_modes[modechar]-1)); ! } } } #undef do_user_mode } + /* TODO: add callback to notify things of mode changes*/ } *************** *** 885,899 **** } - static void - tools_cleanup(void) - { - if (of_list) free(of_list); - } - void tools_init(void) { tools_build_inverse_modes(); - reg_exit_func(tools_cleanup); } --- 845,852 ---- Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -r1.61 -r1.62 *** sockcheck.c 2001/09/18 02:13:08 1.61 --- sockcheck.c 2001/09/22 16:12:54 1.62 *************** *** 367,371 **** }; ! /* TODO: consider allowing non-NULL p_expansion with non-zero p_exp_length, * to avoid the malloc() impact. If it's important for speed. */ static void --- 367,371 ---- }; ! /* XXX: consider allowing non-NULL p_expansion with non-zero p_exp_length, * to avoid the malloc() impact. If it's important for speed. */ static void Index: proto_ircu_p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** proto_ircu_p10.c 2001/09/18 02:13:09 1.21 --- proto_ircu_p10.c 2001/09/22 16:12:54 1.22 *************** *** 1565,1569 **** if (!pd->is_notice && cd.func) { if (!cd.service || GetUserMode(cn, cd.service)) { ! cd.func(pd->user, cn, pd->text+1); } } --- 1565,1569 ---- if (!pd->is_notice && cd.func) { if (!cd.service || GetUserMode(cn, cd.service)) { ! cd.func(cd.service, pd->user, cn, pd->text+1); } } *************** *** 1577,1585 **** if (!pd->is_notice) { if (privmsg_funcs[num]) { ! privmsg_funcs[num](pd->user, pd->text); } } else { if (notice_funcs[num]) { ! notice_funcs[num](pd->user, pd->text); } } --- 1577,1585 ---- if (!pd->is_notice) { if (privmsg_funcs[num]) { ! privmsg_funcs[num](un, pd->user, pd->text); } } else { if (notice_funcs[num]) { ! notice_funcs[num](un, pd->user, pd->text); } } Index: proto_bahamut.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** proto_bahamut.c 2001/09/18 02:13:09 1.11 --- proto_bahamut.c 2001/09/22 16:12:54 1.12 *************** *** 714,718 **** if (!pd->is_notice && cd.func) { if (!cd.service || GetUserMode(cn, cd.service)) { ! cd.func(pd->user, cn, pd->text+1); } } --- 714,718 ---- if (!pd->is_notice && cd.func) { if (!cd.service || GetUserMode(cn, cd.service)) { ! cd.func(cd.service, pd->user, cn, pd->text+1); } } *************** *** 726,734 **** if (!pd->is_notice) { if (un->proto->privmsg_func) { ! un->proto->privmsg_func(pd->user, pd->text); } } else { if (un->proto->notice_func) { ! un->proto->notice_func(pd->user, pd->text); } } --- 726,734 ---- if (!pd->is_notice) { if (un->proto->privmsg_func) { ! un->proto->privmsg_func(un, pd->user, pd->text); } } else { if (un->proto->notice_func) { ! un->proto->notice_func(un, pd->user, pd->text); } } Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** proto.h 2001/09/18 02:13:09 1.41 --- proto.h 2001/09/22 16:12:54 1.42 *************** *** 36,42 **** struct chanNode; ! typedef void (*chanmsg_func_t) (struct userNode *user, struct chanNode *chan, char *text); ! typedef void (*privmsg_func_t) (struct userNode *user, char *text); ! typedef void (*mode_change_func_t) (struct chanNode *channel, struct userNode *user, int change_type, void *change); #define MODE_CHANGE_MISC 0x001 --- 36,42 ---- struct chanNode; ! typedef void (*chanmsg_func_t) (struct userNode *bot, struct userNode *source, struct chanNode *chan, char *text); ! typedef void (*privmsg_func_t) (struct userNode *bot, struct userNode *source, char *text); ! typedef void (*mode_change_func_t) (struct chanNode *channel, struct userNode *source, int change_type, void *change); #define MODE_CHANGE_MISC 0x001 Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.211 retrieving revision 1.212 diff -C2 -r1.211 -r1.212 *** opserv.c 2001/09/18 02:23:08 1.211 --- opserv.c 2001/09/22 16:12:54 1.212 *************** *** 54,57 **** --- 54,58 ---- #include "dict.h" #include "gline.h" + #include "global.h" #include "hash.h" #include "heap.h" *************** *** 395,399 **** */ static void ! opserv_chanmsg(struct userNode* user, struct chanNode *channel, char *text) { struct opserv_cmd *cmd; --- 396,400 ---- */ static void ! opserv_chanmsg(struct userNode *bot, struct userNode* user, struct chanNode *channel, char *text) { struct opserv_cmd *cmd; *************** *** 401,404 **** --- 402,406 ---- int argc, argv_shift; + (void)bot; /* ignore things consistning of empty lines */ if (!*text) return; *************** *** 459,465 **** static void ! opserv_privmsg(struct userNode* user, char *command) { ! opserv_chanmsg(user, 0, command); } --- 461,467 ---- static void ! opserv_privmsg(struct userNode *bot, struct userNode* source, char *command) { ! opserv_chanmsg(bot, source, 0, command); } *************** *** 772,777 **** /* TODO: Make sure we aren't already connected to the specified ! uplink, and that it exists. ! */ uplink_select(argv[1]); --- 774,778 ---- /* TODO: Make sure we aren't already connected to the specified ! * uplink, and that it exists. */ uplink_select(argv[1]); *************** *** 3580,3584 **** unsplit_string(argv+1, argc-1); gettimeofday(&start, NULL); ! opserv_chanmsg(user, channel, argv[1]); gettimeofday(&stop, NULL); stop.tv_sec -= start.tv_sec; --- 3581,3585 ---- unsplit_string(argv+1, argc-1); gettimeofday(&start, NULL); ! opserv_chanmsg(opserv, user, channel, argv[1]); gettimeofday(&stop, NULL); stop.tv_sec -= start.tv_sec; *************** *** 3592,3630 **** } - /* all of this stuff is in modules.c - maybe consider moving some of it - * back here? i didn't want to make a complete hack of opserv yet :) - */ - static OPSERV_FUNC(cmd_modlist) - { - (void)argc; - OPSERV_MIN_PARMS(1, 0); - list_modules(user); - return 1; - } - - static OPSERV_FUNC(cmd_modreload) - { - (void)argc; - OPSERV_MIN_PARMS(2, 0); - reload_module(user, argv[1]); - return 1; - } - - static OPSERV_FUNC(cmd_modload) - { - (void)argc; - OPSERV_MIN_PARMS(2, 0); - load_module(user, argv[1]); - return 1; - } - - static OPSERV_FUNC(cmd_modunload) - { - (void)argc; - OPSERV_MIN_PARMS(2, 0); - unload_module(user, argv[1]); - return 1; - } - static OPSERV_FUNC(cmd_modlog) { --- 3593,3596 ---- *************** *** 3852,3859 **** opserv_define_func("LOG", cmd_log, 900); opserv_define_func("LOGINFO", cmd_loginfo, 0); - opserv_define_func("MODLOAD", cmd_modload, 0); - opserv_define_func("MODLIST", cmd_modlist, 0); - opserv_define_func("MODRELOAD", cmd_modreload, 0); - opserv_define_func("MODUNLOAD", cmd_modunload, 0); opserv_define_func("MODE", cmd_mode, 100); opserv_define_func("MODERATE", cmd_moderate, 300); --- 3818,3821 ---- Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -r1.155 -r1.156 *** nickserv.c 2001/09/18 02:13:09 1.155 --- nickserv.c 2001/09/22 16:12:54 1.156 *************** *** 2082,2086 **** static void ! nickserv_msg(struct userNode *user, char *command) { struct nickserv_cmd *cmd; --- 2082,2086 ---- static void ! nickserv_msg(struct userNode *bot, struct userNode *user, char *command) { struct nickserv_cmd *cmd; *************** *** 2089,2092 **** --- 2089,2093 ---- char *dupcmd; + (void)bot; dupcmd = alloca(strlen(command)+1); strcpy(dupcmd, command); Index: modules.h =================================================================== RCS file: /cvsroot/srvx/services/src/modules.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** modules.h 2001/07/15 14:49:25 1.5 --- modules.h 2001/09/22 16:12:54 1.6 *************** *** 19,73 **** */ ! #ifndef _modules_h ! #define _modules_h - #include "config.h" - #include "opserv.h" - #include "nickserv.h" - #include "chanserv.h" - #include "log.h" - #include "global.h" #include "common.h" - #include "hash.h" ! struct module { ! char *name; /* module name */ ! void *address; /* address of module */ ! long version; /* module version - YEARMMDD */ ! void (*init)(void); /* init function */ ! void (*deinit)(void); /* deinit function */ ! struct module_def *mdef; /* mod info */ }; ! #define module_info(dest, size, format...) do { \ ! char *message; \ ! log(MAIN_LOG, LOG_INFO, ## format); \ ! opserv_notice((dest), ## format ); \ ! if ((size)) { \ ! message = (char*)alloca((size)); \ ! sprintf(message, ## format); \ ! global_message(MESSAGE_RECIPIENT_OPERS, message); \ ! } \ ! } while(0) ! ! #define MODULE_ACCESS(LEVEL, PATH, DLCMODPTR) do { \ ! if ((!module_conf.allow_override && \ ! user->handle_info->opserv_level < module_conf.default_level) || \ ! (user->handle_info->opserv_level < (unsigned int)(LEVEL))) { \ ! opserv_notice(user, MODULE_NOACCESS, (PATH), \ ! (module_conf.allow_override ? (LEVEL) : module_conf.default_level)); \ ! if ((DLCMODPTR)) (void)dlclose((DLCMODPTR)); \ ! return 0; \ ! } \ ! } while(0) ! ! extern dict_t module_addr_dict; ! void init_modules(const char *path); ! int load_module(struct userNode *user, char *path); ! int unload_module(struct userNode *user, char *path); ! int reload_module(struct userNode *user, const char *path); ! void add_chanserv_modfunc(const char *name, long flags, enum userLevel access, chanserv_func_t *func); ! void del_chanserv_modfunc(const char *name); ! void list_modules(struct userNode *user); ! #endif /* _modules_h */ --- 19,100 ---- */ ! #ifndef MODULES_H ! #define MODULES_H #include "common.h" ! /* ! * Rough module versioning guidelines (the same as for everything else): ! * ! * If you move or remove data, or remove functions, bump major version ! * and reset minor and revision numbers to 0. ! * Otherwise, if you add data or functions, bump minor version and ! * reset revision number to 0. ! * Otherwise, increment revision number. ! * ! * If you don't know absolutely for sure, set max_version in your ! * dependencies to MAKE_VERSION(exp_major, -1, -1). ! * Unless you depend on certain bugfixes in a later revision, set ! * min_version to MAKE_VERSION(exp_major, exp_minor, 0). ! */ ! typedef unsigned long modver_t; ! #define MAKE_VERSION(major, minor, revision) ((((major) & 0xff) << 24) | (((minor) & 0xff) << 16) | ((revision) & 0xffff)) ! ! struct module_dependency { ! const char *dep_name; ! modver_t min_version, max_version; }; ! DECLARE_LIST(module_deplist, struct module_dependency *); ! struct userNode; ! struct chanNode; ! struct shared_lib; ! struct module; ! struct record_data; ! ! /* Each module should export a LIB_LOAD_FUNC(mod_init) function, ! * and register its modules from within that function. */ ! #define LIB_LOAD_FUNC(NAME) int NAME(struct shared_lib *lib) ! ! /* In module_command.flags, bit 1<<N corresponds to (enum command_flag)N. */ ! enum command_flag { ! REQUIRE_AUTHED, ! TAKES_CHANNEL, ! REQUIRE_CHANNEL, ! }; ! ! #define MODULE_COMMAND(NAME) int NAME(struct userNode *user, struct userNode *bot, struct chanNode *channel, unsigned int argc, unsigned char *argv[]) ! ! /* Represents a command loaded from a module. */ ! struct module_command { ! char *name; ! unsigned int flags; ! struct expression *default_rule; ! MODULE_COMMAND((*function)); ! }; ! ! /* A set of annotations on an object. */ ! struct annotations { ! unsigned int num_notes; ! void **notes; ! }; ! ! /* Initialize module support */ ! void modules_init(void); ! ! /* Shared library and module operations */ ! int module_load_library(const char *name); ! struct module *module_try_load(const char *name); ! struct module *module_register(const char *name, modver_t ver, struct module_deplist *deps, struct shared_lib *lib); ! struct module *module_find_loaded(const char *name); ! int module_define_command(struct module *mod, struct module_command *cmd); ! ! /* Annotation support */ ! void note_register_target(const char *struct_name); ! unsigned int note_register_module(const char *target_name, struct module *module); ! unsigned int note_resolve_module(const char *target_name, struct module *module); ! #define get_note(ANN, N) (((N) < (ANN)->num_notes) ? ((ANN)->notes[(N)]) : NULL) ! void put_note(struct annotations *ann, unsigned int n, void *note); ! ! #endif /* MODULES_H */ Index: modules.c =================================================================== RCS file: /cvsroot/srvx/services/src/modules.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** modules.c 2001/08/19 03:06:09 1.13 --- modules.c 2001/09/22 16:12:54 1.14 *************** *** 21,480 **** #include "config.h" - #ifdef HAVE_DLFCN_H - #include <dlfcn.h> - #endif - #ifdef HAVE_STDLIB_H #include <stdlib.h> - #endif - #ifdef HAVE_STRING_H #include <string.h> - #endif - #ifdef HAVE_STDIO_H #include <stdio.h> ! #endif ! #ifdef HAVE_UNISTD_H ! #include <unistd.h> #endif #include "common.h" #include "dict.h" - #include "hash.h" - #include "heap.h" #include "log.h" - #include "chanserv.h" - #include "opserv.h" - #include "nickserv.h" - #include "global.h" - #include "modules.h" - #include "helpfile.h" #include "recdb.h" ! #include "conf.h" ! /* Module config options/keys */ ! #define MODULES_CONF_NAME "modules" ! #define KEY_DEFAULT_ACCESS "default_level" ! #define KEY_OVERRIDE "allow_override" ! #define KEY_DEFINITION "definition" ! #define KEY_DEPS "dependencies" ! ! /* Definition keys */ ! #define KEY_COOKIE "cookie" ! #define KEY_NAME "name" ! #define KEY_VERSION "version" ! #define KEY_DESC "description" ! #define KEY_LEVEL "level" ! #define KEY_SERVICE "service" ! ! /* Access */ ! #define MODULE_NOACCESS "You have no access to manipulate module %s, level %d access needed." ! ! /* Listing */ ! #define MODULE_LIST_START "Currently loaded modules:" ! #define MODULE_LIST_FORMAT "%s [version: %li] loaded at 0x%lx level %d" ! #define MODULE_LIST_FORMAT2 "%s [version: %li] loaded at 0x%lx level %d [$b%s$b]" ! #define MODULE_LIST_END "End of loaded module list." ! ! /* Failed load */ ! #define MODULE_NOT_LOADED "Module %s not loaded, cannot %s.\n" ! #define MODULE_ALREADY_LOADED "Module %s is already loaded as %s, cannot %s.\n" ! #define MODULE_UNFIT "Module %s is lacking a %s, module is unfit to be %s.\n" ! #define MODULE_LOADFAIL "Load for module %s failed: %s\n" ! #define MODULE_NOT_LOADED_ACT "Module %s not loaded, %s.\n" ! #define MODULE_MISSING_DEP "Module %s not loaded due to missing dependency: %s.\n" ! #define MODULE_NODEFS "Module %s not loaded, config node %s is missing or has wrong type.\n" ! ! /* Successful load */ ! #define MODULE_UNLOADSUCCESS "Module %s was successfully unloaded.\n" ! #define MODULE_LOADSUCCESS "Module %s [version: %li] loaded at 0x%lx.\n" ! #define MODULE_LOADSUCCESS2 "Module %s [version: %li] loaded at 0x%lx [$b%s$b].\n" ! ! static struct { ! char *modpath; ! unsigned int default_level; ! int allow_override; ! } module_conf; ! ! struct module_def { ! char *path; ! char *cookie; ! char *name; ! char *description; ! char *service; ! long version; ! unsigned int level; ! struct string_list *dependencies; ! }; ! static dict_t module_addr_dict; ! static dict_t module_cookie_list; ! static dict_t module_getconf(const char *conf_name) ! { ! char *true_conf = alloca(strlen(conf_name) + 5); ! sprintf(true_conf, "%s.deps", conf_name); ! return parse_database(true_conf); ! } ! static int list_modules_helper(const char *key, void *data, void *extra) ! { ! struct module *mod = data; ! struct userNode *user = extra; ! if (mod->mdef->service) ! { ! opserv_notice(user, MODULE_LIST_FORMAT2, key, mod->version, (unsigned long)mod->address, (module_conf.allow_override ? mod->mdef->level : module_conf.default_level), mod->mdef->service); ! } ! else ! { ! opserv_notice(user, MODULE_LIST_FORMAT, key, mod->version, (unsigned long)mod->address, (module_conf.allow_override ? mod->mdef->level : module_conf.default_level)); } ! return 0; } ! void list_modules(struct userNode *user) { ! opserv_notice(user, MODULE_LIST_START); ! dict_foreach(module_addr_dict, list_modules_helper, user); ! opserv_notice(user, MODULE_LIST_END); } ! int unload_module(struct userNode *user, char *path) { ! struct module *mod = dict_find(module_addr_dict, path, NULL); ! ! if (!mod) ! { ! module_info(user, 0, MODULE_NOT_LOADED, path, "unload"); ! return 0; ! } ! ! MODULE_ACCESS(mod->mdef->level, path, 0); ! ! mod->deinit(); ! ! dlclose(mod->address); ! ! dict_remove(module_addr_dict, path); ! dict_remove(module_cookie_list, mod->mdef->cookie); ! ! free_string_list(mod->mdef->dependencies); ! ! free(mod->mdef); ! free(mod); ! module_info(user, 255, MODULE_UNLOADSUCCESS, path); ! return 1; ! } ! ! static int modules_depcheck(struct string_list *deps) ! { ! unsigned int i; ! for (i = 0; i < deps->used; i++) ! { ! if (!dict_find(module_cookie_list, deps->list[i], NULL)) ! { ! return i; ! } ! } ! return -1; } ! ! static void populate_defstruct(struct module_def *mdef, struct record_data *rd) ! { ! dict_t conf_node; ! char *str; ! ! conf_node = rd->d.object; ! str = database_get_data(conf_node, KEY_COOKIE, RECDB_QSTRING); ! mdef->cookie = str; ! str = database_get_data(conf_node, KEY_NAME, RECDB_QSTRING); ! mdef->name = str; ! str = database_get_data(conf_node, KEY_VERSION, RECDB_QSTRING); ! mdef->version = str ? strtoul(str, NULL, 0) : 0; ! str = database_get_data(conf_node, KEY_DESC, RECDB_QSTRING); ! mdef->description = str; ! str = database_get_data(conf_node, KEY_LEVEL, RECDB_QSTRING); ! mdef->level = str ? strtoul(str, NULL, 0) : module_conf.default_level; ! str = database_get_data(conf_node, KEY_SERVICE, RECDB_QSTRING); ! mdef->service = str; ! } ! int load_module(struct userNode *user, char *path) { ! void *modptr = NULL; ! struct module *mod = NULL; ! struct record_data *rd; ! struct module_def *mdef; ! struct module_def *tmpmod = NULL; ! char *loadpath = NULL; ! dict_t definition; ! ! (void)user; ! ! if (path[0] != '/') { ! if (module_conf.modpath) ! { ! /* this may not be an absolute path - if not dlopen() will fail to ! * paths in ld.so.conf. ! */ ! loadpath = alloca(strlen(path) + strlen(module_conf.modpath) + 1); ! sprintf(loadpath, "%s%s", module_conf.modpath, path); } ! } ! else ! { ! loadpath = alloca(strlen(path)); ! loadpath = path; ! } ! ! if (access(loadpath, R_OK)) ! { ! module_info(user, 0, "Module %s doesn't exist.", path); ! return 0; ! } ! ! if (!(definition = module_getconf(loadpath))) ! { ! module_info(user, 255, MODULE_UNFIT, path, "definition file", "loaded"); ! return 0; ! } ! ! rd = database_get_path(definition, KEY_DEFINITION); ! if (!rd || rd->type != RECDB_OBJECT) ! { ! module_info(user, 255, MODULE_NODEFS, path, KEY_DEFINITION); ! return 0; ! } ! ! mdef = malloc(sizeof(struct module_def)); ! mdef->path = strdup(path); ! populate_defstruct(mdef, rd); ! ! /* XXX: we're leaking an mdef struct - should be fixed eventually */ ! /* check access before we modify things. */ ! MODULE_ACCESS(mdef->level ? mdef->level : module_conf.default_level, path, modptr); ! ! if (!mdef->cookie) ! { ! module_info(user, 255, MODULE_UNFIT, path, "defining cookie", "loaded"); ! free(mdef); ! return 0; ! } ! ! /* make sure we don't load a duplicate module */ ! if ((tmpmod = dict_find(module_cookie_list, strdup(mdef->cookie), NULL))) ! { ! module_info(user, 255, MODULE_ALREADY_LOADED, path, tmpmod->path, "load"); ! free(mdef); ! return 0; ! } ! ! if ((mdef->dependencies = database_get_data(definition, KEY_DEPS, RECDB_STRING_LIST))) ! { ! int x; ! if ((x = modules_depcheck(mdef->dependencies)) != -1) ! { ! module_info(user, 255, MODULE_MISSING_DEP, path, mdef->dependencies->list[x]); ! free(mdef); ! return 0; ! } ! } ! else ! { ! mdef->dependencies = alloc_string_list(0); ! } ! ! if (!(modptr = dlopen (loadpath, RTLD_NOW | RTLD_GLOBAL))) ! { ! const char *err = dlerror(); ! module_info(user, 0, MODULE_LOADFAIL, path, err); ! modptr = NULL; ! free(mdef); ! return 0; ! } ! ! mod = malloc(sizeof(struct module)); ! if (!(mod->init = (void (*)(void))dlsym (modptr, "_modload"))) ! { ! module_info(user, 255, MODULE_UNFIT, path, "_modload() function", "loaded"); ! (void)dlclose (modptr); ! free(mod); free(mdef); ! return 0; ! } ! ! if (!(mod->deinit = (void (*)(void))dlsym (modptr, "_modunload"))) ! { ! module_info(user, 255, MODULE_UNFIT, path, "_modunload() function", "loaded"); ! (void)dlclose (modptr); ! free(mod); free(mdef); ! return 0; ! } ! ! /* and now we populate the structure */ ! mod->address = modptr; ! mod->name = strdup(path); ! mod->version = mdef->version; ! mod->mdef = mdef; ! ! mod->init(); ! ! dict_insert(module_addr_dict, strdup(path), mod); ! dict_insert(module_cookie_list, strdup(mdef->cookie), mdef); ! ! if (mod->mdef->service) ! { ! module_info(user, 255, MODULE_LOADSUCCESS2, path, mod->version, (unsigned long)modptr, mod->mdef->service); ! } ! else ! { ! module_info(user, 255, MODULE_LOADSUCCESS, path, mod->version, (unsigned long)modptr); ! } ! ! return 1; ! } ! ! int reload_module(struct userNode *user, const char *path) ! { ! struct module *mod = dict_find(module_addr_dict, path, NULL); ! char *truepath = alloca(strlen(path) + 1); ! ! if (!mod) ! { ! module_info(user, 0, MODULE_NOT_LOADED_ACT, path, "loading instead"); ! /* pass it off to the main module handler */ ! load_module(user, (char *)path); ! return 0; ! } ! ! MODULE_ACCESS(mod->mdef->level, path, 0); ! ! mod->deinit(); ! ! /* this has the correct cast, no garentee the user is right */ ! strcpy(truepath, mod->name); ! ! dlclose(mod->address); ! ! dict_remove(module_addr_dict, path); ! dict_remove(module_cookie_list, mod->mdef->cookie); ! ! free_string_list(mod->mdef->dependencies); ! ! free(mod->mdef); ! free(mod); ! ! /* and now we pass it back to our main module handler */ ! load_module(user, truepath); ! ! return 1; ! } ! ! /* ! * I really don't want modules touching this stuff directly, this way we ! * maintain some control over it. These are mainly for use in modules. ! */ ! void add_chanserv_modfunc(const char *name, long flags, enum userLevel access, chanserv_func_t *func) ! { ! if (func) ! { ! chanserv_define_func(name, flags, access, func); ! } } ! void add_opserv_modfunc(const char *name, opserv_func_t *func, int min_level) { ! if (func) ! { ! opserv_define_func(name, func, min_level); ! } ! } ! void add_nickserv_modfunc(const char *name, nickserv_func_t *func, int min_level, int must_auth) ! { ! if (func) ! { ! nickserv_define_func(name, func, min_level, must_auth); ! } ! } ! void add_global_modfunc(const char *name, global_func_t *func) ! { ! if (func) ! { ! global_define_func(name, func); ! } } ! void del_chanserv_modfunc(const char *name) { ! if (name) ! { ! chanserv_del_func(name); ! } } ! void del_opserv_modfunc(const char *name) { ! if (name) ! { ! opserv_del_func(name); ! } } ! void del_nickserv_modfunc(const char *name) { ! if (name) ! { ! nickserv_del_func(name); ! } ! } ! void del_global_modfunc(const char *name) ! { ! if (name) ! { ! global_del_func(name); ! } } ! static void modules_conf_read(void) { ! struct record_data *rd; ! dict_t conf_node; ! const char *str; ! ! rd = conf_get_node(MODULES_CONF_NAME); ! if (!rd || rd->type != RECDB_OBJECT) ! { ! log(MAIN_LOG, LOG_ERROR, "config node `%s' is missing or has wrong type\n", MODULES_CONF_NAME); ! return; } ! ! conf_node = rd->d.object; ! str = database_get_data(conf_node, KEY_DEFAULT_ACCESS, RECDB_QSTRING); ! module_conf.default_level = str ? atoi(str) : 800; ! str = database_get_data(conf_node, KEY_OVERRIDE, RECDB_QSTRING); ! module_conf.allow_override = str ? atoi(str) : 0; } ! void init_modules(const char *path) { ! module_addr_dict = dict_new(); ! module_cookie_list = dict_new(); ! ! if (path && path[strlen(path)] != '/') ! { ! module_conf.modpath = malloc(strlen(path) + 1); ! strcat(module_conf.modpath, path); strcat(module_conf.modpath, "/"); ! } ! else if (path) { ! module_conf.modpath = strdup(path); ! } ! else ! { ! module_conf.modpath = NULL; ! } ! ! modules_conf_read(); ! conf_register_reload(modules_conf_read); } - --- 21,257 ---- #include "config.h" #include <stdlib.h> #include <string.h> #include <stdio.h> ! #if defined(HAVE_DLFCN_H) ! #include <dlfcn.h> ! #else ! #error No module support on your platform, sorry. #endif #include "common.h" + #include "conf.h" #include "dict.h" #include "log.h" #include "recdb.h" ! #include "modules.h" ! DECLARE_LIST(module_list, struct module *); ! struct shared_lib { ! char *name; ! void *handle; ! struct module_list modules; ! }; ! struct module { ! /* Set based on module implementation */ ! char *name; ! modver_t version; ! struct module_deplist *deps; ! /* Maintained internally by this code */ ! struct shared_lib *lib; ! struct module_list children; ! dict_t commands; ! }; ! struct note_target { ! char *struct_name; ! struct module_list note_types; ! }; ! static dict_t loaded_libs; /* (struct shared_lib*)->name => (struct shared_lib*) */ ! static dict_t loaded_modules; /* (struct module*)->name => (struct module*) */ ! static dict_t note_targets; /* struct_name => (struct note_target*) */ ! ! DEFINE_LIST(module_deplist, struct module_dependency *); ! DEFINE_LIST(module_list, struct module *); ! ! /* These functions should be defined by each loadable module method */ ! static struct shared_lib *module_load_shared_lib(const char *so_name); ! static void *module_resolve_symbol(struct shared_lib *lib, const char *symname); ! static void module_unload_shared_lib(struct shared_lib *lib); ! ! #if defined(HAVE_DLFCN_H) ! static struct shared_lib * ! module_load_shared_lib(const char *so_name) ! { ! struct shared_lib *lib = malloc(sizeof(*lib)); ! ! if (!(lib->handle = dlopen(so_name, RTLD_NOW|RTLD_GLOBAL))) { ! free(lib); ! return NULL; } ! lib->name = strdup(so_name); ! return lib; } ! static void * ! module_resolve_symbol(struct shared_lib *lib, const char *symname) { ! return dlsym(lib->handle, symname); ! free(lib); } ! static void ! module_unload_shared_lib(struct shared_lib *lib) { ! dlclose(lib->handle); } ! #endif ! int ! module_load_library(const char *name) { ! struct shared_lib *lib; ! LIB_LOAD_FUNC((*lib_load)); ! int res; ! ! if (dict_find(loaded_libs, name, NULL)) return 1; ! lib = module_load_shared_lib(name); ! if (!(lib_load = module_resolve_symbol(lib, "mod_init"))) { ! module_unload_shared_lib(lib); ! return 2; } ! module_list_init(&lib->modules); ! if ((res = lib_load(lib))) { ! module_list_clean(&lib->modules); ! module_unload_shared_lib(lib); ! return 3; ! } ! dict_insert(loaded_libs, lib->name, lib); ! return 0; } ! struct module * ! module_try_load(const char *name) { ! struct module *mod; ! if ((mod = dict_find(loaded_modules, name, NULL))) return mod; ! /* TODO: try to find a shared library that contains the module */ ! return mod; ! } ! ! struct module * ! module_register(const char *name, modver_t ver, struct module_deplist *deps, struct shared_lib *lib) ! { ! unsigned int nn; ! struct module *mod; ! ! /* Fail if a module of the same name is already loaded */ ! if (dict_find(loaded_modules, name, NULL)) return NULL; ! /* Check dependencies */ ! if (deps) { ! for (nn=0; nn<deps->used; nn++) { ! struct module_dependency *dep = deps->list[nn]; ! struct module *other = module_try_load(dep->dep_name); ! ! if (!other) return NULL; ! if ((other->version < dep->min_version) ! || (other->version > dep->max_version)) { ! return NULL; ! } ! } ! } ! /* Allocate and fill in module structure */ ! mod = malloc(sizeof(*mod)); ! mod->name = strdup(name); ! mod->version = ver; ! mod->deps = deps; ! mod->lib = lib; ! mod->commands = dict_new(); ! module_list_init(&mod->children); ! /* Register module and append to parent modules' children lists */ ! dict_insert(loaded_modules, mod->name, mod); ! if (mod->deps) { ! for (nn=0; nn<mod->deps->used; nn++) { ! struct module_dependency *dep = mod->deps->list[nn]; ! struct module *other = module_try_load(dep->dep_name); ! module_list_append(&other->children, mod); ! } ! } ! return mod; } ! int ! module_define_command(struct module *mod, struct module_command *cmd) { ! if (dict_find(mod->commands, cmd->name, NULL)) return 1; ! dict_insert(mod->commands, cmd->name, cmd); ! return 0; } ! void ! note_register_target(const char *struct_name) { ! struct note_target *nt; ! nt = dict_find(note_targets, struct_name, NULL); ! if (nt) { ! log(MAIN_LOG, LOG_ERROR, "Duplicate registration of notes for '%s'.", struct_name); ! return; ! } ! nt = malloc(sizeof(*nt)); ! nt->struct_name = strdup(struct_name); ! module_list_init(&nt->note_types); ! dict_insert(note_targets, nt->struct_name, nt); ! } ! ! unsigned int ! note_register_module(const char *target_name, struct module *module) ! { ! struct note_target *nt; ! unsigned int res; ! ! nt = dict_find(note_targets, target_name, NULL); ! if (!nt) { ! log(MAIN_LOG, LOG_ERROR, "Attempted to register annotation of un-notable type '%s' for module '%s'.\n", target_name, module->name); ! return 0; ! } ! for (res=0; res<nt->note_types.used; res++) { ! if (nt->note_types.list[res] == module) break; ! } ! if (res == nt->note_types.used) module_list_append(&nt->note_types, module); ! return res; } ! unsigned int ! note_resolve_module(const char *target_name, struct module *module) { ! struct note_target *nt; ! unsigned int res; ! nt = dict_find(note_targets, target_name, NULL); ! if (!nt) { ! log(MAIN_LOG, LOG_ERROR, "Attempted to look up unregistered annotation of type '%s' by module '%s'.\n", target_name, module->name); ! return 0; ! } ! for (res=0; res<nt->note_types.used; res++) { ! if (nt->note_types.list[res] == module) return res; ! } ! return 65535; /* probably more annotations than we'll ever need */ } ! void ! put_note(struct annotations *ann, unsigned int n, void *note) { ! if (n >= ann->num_notes) { ! unsigned int orig_notes = ann->num_notes; ! ann->num_notes = n + 1; ! if (ann->num_notes) { ! ann->notes = realloc(ann->notes, ann->num_notes * sizeof(ann->notes[0])); ! memset(ann->notes + orig_notes, 0, (ann->num_notes - orig_notes) * sizeof(ann->notes[0])); ! } else { ! ann->notes = calloc(ann->num_notes, sizeof(ann->notes[0])); ! } } ! ann->notes[n] = note; } ! void ! modules_init(void) { ! loaded_libs = dict_new(); ! loaded_modules = dict_new(); } Index: main.c =================================================================== RCS file: /cvsroot/srvx/services/src/main.c,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -r1.110 -r1.111 *** main.c 2001/09/18 02:13:09 1.110 --- main.c 2001/09/22 16:12:54 1.111 *************** *** 234,244 **** dict_t dict; - rd = conf_get_node("modules/path"); - /* we dont need to error check the path - we fail to ld.so.conf */ - if (!rd || !(info = GET_RECORD_QSTRING(rd))) { - info = NULL; - } - init_modules(info); - rd = conf_get_node("services/global/nick"); if (!rd || !(info = GET_RECORD_QSTRING(rd))) { --- 234,237 ---- *************** *** 551,561 **** init_structs(); init_proto(); alias_init(); conf_globals(); conf_rlimits(); read_aliases(); ! if (replay_file) { ! log(MAIN_LOG, LOG_INFO, "Beginning replay...\n"); ! } /* The first exit func to be called *should* be write_databases(). */ --- 544,553 ---- init_structs(); init_proto(); + modules_init(); alias_init(); conf_globals(); conf_rlimits(); read_aliases(); ! if (replay_file) log(MAIN_LOG, LOG_INFO, "Beginning replay...\n"); /* The first exit func to be called *should* be write_databases(). */ Index: hash.h =================================================================== RCS file: /cvsroot/srvx/services/src/hash.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -r1.69 -r1.70 *** hash.h 2001/09/18 02:13:09 1.69 --- hash.h 2001/09/22 16:12:54 1.70 *************** *** 27,33 **** #include <time.h> #endif ! #include "common.h" ! #include "proto.h" #include "dict.h" /* in modeNode->modes */ --- 27,33 ---- #include <time.h> #endif ! #include "dict.h" + #include "modules.h" /* in modeNode->modes */ *************** *** 78,89 **** #define IsAway(x) ((x)->modes & FLAGS_AWAY) ! #define NICKLEN 30 ! #define USERLEN 10 ! #define HOSTLEN 63 ! #define REALLEN 50 #define PASSWDLEN 2 ! #define KEYLEN 23 ! #define TOPICLEN 250 ! #define CHANNELLEN 200 DECLARE_LIST(userList, struct userNode*); --- 78,89 ---- #define IsAway(x) ((x)->modes & FLAGS_AWAY) ! #define NICKLEN 31 ! #define USERLEN 11 ! #define HOSTLEN 64 ! #define REALLEN 51 #define PASSWDLEN 2 ! #define KEYLEN 24 ! #define TOPICLEN 251 ! #define CHANNELLEN 201 DECLARE_LIST(userList, struct userNode*); *************** *** 97,117 **** unsigned long modes; /* user flags +isw etc... */ unsigned long ip; ! unsigned char nick[NICKLEN + 1]; /* Unique name of the client, nick or host */ ! unsigned char username[USERLEN + 1]; /* username here now for auth stuff */ ! unsigned char info[REALLEN + 1]; /* Free form additional client information */ ! unsigned char hostname[HOSTLEN + 1]; - time_t timestamp; struct server *uplink; struct modeList channels; ! ! /* from proto */ ! struct userNode_proto *proto; ! /* from nickserv */ ! struct handle_info *handle_info; ! struct userNode *next_authed; ! /* from policer */ ! struct policer *command_policer; }; --- 97,110 ---- unsigned long modes; /* user flags +isw etc... */ unsigned long ip; + time_t timestamp; ! unsigned char nick[NICKLEN]; /* Unique name of the client */ ! unsigned char username[USERLEN]; /* Username on client's machine */ ! unsigned char info[REALLEN]; /* Additional client information */ ! unsigned char hostname[HOSTLEN]; struct server *uplink; struct modeList channels; ! struct annotations notes; }; *************** *** 119,146 **** struct chanNode { ! char name[CHANNELLEN + 1]; chan_mode_t modes; unsigned int limit; ! char key[KEYLEN + 1]; ! time_t timestamp; /* creation time */ ! char topic[TOPICLEN + 1]; ! char topic_nick[NICKLEN + 1]; ! time_t topic_time; struct modeList members; struct banList banlist; ! struct policer *join_policer; ! unsigned int join_flooded : 1; ! unsigned int bad_channel : 1; ! ! struct chanData *channel_info; ! struct channelNode_proto *proto; }; struct banNode { ! char ban[NICKLEN + USERLEN + HOSTLEN + 3]; /* 1 for '\0', 1 for ! and 1 for @ = 3 */ ! char who[NICKLEN + 1]; /* who set ban */ ! time_t set; /* time ban was set */ }; --- 112,134 ---- struct chanNode { ! char name[CHANNELLEN]; chan_mode_t modes; unsigned int limit; ! time_t timestamp; /* creation time */ ! char key[KEYLEN]; ! char topic[TOPICLEN]; ! char topic_nick[NICKLEN]; ! time_t topic_time; /* time topic set */ struct modeList members; struct banList banlist; ! struct annotations notes; }; struct banNode { ! char ban[NICKLEN + USERLEN + HOSTLEN]; ! char who[NICKLEN]; /* who set ban */ ! time_t set; /* time ban was set */ }; *************** *** 151,155 **** }; ! #define SERVERNAMEMAX 64 #define SERVERDESCRIPTMAX 128 --- 139,143 ---- }; ! #define SERVERNAMEMAX HOSTLEN #define SERVERDESCRIPTMAX 128 *************** *** 157,166 **** time_t boot, link; unsigned int hops, clients, in_burst; ! char name[SERVERNAMEMAX+1]; ! char description[SERVERDESCRIPTMAX+1]; struct server *uplink; - struct serverNode_proto *proto; struct serverList children; }; --- 145,154 ---- time_t boot, link; unsigned int hops, clients, in_burst; ! char name[SERVERNAMEMAX]; ! char description[SERVERDESCRIPTMAX]; struct server *uplink; struct serverList children; + struct annotations notes; }; Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -r1.143 -r1.144 *** hash.c 2001/09/18 02:13:09 1.143 --- hash.c 2001/09/22 16:12:54 1.144 *************** *** 43,47 **** #include "hash.h" #include "log.h" ! #include "policer.h" #include "tools.h" --- 43,47 ---- #include "hash.h" #include "log.h" ! #include "proto.h" #include "tools.h" *************** *** 49,54 **** struct server *self; - unsigned int max_clients, invis_clients; - time_t max_clients_time; struct userList curr_opers; dict_t channels; --- 49,52 ---- *************** *** 60,64 **** static void client_free(void *client); ! void init_structs(void) { channels = dict_new(); --- 58,63 ---- static void client_free(void *client); ! void ! init_structs(void) { channels = dict_new(); *************** *** 283,287 **** { struct userNode *uNode; - struct policer_params *pol_params; unsigned int n; --- 282,285 ---- *************** *** 307,323 **** uNode->uplink->clients++; uNode->modes=0; - uNode->command_policer = NULL; mod_usermode(uNode, modes); - uNode->handle_info = NULL; - uNode->next_authed = NULL; - pol_params = IsOper(uNode) ? oper_policer_params : luser_policer_params; - uNode->command_policer = policer_new(pol_params, uNode->timestamp); /* insert into global nick dictionary */ dict_insert(clients, uNode->nick, uNode); - if (dict_size(clients) > max_clients) { - max_clients = dict_size(clients); - max_clients_time = now; - } if ((uNode->uplink != self) && !uNode->uplink->in_burst) { --- 305,312 ---- *************** *** 341,346 **** user->uplink->clients--; - if (IsOper(user)) userList_remove(&curr_opers, user); - if (IsInvisible(user)) invis_clients--; /* remove user from all channels */ --- 330,333 ---- *************** *** 349,353 **** } modeList_clean(&user->channels); - policer_delete(user->command_policer); free(user); } --- 336,339 ---- Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** global.c 2001/09/18 02:13:09 1.36 --- global.c 2001/09/22 16:12:54 1.37 *************** *** 147,151 **** static void ! global_privmsg(struct userNode* user, char *text) { struct global_cmd *cmd; --- 147,151 ---- static void ! global_privmsg(struct userNode *bot, struct userNode* user, char *text) { struct global_cmd *cmd; *************** *** 153,156 **** --- 153,157 ---- int argc; + (void)bot; argc = split_line(text, false, ArrayLength(argv), argv); *************** *** 711,714 **** --- 712,716 ---- } + /* TODO: replace this with a UMODE change callback */ static void global_process_oper(struct userNode *user) Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -r1.184 -r1.185 *** chanserv.c 2001/09/18 02:23:08 1.184 --- chanserv.c 2001/09/22 16:12:54 1.185 *************** *** 56,64 **** #include "conf.h" #include "dict.h" #include "hash.h" #include "helpfile.h" #include "log.h" #include "messages.h" - #include "modules.h" #include "nickserv.h" #include "policer.h" --- 56,64 ---- #include "conf.h" #include "dict.h" + #include "global.h" #include "hash.h" #include "helpfile.h" #include "log.h" #include "messages.h" #include "nickserv.h" #include "policer.h" *************** *** 635,639 **** */ static void ! chanserv_chanmsg(struct userNode* user, struct chanNode *channel, char *text) { struct userData *uData = NULL; --- 635,639 ---- */ static void ! chanserv_chanmsg(struct userNode *bot, struct userNode* user, struct chanNode *channel, char *text) { struct userData *uData = NULL; *************** *** 642,645 **** --- 642,646 ---- int argc, v = 0; + (void)bot; if(!*text) return; *************** *** 814,818 **** basic elements have been printed. ! TODO: It might be useful if commands done in public weren't stored in the log buffer (they would still be logged to disk). --- 815,819 ---- basic elements have been printed. ! XXX: It might be useful if commands done in public weren't stored in the log buffer (they would still be logged to disk). *************** *** 849,860 **** index--; ! if(cmd->flags & _CMD_REQUIRE_ACCESS && IsHelping(user)) ! { ! /* Make sure the user doesn't have access to the channel ! before flagging the entry. */ ! if(!GetChannelAccess(channel->channel_info, user->handle_info)) ! { ! index += sprintf(buffer + index, " [override]"); ! } } --- 850,857 ---- index--; ! if((cmd->flags & _CMD_REQUIRE_ACCESS) ! && IsHelping(user) && !GetChannelAccess(channel->channel_info, user->handle_info)) ! { ! index += sprintf(buffer + index, " [override]"); } *************** *** 872,878 **** static void ! chanserv_privmsg(struct userNode* user, char *command) { ! chanserv_chanmsg(user, 0, command); } --- 869,875 ---- static void ! chanserv_privmsg(struct userNode *bot, struct userNode* user, char *command) { ! chanserv_chanmsg(bot, user, 0, command); } *************** *** 3776,3780 **** search->unvisited = ParseInterval(argv[++i]); } ! /* TODO: Registrar criteria? */ else if(!strcasecmp(argv[i], "registered")) { --- 3773,3777 ---- search->unvisited = ParseInterval(argv[++i]); } ! /* TODO: Registrar criteria */ else if(!strcasecmp(argv[i], "registered")) { *************** *** 6258,6266 **** static void ! chanserv_parse_notice(struct userNode *user, char *text) { regmatch_t pmatch[4]; struct channel_trans *trans = NULL; if (strcasecmp(user->nick, chanserv_conf.old_chanserv_name)) return; if (!regexec(&chanserv_conf.access_regex, text, ArrayLength(pmatch), pmatch, 0)) { --- 6255,6264 ---- static void ! chanserv_parse_notice(struct userNode *bot, struct userNode *user, char *text) { regmatch_t pmatch[4]; struct channel_trans *trans = NULL; + (void)bot; if (strcasecmp(user->nick, chanserv_conf.old_chanserv_name)) return; if (!regexec(&chanserv_conf.access_regex, text, ArrayLength(pmatch), pmatch, 0)) { Index: Makefile.am =================================================================== RCS file: /cvsroot/srvx/services/src/Makefile.am,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** Makefile.am 2001/08/19 03:06:09 1.37 --- Makefile.am 2001/09/22 16:12:54 1.38 *************** *** 4,8 **** bin_PROGRAMS = srvx EXTRA_PROGRAMS = checkdb globtest pwcracker ! EXTRA_DIST = nickserv.help opserv.help chanserv.help \ proto_ircu_p10.c proto_ircu_p10.h \ proto_bahamut.c proto_bahamut.h --- 4,10 ---- bin_PROGRAMS = srvx EXTRA_PROGRAMS = checkdb globtest pwcracker ! EXTRA_DIST = nickserv.help nickserv-not.help opserv.help global.help \ ! chanserv.help \ ! chanserv.c chanserv.h global.c global.h nickserv.c nickserv.h opserv.c opserv.h \ proto_ircu_p10.c proto_ircu_p10.h \ proto_bahamut.c proto_bahamut.h *************** *** 11,15 **** srvx_SOURCES = \ alias.c alias.h \ - chanserv.c chanserv.h \ compat.c compat.h \ conf.c conf.h \ --- 13,16 ---- *************** *** 18,22 **** getopt1.c getopt.h \ gline.c gline.h \ - global.c global.h \ hash.c hash.h \ heap.c heap.h \ --- 19,22 ---- *************** *** 26,35 **** md5.c md5.h \ modules.c modules.h \ - nickserv.c nickserv.h \ - opserv.c opserv.h \ policer.c policer.h \ proto_@PROTO@.c proto_@PROTO@.h proto.h \ recdb.c recdb.h \ saxdb.c saxdb.h \ sockcheck.c sockcheck.h \ timeq.c timeq.h \ --- 26,35 ---- md5.c md5.h \ modules.c modules.h \ policer.c policer.h \ proto_@PROTO@.c proto_@PROTO@.h proto.h \ recdb.c recdb.h \ + rules.c rules.h \ saxdb.c saxdb.h \ + service.c service.h \ sockcheck.c sockcheck.h \ timeq.c timeq.h \ |