srvx-commits Mailing List for srvx IRC Services (Page 82)
Brought to you by:
entrope
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Entrope <en...@us...> - 2001-09-26 02:31:44
|
Update of /cvsroot/srvx/services/rx In directory usw-pr-cvs1:/tmp/cvs-serv24885/rx Removed Files: rxposix.h Log Message: remove old rx files; try to use a more standard rx instead --- rxposix.h DELETED --- |
From: Entrope <en...@us...> - 2001-09-26 02:24:34
|
Update of /cvsroot/srvx/services/po In directory usw-pr-cvs1:/tmp/cvs-serv20012/po Log Message: Directory /cvsroot/srvx/services/po added to the repository |
From: Entrope <en...@us...> - 2001-09-26 02:24:34
|
Update of /cvsroot/srvx/services/intl In directory usw-pr-cvs1:/tmp/cvs-serv20012/intl Log Message: Directory /cvsroot/srvx/services/intl added to the repository |
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 \ |
From: Entrope <en...@us...> - 2001-09-20 21:26:04
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv1644/src Modified Files: Tag: rel-1_0 parse.c Log Message: don't core when somebody does "PRIVMSG @services :burp" Index: parse.c =================================================================== RCS file: /cvsroot/srvx/services/src/Attic/parse.c,v retrieving revision 1.113.2.18 retrieving revision 1.113.2.19 diff -C2 -r1.113.2.18 -r1.113.2.19 *** parse.c 2001/09/04 21:30:19 1.113.2.18 --- parse.c 2001/09/20 21:26:01 1.113.2.19 *************** *** 921,926 **** struct userNode *user; ! if(strstr(target_list, "@")) ! { struct server *server; --- 921,927 ---- struct userNode *user; ! if (*target_list == '@') { ! user = NULL; ! } else if (strstr(target_list, "@")) { struct server *server; *************** *** 928,933 **** server = GetServerH(strtok(NULL, "@")); ! if(user && (user->uplink != server)) ! { /* Don't attempt to index into any arrays using a user's numeric on another server. --- 929,933 ---- server = GetServerH(strtok(NULL, "@")); ! if (user && (user->uplink != server)) { /* Don't attempt to index into any arrays using a user's numeric on another server. *************** *** 935,941 **** user = NULL; } ! } ! else ! { user = GetUserN(target_list); } --- 935,939 ---- user = NULL; } ! } else { user = GetUserN(target_list); } |
From: Entrope <en...@us...> - 2001-09-18 02:23:11
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv8899/src Modified Files: opserv.c chanserv.c Log Message: replace a few usages of irc_mode() with ChangeChannelModes() Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.210 retrieving revision 1.211 diff -C2 -r1.210 -r1.211 *** opserv.c 2001/09/18 02:13:09 1.210 --- opserv.c 2001/09/18 02:23:08 1.211 *************** *** 1140,1148 **** OPSERV_MIN_PARMS(2, true); unsplit_string(argv+1, argc-1); ! if (channel->key[0]) { ! char *mc = alloca(strlen(channel->key)+4); ! sprintf(mc, "-k %s", channel->key); ! irc_mode(opserv, channel, mc); ! } mod_chanmode(channel, argv[1], NULL, 0); irc_mode(opserv, channel, argv[1]); --- 1140,1144 ---- OPSERV_MIN_PARMS(2, true); unsplit_string(argv+1, argc-1); ! if (channel->key[0]) ChangeChannelModes(channel, opserv, "-k", channel->key); mod_chanmode(channel, argv[1], NULL, 0); irc_mode(opserv, channel, argv[1]); *************** *** 1280,1285 **** AddChannelVoice(count, users, channel, opserv, 1); } ! irc_mode(opserv, channel, "+m"); ! channel->modes |= MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_MODERATED, channel->name); return 1; --- 1276,1280 ---- AddChannelVoice(count, users, channel, opserv, 1); } ! ChangeChannelModes(channel, opserv, "+m"); opserv_notice(user, OSMSG_CHANNEL_MODERATED, channel->name); return 1; *************** *** 1294,1299 **** return 0; } ! irc_mode(opserv, channel, "-m"); ! channel->modes &= ~MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_UNMODERATED, channel->name); return 1; --- 1289,1293 ---- return 0; } ! ChangeChannelModes(channel, opserv, "-m"); opserv_notice(user, OSMSG_CHANNEL_UNMODERATED, channel->name); return 1; *************** *** 1889,1894 **** AddChannelUser(opserv, newchan, 0); AddChannelOp(1, &opserv, newchan, NULL, 1); ! newchan->modes |= MODE_SECRET | MODE_INVITEONLY; ! irc_mode(NULL, newchan, "+sib *!*@*"); for (n=newchan->members.used; n>0; ) { --- 1883,1887 ---- AddChannelUser(opserv, newchan, 0); AddChannelOp(1, &opserv, newchan, NULL, 1); ! ChangeChannelModes(newchan, opserv, "+sib", "*!*@*"); for (n=newchan->members.used; n>0; ) { *************** *** 1903,1908 **** for (n=0; n<opserv_secret_words->used; n++) { if (strcasestr(newchan->name, opserv_secret_words->list[n])) { ! newchan->modes |= MODE_SECRET; ! irc_mode(NULL, newchan, "+s"); } } --- 1896,1900 ---- for (n=0; n<opserv_secret_words->used; n++) { if (strcasestr(newchan->name, opserv_secret_words->list[n])) { ! ChangeChannelModes(newchan, opserv, "+s"); } } Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -r1.183 -r1.184 *** chanserv.c 2001/09/18 02:13:09 1.183 --- chanserv.c 2001/09/18 02:23:08 1.184 *************** *** 1606,1611 **** chanserv_join(new_chan); parse_mode_lock(&CHANSERV_DEFAULT_MODES, 1, new_chan); ! mod_chanmode(channel, CHANSERV_DEFAULT_MODES, NULL, 0); ! irc_mode(chanserv, channel, CHANSERV_DEFAULT_MODES); if(!add_channel_user(new_chan, handle, levelMap[USER_LEVEL_HIGHEST], USER_LEVEL_HIGHEST, now, NULL)) --- 1606,1610 ---- chanserv_join(new_chan); parse_mode_lock(&CHANSERV_DEFAULT_MODES, 1, new_chan); ! ChangeChannelModes(channel, chanserv, CHANSERV_DEFAULT_MODES); if(!add_channel_user(new_chan, handle, levelMap[USER_LEVEL_HIGHEST], USER_LEVEL_HIGHEST, now, NULL)) *************** *** 2540,2560 **** static CHANSERV_FUNC(cmd_open) { - char *change; - cmd_unbanme(CSFUNC_ARGS); if(channel->modes & MODE_KEY) { ! change = alloca(strlen(channel->key) + 6); ! sprintf(change, "-ilk %s", channel->key); } else { ! change = "-il"; } - mod_chanmode(channel, change, NULL, 0); - irc_mode(channel->channel_info->bot, channel, change); - chanserv_notice(user, CSMSG_CHANNEL_OPENED, channel->name); return 1; --- 2539,2553 ---- static CHANSERV_FUNC(cmd_open) { cmd_unbanme(CSFUNC_ARGS); if(channel->modes & MODE_KEY) { ! ChangeChannelModes(channel, channel->channel_info->bot, "-ilk", channel->key); } else { ! ChangeChannelModes(channel, channel->channel_info->bot, "-il"); } chanserv_notice(user, CSMSG_CHANNEL_OPENED, channel->name); return 1; *************** *** 2971,2975 **** { create_mode_lock(modes, channel->channel_info); - mod_chanmode(channel, modes, NULL, 0); irc_mode(channel->channel_info->bot, channel, modes); --- 2964,2967 ---- *************** *** 4415,4419 **** struct chanNode *channel = data; unsigned int limit; - char change[10]; limit = channel->members.used + chanserv_conf.adjust_threshold + 5; --- 4407,4410 ---- *************** *** 4428,4436 **** return; } - - sprintf(change, "+l %d", limit); ! channel->limit = limit; ! irc_mode(channel->channel_info->bot, channel, change); } --- 4419,4424 ---- return; } ! ChangeChannelModes(channel, channel->channel_info->bot, "+l", limit); } |
From: Entrope <en...@us...> - 2001-09-18 02:15:23
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv7619 Modified Files: TODO Log Message: update TODO Index: TODO =================================================================== RCS file: /cvsroot/srvx/services/TODO,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -r1.67 -r1.68 *** TODO 2001/09/10 19:37:30 1.67 --- TODO 2001/09/18 02:15:19 1.68 *************** *** 30,38 **** makes parsing rather easier, and is already done in proto_bahamut.c) ! Deprecate general use of irc_mode directly from services. Instead, ! add a varadic function to hash.c that can op/deop/etc. channel users ! "intelligently" based on the mode change string. ! DCC/telnet interface support (or straight IRC support :).. Modules: --- 30,39 ---- makes parsing rather easier, and is already done in proto_bahamut.c) ! Use ChangeChannelModes() in *serv.c instead of irc_mode(). ! DCC/telnet interface support. ! ! More flexible (and improved) logging -- sending to both files and ! IRC channels. Modules: |
From: Entrope <en...@us...> - 2001-09-18 02:13:12
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv7175/src Modified Files: tools.h tools.c sockcheck.h sockcheck.c proto_ircu_p10.h proto_ircu_p10.c proto_bahamut.h proto_bahamut.c proto.h opserv.c nickserv.c main.c helpfile.c hash.h hash.c global.c common.h chanserv.c Log Message: hide all the per-protocol fooNode bits inside proto_*.c Index: tools.h =================================================================== RCS file: /cvsroot/srvx/services/src/tools.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** tools.h 2001/08/24 20:33:45 1.12 --- tools.h 2001/09/18 02:13:08 1.13 *************** *** 31,34 **** --- 31,35 ---- struct userNode; struct chanNode; + extern unsigned char channel_inverse_modes[256]; typedef void (*oper_func_t) (struct userNode *user); *************** *** 86,91 **** int make_chanmode(struct chanNode *chan, char *out, unsigned int len); int make_usermode(struct userNode *user, char *out, unsigned int len); - - char *intoa(unsigned long addr); #endif /* ifdef _TOOLS_H_ */ --- 87,90 ---- Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** tools.c 2001/08/24 21:05:31 1.93 --- tools.c 2001/09/18 02:13:08 1.94 *************** *** 91,95 **** static unsigned char user_inverse_modes[256]; static const unsigned char *channel_modes = RFC1459_CHANNEL_MODE_CHARS PROTO_CHANNEL_MODE_CHARS; ! static unsigned char channel_inverse_modes[256]; static void --- 91,95 ---- static unsigned char user_inverse_modes[256]; static const unsigned char *channel_modes = RFC1459_CHANNEL_MODE_CHARS PROTO_CHANNEL_MODE_CHARS; ! unsigned char channel_inverse_modes[256]; static void *************** *** 883,893 **** memmove(buf->list+from+repl_len, buf->list+from+len, strlen(buf->list+from+len)); strcpy(buf->list+from, repl); - } - - char *intoa(unsigned long addr) { - struct in_addr in; - - in.s_addr = addr; - return inet_ntoa(in); } --- 883,886 ---- Index: sockcheck.h =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** sockcheck.h 2001/08/19 03:06:09 1.8 --- sockcheck.h 2001/09/18 02:13:08 1.9 *************** *** 34,38 **** void sockcheck_init(void); const char *sockcheck_add_test(const char *desc); ! void sockcheck_queue_address(unsigned long addr, const char *name); int sockcheck_uncache_host(const char *name); void sockcheck_get_stats(struct sockcheck_stats *stats); --- 34,38 ---- void sockcheck_init(void); const char *sockcheck_add_test(const char *desc); ! void sockcheck_queue_address(unsigned long addr); int sockcheck_uncache_host(const char *name); void sockcheck_get_stats(struct sockcheck_stats *stats); Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -r1.60 -r1.61 *** sockcheck.c 2001/08/19 03:06:09 1.60 --- sockcheck.c 2001/09/18 02:13:08 1.61 *************** *** 232,238 **** void ! sockcheck_queue_address(unsigned long addr, const char *name) { sockcheck_cache_info sci; if (disable_sockcheck) return; if (pending_ip_pipe[1] == -1) return; /* something went wrong in worker */ --- 232,242 ---- void ! sockcheck_queue_address(unsigned long addr) { sockcheck_cache_info sci; + unsigned long haddr; + int namelen; + char buff[32], *name; + if (disable_sockcheck) return; if (pending_ip_pipe[1] == -1) return; /* something went wrong in worker */ *************** *** 242,245 **** --- 246,252 ---- return; } + haddr = ntohl(addr); + namelen = snprintf(buff, sizeof(buff), " %ld.%ld.%ld.%ld", (haddr >> 24) & 255, (haddr >> 16) & 255, (haddr >> 8) & 255, haddr & 255) - 1; + name = buff + 1; sci = dict_find(checked_ip_dict, name, NULL); if ((sci != NULL) *************** *** 248,255 **** if (sci->decision == REJECT) sockcheck_issue_gline(sci); } else { - int namelen = strlen(name) + 1; - unsigned char *buff = alloca(namelen); buff[0] = namelen; - memcpy(buff+1, name, namelen - 1); if (!sci) { sci = malloc(sizeof(*sci) + namelen); --- 255,259 ---- Index: proto_ircu_p10.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** proto_ircu_p10.h 2001/08/24 21:05:31 1.4 --- proto_ircu_p10.h 2001/09/18 02:13:09 1.5 *************** *** 30,51 **** #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN) - #define PROTO_HAS_NUMERIC 1 #define PROTO_USER_MODE_CHARS "dkgh" - - struct userNode_proto { - char numeric[COMBO_NUMERIC_LEN+1]; - }; - - struct chanNode_proto { - }; - - struct serverNode_proto { - char numeric[SERVER_NUMERIC_LEN+1]; - struct userNode *users[USERARRAYSIZE]; /* flat indexed by numeric */ - }; - - #define MODE_TARGET_USER(USER) ((USER)->proto.numeric) - #define PRIVMSG_TARGET_USER(USER) ((USER)->proto.numeric) - #define PRIVMSG_TARGET_CHANNEL(CHANNEL) ((CHANNEL)->name) #endif /* !defined(PROTO_IRCU_P10_H) */ --- 30,34 ---- Index: proto_ircu_p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** proto_ircu_p10.c 2001/08/24 20:33:45 1.20 --- proto_ircu_p10.c 2001/09/18 02:13:09 1.21 *************** *** 73,76 **** --- 73,85 ---- static unsigned int highest_numeric; + struct userNode_proto { + char numeric[COMBO_NUMERIC_LEN+1]; + }; + + struct serverNode_proto { + char numeric[SERVER_NUMERIC_LEN+1]; + struct userNode *users[USERARRAYSIZE]; /* flat indexed by numeric */ + }; + /**************************************/ /* NUMERIC CONVERSIONS (base64<->int) */ *************** *** 279,283 **** { putsock("%s %s %d %li %li P10 %s]] :%s", ! CMD_SERVER, srv->name, srv->hops, srv->boot, srv->link, srv->proto.numeric, srv->description); } --- 288,292 ---- { putsock("%s %s %d %li %li P10 %s]] :%s", ! CMD_SERVER, srv->name, srv->hops, srv->boot, srv->link, srv->proto->numeric, srv->description); } *************** *** 286,290 **** { putsock("%s %s %d %li %li J10 %s]] :%s", ! CMD_SERVER, srv->name, srv->hops + 1, srv->boot, srv->link, srv->proto.numeric, srv->description); } --- 295,299 ---- { putsock("%s %s %d %li %li J10 %s]] :%s", ! CMD_SERVER, srv->name, srv->hops + 1, srv->boot, srv->link, srv->proto->numeric, srv->description); } *************** *** 320,327 **** make_usermode(user, modes, sizeof(modes)); putsock("%s %s %s %d "FMT_TIME_T" %s %s %s %s %s :%s", ! user->uplink->proto.numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->username, user->hostname, modes, b64ip, user->proto.numeric, user->info); } else { putsock("%s %s %s %d "FMT_TIME_T" %s %s %s %s :%s", ! user->uplink->proto.numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->username, user->hostname, b64ip, user->proto.numeric, user->info); } } --- 329,336 ---- make_usermode(user, modes, sizeof(modes)); putsock("%s %s %s %d "FMT_TIME_T" %s %s %s %s %s :%s", ! user->uplink->proto->numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->username, user->hostname, modes, b64ip, user->proto->numeric, user->info); } else { putsock("%s %s %s %d "FMT_TIME_T" %s %s %s %s :%s", ! user->uplink->proto->numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->username, user->hostname, b64ip, user->proto->numeric, user->info); } } *************** *** 330,334 **** irc_nick(struct userNode *user) { ! putsock("%s %s %s "FMT_TIME_T, user->proto.numeric, CMD_NICK, user->nick, now); } --- 339,343 ---- irc_nick(struct userNode *user) { ! putsock("%s %s %s "FMT_TIME_T, user->proto->numeric, CMD_NICK, user->nick, now); } *************** *** 347,357 **** /* Quit all local users. */ ! for (i = 0; i < ArrayLength(self->proto.users); i++) { ! if (!self->proto.users[i]) continue; ! irc_quit(self->proto.users[i], message); } } ! putsock("%s %s %s %d :%s", self->proto.numeric, CMD_SQUIT, srv->name, 0, message); if (srv == self->uplink) { --- 356,366 ---- /* Quit all local users. */ ! for (i = 0; i < ArrayLength(self->proto->users); i++) { ! if (!self->proto->users[i]) continue; ! irc_quit(self->proto->users[i], message); } } ! putsock("%s %s %s %d :%s", self->proto->numeric, CMD_SQUIT, srv->name, 0, message); if (srv == self->uplink) { *************** *** 363,367 **** irc_notice(struct userNode *from, const char *to, const char *message) { ! putsock("%s %s %s :%s", from->proto.numeric, CMD_NOTICE, to, message); } --- 372,376 ---- irc_notice(struct userNode *from, const char *to, const char *message) { ! putsock("%s %s %s :%s", from->proto->numeric, CMD_NOTICE, to, message); } *************** *** 369,373 **** irc_privmsg(struct userNode *from, const char *to, const char *message) { ! putsock("%s %s %s :%s", from->proto.numeric, CMD_PRIVMSG, to, message); } --- 378,387 ---- irc_privmsg(struct userNode *from, const char *to, const char *message) { ! if (IsChannelName(to)) { ! putsock("%s %s %s :%s", from->proto->numeric, CMD_PRIVMSG, to, message); ! } else { ! struct userNode *user = GetUser(to); ! if (user) putsock("%s %s %s :%s", from->proto->numeric, CMD_PRIVMSG, user->proto->numeric, message); ! } } *************** *** 375,379 **** irc_eob(void) { ! putsock("%s %s", self->proto.numeric, CMD_EOB); } --- 389,393 ---- irc_eob(void) { ! putsock("%s %s", self->proto->numeric, CMD_EOB); } *************** *** 381,385 **** irc_eob_ack(void) { ! putsock("%s %s", self->proto.numeric, CMD_EOB_ACK); } --- 395,399 ---- irc_eob_ack(void) { ! putsock("%s %s", self->proto->numeric, CMD_EOB_ACK); } *************** *** 387,391 **** irc_ping(const char *something) { ! putsock("%s %s :%s", self->proto.numeric, CMD_PING, something); } --- 401,405 ---- irc_ping(const char *something) { ! putsock("%s %s :%s", self->proto->numeric, CMD_PING, something); } *************** *** 393,397 **** irc_pong(const char *data) { ! putsock("%s %s %s :%s", self->proto.numeric, CMD_PONG, self->name, data); } --- 407,411 ---- irc_pong(const char *data) { ! putsock("%s %s %s :%s", self->proto->numeric, CMD_PONG, self->name, data); } *************** *** 420,424 **** irc_gline(const char *mask, unsigned long duration, const char *message) { ! putsock("%s %s * +%s %lu :%s", self->proto.numeric, CMD_GLINE, mask, duration, message); } --- 434,438 ---- irc_gline(const char *mask, unsigned long duration, const char *message) { ! putsock("%s %s * +%s %lu :%s", self->proto->numeric, CMD_GLINE, mask, duration, message); } *************** *** 426,430 **** irc_ungline(const char *mask) { ! putsock("%s %s * -%s", self->proto.numeric, CMD_GLINE, mask); } --- 440,444 ---- irc_ungline(const char *mask) { ! putsock("%s %s * -%s", self->proto->numeric, CMD_GLINE, mask); } *************** *** 432,436 **** irc_jupe(const char *server, unsigned long duration, const char *reason) { ! putsock("%s %s * +%s %lu "FMT_TIME_T" :%s", self->proto.numeric, CMD_JUPE, server, duration, now, reason); } --- 446,450 ---- irc_jupe(const char *server, unsigned long duration, const char *reason) { ! putsock("%s %s * +%s %lu "FMT_TIME_T" :%s", self->proto->numeric, CMD_JUPE, server, duration, now, reason); } *************** *** 438,442 **** irc_unjupe(const char *server) { ! putsock("%s %s * -%s 0 "FMT_TIME_T" :Unjuping.", self->proto.numeric, CMD_JUPE, server, now); } --- 452,456 ---- irc_unjupe(const char *server) { ! putsock("%s %s * -%s 0 "FMT_TIME_T" :Unjuping.", self->proto->numeric, CMD_JUPE, server, now); } *************** *** 451,455 **** unsigned int n; ! base_len = sprintf(burst_line, "%s %s %s " FMT_TIME_T " ", self->proto.numeric, CMD_BURST, chan->name, chan->timestamp); len = make_chanmode(chan, burst_line+base_len, sizeof(burst_line)-base_len); pos = base_len + len - 1; --- 465,469 ---- unsigned int n; ! base_len = sprintf(burst_line, "%s %s %s " FMT_TIME_T " ", self->proto->numeric, CMD_BURST, chan->name, chan->timestamp); len = make_chanmode(chan, burst_line+base_len, sizeof(burst_line)-base_len); pos = base_len + len - 1; *************** *** 465,470 **** last_mode = -1; } ! memcpy(burst_line+pos, mn->user->proto.numeric, 5); ! pos += strlen(mn->user->proto.numeric); if (mn->modes && (mn->modes != last_mode)) { last_mode = mn->modes; --- 479,484 ---- last_mode = -1; } ! memcpy(burst_line+pos, mn->user->proto->numeric, 5); ! pos += strlen(mn->user->proto->numeric); if (mn->modes && (mn->modes != last_mode)) { last_mode = mn->modes; *************** *** 506,510 **** irc_quit(struct userNode *user, const char *message) { ! putsock("%s %s :%s", user->proto.numeric, CMD_QUIT, message); } --- 520,524 ---- irc_quit(struct userNode *user, const char *message) { ! putsock("%s %s :%s", user->proto->numeric, CMD_QUIT, message); } *************** *** 523,529 **** { if (from) { ! putsock("%s %s %s :%s!%s (%s)", from->proto.numeric, CMD_KILL, target->proto.numeric, self->name, from->nick, message); } else { ! putsock("%s %s %s :%s (%s)", self->proto.numeric, CMD_KILL, target->proto.numeric, self->name, message); } } --- 537,543 ---- { if (from) { ! putsock("%s %s %s :%s!%s (%s)", from->proto->numeric, CMD_KILL, target->proto->numeric, self->name, from->nick, message); } else { ! putsock("%s %s %s :%s (%s)", self->proto->numeric, CMD_KILL, target->proto->numeric, self->name, message); } } *************** *** 535,541 **** const char *src; if ((mn = GetUserMode(target, from)) && (mn->modes & MODE_CHANOP)) { ! src = from->proto.numeric; } else { ! src = self->proto.numeric; } putsock("%s %s %s %s "FMT_TIME_T, src, CMD_MODE, target->name, modes, target->timestamp); --- 549,555 ---- const char *src; if ((mn = GetUserMode(target, from)) && (mn->modes & MODE_CHANOP)) { ! src = from->proto->numeric; } else { ! src = self->proto->numeric; } putsock("%s %s %s %s "FMT_TIME_T, src, CMD_MODE, target->name, modes, target->timestamp); *************** *** 552,558 **** { if (what->members.used == 1) { ! putsock("%s %s %s %lu", who->proto.numeric, CMD_CREATE, what->name, what->timestamp); } else { ! putsock("%s %s %s", who->proto.numeric, CMD_JOIN, what->name); } } --- 566,572 ---- { if (what->members.used == 1) { ! putsock("%s %s %s %lu", who->proto->numeric, CMD_CREATE, what->name, what->timestamp); } else { ! putsock("%s %s %s", who->proto->numeric, CMD_JOIN, what->name); } } *************** *** 561,565 **** irc_kick(struct userNode *actor, struct userNode *who, struct chanNode *from, const char *msg) { ! putsock("%s %s %s %s :%s", actor->proto.numeric, CMD_KICK, from->name, who->proto.numeric, msg); } --- 575,579 ---- irc_kick(struct userNode *actor, struct userNode *who, struct chanNode *from, const char *msg) { ! putsock("%s %s %s %s :%s", actor->proto->numeric, CMD_KICK, from->name, who->proto->numeric, msg); } *************** *** 573,577 **** irc_stats(struct userNode *from, struct server *target, char type) { ! putsock("%s STATS %c :%s", from->proto.numeric, type, target->proto.numeric); } --- 587,591 ---- irc_stats(struct userNode *from, struct server *target, char type) { ! putsock("%s STATS %c :%s", from->proto->numeric, type, target->proto->numeric); } *************** *** 579,583 **** irc_part(struct userNode *who, struct chanNode *what, const char *reason) { ! putsock("%s %s %s :%s", who->proto.numeric, CMD_PART, what->name, reason); } --- 593,597 ---- irc_part(struct userNode *who, struct chanNode *what, const char *reason) { ! putsock("%s %s %s :%s", who->proto->numeric, CMD_PART, what->name, reason); } *************** *** 588,591 **** --- 602,743 ---- } + void + chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list) + { + char buffer[400]; + unsigned int start, i, here_len, queued; + + queued = 0; + start = sizeof(buffer)-1; + buffer[start] = 0; + for (i=0; i<count; i++) { + here_len = strlen(list[i]); + if ((start < queued+here_len+3) || (queued >= MAXMODEPARAMS)) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + start -= here_len; + memcpy(buffer+start, list[i], here_len); /* omit terminator */ + buffer[--start] = ' '; + queued++; + } + if (queued) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + } + + void + chan_apply_mode(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, struct userNode **list) + { + char buffer[400]; + unsigned int start, i, queued, len; + queued = 0; + start = sizeof(buffer)-1; + buffer[start] = 0; + + for (i=0; i<count; i++) { + len = strlen(list[i]->proto->numeric); + if ((start < queued+3+len) || (queued >= MAXMODEPARAMS)) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + start -= len; + memcpy(buffer+start, list[i]->proto->numeric, len); + buffer[--start] = ' '; + queued++; + } + if (queued) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + } + + void + irc_change_channel_modes(struct chanNode *channel, struct userNode *source, const unsigned char *modes, va_list args) + { + char modebuf[200]; + char argbuf[MAXLEN], numbuf[16]; + unsigned int add, mode_pos, base_mode_pos, arg_pos, arg_limit, arg_len; + const char *arg_text; + + add = 1; + arg_pos = 0; + mode_pos = base_mode_pos = snprintf(modebuf, sizeof(modebuf), ":%s MODE %s +", source->nick, channel->name); + arg_limit = MAXLEN - 10; + while (*modes) { + switch (*modes++) { + struct userNode *user; + int number; + case '+': + if (!add) modebuf[mode_pos++] = '+'; + add = 1; + break; + case '-': + if (add) modebuf[mode_pos++] = '-'; + add = 0; + break; + case 'o': + user = va_arg(args, struct userNode *); + arg_text = user->proto->numeric; + goto add_arg; + case 'v': + user = va_arg(args, struct userNode *); + arg_text = user->proto->numeric; + goto add_arg; + case 'b': + arg_text = va_arg(args, const char *); + goto add_arg; + case 'l': + number = va_arg(args, int); + snprintf(numbuf, sizeof(numbuf), "%d", number); + arg_text = numbuf; + goto add_arg; + case 'k': + arg_text = va_arg(args, const char *); + goto add_arg; + add_arg: + arg_len = strlen(arg_text); + if ((arg_pos + mode_pos + arg_len >= arg_limit) + || (mode_pos+1 == sizeof(modebuf))) { + modebuf[mode_pos] = 0; + /* -1 in argbuf because of trailing space */ + argbuf[arg_pos-1] = 0; + putsock("%s %s", modebuf, argbuf); + mode_pos = base_mode_pos; + arg_pos = 0; + } + modebuf[mode_pos++] = modes[-1]; + memcpy(argbuf + arg_pos, arg_text, arg_len); + arg_pos += arg_len; + argbuf[arg_pos++] = ' '; + break; + default: + modebuf[mode_pos++] = modes[-1]; + break; + } + } + } + /********************/ /* PROTOCOL PARSING */ *************** *** 650,655 **** } n = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); ! un = GetServerN(numeric)->proto.users[n]; ! if (!(un = s->proto.users[n])) { log(DEBUG_LOG, LOG_WARNING, "GetUserN(%s) couldn't find user!\n", numeric); } --- 802,807 ---- } n = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); ! un = GetServerN(numeric)->proto->users[n]; ! if (!(un = s->proto->users[n])) { log(DEBUG_LOG, LOG_WARNING, "GetUserN(%s) couldn't find user!\n", numeric); } *************** *** 692,698 **** /* burst local nicks */ ! for (i=0; i<ArrayLength(self->proto.users); i++) { ! if (!self->proto.users[i]) continue; ! irc_user(self->proto.users[i]); } --- 844,850 ---- /* burst local nicks */ ! for (i=0; i<ArrayLength(self->proto->users); i++) { ! if (!self->proto->users[i]) continue; ! irc_user(self->proto->users[i]); } *************** *** 752,756 **** new_server = AddServer(uplink, name, hops, boot, link, description); servers_num[base64toint(numeric, SERVER_NUMERIC_LEN)] = new_server; ! safestrncpy(new_server->proto.numeric, numeric, sizeof(new_server->proto.numeric)); return new_server; } --- 904,909 ---- new_server = AddServer(uplink, name, hops, boot, link, description); servers_num[base64toint(numeric, SERVER_NUMERIC_LEN)] = new_server; ! new_server->proto = calloc(1, sizeof(*new_server->proto)); ! safestrncpy(new_server->proto->numeric, numeric, sizeof(new_server->proto->numeric)); return new_server; } *************** *** 928,935 **** if (uNode) { unsigned long num_local; ! safestrncpy(uNode->proto.numeric, numeric, sizeof(uNode->proto.numeric)); uNode->ip = base64toint(realip, 6); num_local = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); ! GetServerN(numeric)->proto.users[num_local] = uNode; if (uplink == self) irc_user(uNode); } else { --- 1081,1089 ---- if (uNode) { unsigned long num_local; ! uNode->proto = calloc(1, sizeof(*uNode->proto)); ! safestrncpy(uNode->proto->numeric, numeric, sizeof(uNode->proto->numeric)); uNode->ip = base64toint(realip, 6); num_local = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); ! GetServerN(numeric)->proto->users[num_local] = uNode; if (uplink == self) irc_user(uNode); } else { *************** *** 939,943 **** * comparisons. If this other user is +k, then somebody * screwed up. */ ! sprintf(kill, "%s KILL %s :%s (Nick collision.)", self->proto.numeric, numeric, self->name); irc_raw(kill); } --- 1093,1097 ---- * comparisons. If this other user is +k, then somebody * screwed up. */ ! sprintf(kill, "%s KILL %s :%s (Nick collision.)", self->proto->numeric, numeric, self->name); irc_raw(kill); } *************** *** 950,954 **** unsigned int last = next_numeric; do { ! if (!self->proto.users[next_numeric++]) { if (next_numeric > highest_numeric) { highest_numeric = next_numeric; --- 1104,1108 ---- unsigned int last = next_numeric; do { ! if (!self->proto->users[next_numeric++]) { if (next_numeric > highest_numeric) { highest_numeric = next_numeric; *************** *** 967,971 **** int local_num; if ((local_num = get_local_numeric()) == -1) return NULL; ! safestrncpy(numeric, self->proto.numeric, SERVER_NUMERIC_LEN+1); inttobase64(numeric+SERVER_NUMERIC_LEN, local_num, USER_NUMERIC_LEN); numeric[COMBO_NUMERIC_LEN] = 0; --- 1121,1125 ---- int local_num; if ((local_num = get_local_numeric()) == -1) return NULL; ! safestrncpy(numeric, self->proto->numeric, SERVER_NUMERIC_LEN+1); inttobase64(numeric+SERVER_NUMERIC_LEN, local_num, USER_NUMERIC_LEN); numeric[COMBO_NUMERIC_LEN] = 0; *************** *** 1037,1041 **** while (banlist[i] != ' ' && banlist[i]) i++; while (banlist[i] == ' ') banlist[i++]='\0'; ! AddChannelBan(1, &ban, chan, NULL, now, 0); } } --- 1191,1195 ---- while (banlist[i] != ' ' && banlist[i]) i++; while (banlist[i] == ' ') banlist[i++]='\0'; ! ChangeChannelModes(chan, NULL, "*+b", ban); } } *************** *** 1200,1207 **** char *ban = argv[next_arg++]; if (add) { ! AddChannelBan(1, &ban, cn, GetUserX(argv[0]), now, 0); if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban); ! } ! else DelChannelBan(1, &ban, cn, NULL, 0); break; } } --- 1354,1362 ---- char *ban = argv[next_arg++]; if (add) { ! ChangeChannelModes(cn, GetUserX(argv[0]), "*+b", ban); if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban); ! } else { ! ChangeChannelModes(cn, GetUserX(argv[0]), "*-b", ban); ! } break; } } *************** *** 1419,1423 **** { struct privmsg_desc *pd = data; ! int num = base64toint(un->proto.numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (!pd->is_notice) { if (privmsg_funcs[num]) { --- 1574,1578 ---- { struct privmsg_desc *pd = data; ! int num = base64toint(un->proto->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (!pd->is_notice) { if (privmsg_funcs[num]) { *************** *** 1497,1501 **** ircu_del_user(struct userNode *user) { ! user->uplink->proto.users[base64toint(user->proto.numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN)] = NULL; } --- 1652,1656 ---- ircu_del_user(struct userNode *user) { ! user->uplink->proto->users[base64toint(user->proto->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN)] = NULL; } *************** *** 1506,1516 **** /* clean up server's user hash tables */ for (i=0; i<USERARRAYSIZE; i++) { ! if (srv->proto.users[i]) { ! DelUser(srv->proto.users[i], NULL, false, "Server delinked"); ! srv->proto.users[i] = NULL; } } /* delete from servers_num array */ ! servers_num[base64toint(srv->proto.numeric, SERVER_NUMERIC_LEN)] = NULL; } --- 1661,1671 ---- /* clean up server's user hash tables */ for (i=0; i<USERARRAYSIZE; i++) { ! if (srv->proto->users[i]) { ! DelUser(srv->proto->users[i], NULL, false, "Server delinked"); ! srv->proto->users[i] = NULL; } } /* delete from servers_num array */ ! servers_num[base64toint(srv->proto->numeric, SERVER_NUMERIC_LEN)] = NULL; } *************** *** 1649,1653 **** reg_privmsg_func(struct userNode *user, privmsg_func_t handler) { ! unsigned long numeric = base64toint(user->proto.numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (numeric > num_privmsg_funcs) { int newnum = numeric + 8; --- 1804,1808 ---- reg_privmsg_func(struct userNode *user, privmsg_func_t handler) { ! unsigned long numeric = base64toint(user->proto->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (numeric > num_privmsg_funcs) { int newnum = numeric + 8; *************** *** 1665,1669 **** reg_notice_func(struct userNode *user, privmsg_func_t handler) { ! unsigned int numeric = base64toint(user->proto.numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (numeric > num_notice_funcs) { int newnum = numeric + 8; --- 1820,1824 ---- reg_notice_func(struct userNode *user, privmsg_func_t handler) { ! unsigned int numeric = base64toint(user->proto->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (numeric > num_notice_funcs) { int newnum = numeric + 8; Index: proto_bahamut.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** proto_bahamut.h 2001/08/29 15:14:40 1.7 --- proto_bahamut.h 2001/09/18 02:13:09 1.8 *************** *** 30,48 **** #define CHANSERV_JOINS_CHANNELS 0 - struct userNode_proto { - privmsg_func_t privmsg_func; - privmsg_func_t notice_func; - }; - - struct chanNode_proto { - }; - - struct serverNode_proto { - dict_t clients; - }; - - #define MODE_TARGET_USER(USER) ((USER)->nick) - #define PRIVMSG_TARGET_USER(USER) ((USER)->nick) - #define PRIVMSG_TARGET_CHANNEL(CHANNEL) ((CHANNEL)->name) - #endif /* !defined(PROTO_BAHAMUT_H) */ --- 30,32 ---- Index: proto_bahamut.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** proto_bahamut.c 2001/08/24 20:33:45 1.10 --- proto_bahamut.c 2001/09/18 02:13:09 1.11 *************** *** 103,106 **** --- 103,115 ---- } uplink; + struct userNode_proto { + privmsg_func_t privmsg_func; + privmsg_func_t notice_func; + }; + + struct serverNode_proto { + dict_t clients; + }; + /********************/ /* BAHAMUT COMMANDS */ *************** *** 410,413 **** --- 419,560 ---- } + void + chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list) + { + char buffer[400]; + unsigned int start, i, here_len, queued; + + queued = 0; + start = sizeof(buffer)-1; + buffer[start] = 0; + for (i=0; i<count; i++) { + here_len = strlen(list[i]); + if ((start < queued+here_len+3) || (queued >= MAXMODEPARAMS)) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + start -= here_len; + memcpy(buffer+start, list[i], here_len); /* omit terminator */ + buffer[--start] = ' '; + queued++; + } + if (queued) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + } + + void + chan_apply_mode(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, struct userNode **list) + { + char buffer[400]; + unsigned int start, i, queued, len; + queued = 0; + start = sizeof(buffer)-1; + buffer[start] = 0; + + for (i=0; i<count; i++) { + len = strlen(list[i]->nick); + if ((start < queued+3+len) || (queued >= MAXMODEPARAMS)) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + start -= len; + memcpy(buffer+start, list[i]->nick, len); + buffer[--start] = ' '; + queued++; + } + if (queued) { + while (queued) { + buffer[--start] = what[1]; + queued--; + } + buffer[--start] = what[0]; + irc_mode(who, channel, buffer+start); + start = sizeof(buffer)-1; + } + } + + void + irc_change_channel_modes(struct chanNode *channel, struct userNode *source, const unsigned char *modes, va_list args) + { + char modebuf[200]; + char argbuf[MAXLEN], numbuf[16]; + unsigned int add, mode_pos, base_mode_pos, arg_pos, arg_limit, arg_len; + const char *arg_text; + + add = 1; + arg_pos = 0; + mode_pos = base_mode_pos = snprintf(modebuf, sizeof(modebuf), ":%s MODE %s +", source->nick, channel->name); + arg_limit = MAXLEN - 10; + while (*modes) { + switch (*modes++) { + struct userNode *user; + int number; + case '+': + if (!add) modebuf[mode_pos++] = '+'; + add = 1; + break; + case '-': + if (add) modebuf[mode_pos++] = '-'; + add = 0; + break; + case 'o': + user = va_arg(args, struct userNode *); + arg_text = user->nick; + goto add_arg; + case 'v': + user = va_arg(args, struct userNode *); + arg_text = user->nick; + goto add_arg; + case 'b': + arg_text = va_arg(args, const char *); + goto add_arg; + case 'l': + number = va_arg(args, int); + snprintf(numbuf, sizeof(numbuf), "%d", number); + arg_text = numbuf; + goto add_arg; + case 'k': + arg_text = va_arg(args, const char *); + goto add_arg; + add_arg: + arg_len = strlen(arg_text); + if ((arg_pos + mode_pos + arg_len >= arg_limit) + || (mode_pos+1 == sizeof(modebuf))) { + modebuf[mode_pos] = 0; + /* -1 in argbuf because of trailing space */ + argbuf[arg_pos-1] = 0; + putsock("%s %s", modebuf, argbuf); + mode_pos = base_mode_pos; + arg_pos = 0; + } + modebuf[mode_pos++] = modes[-1]; + memcpy(argbuf + arg_pos, arg_text, arg_len); + arg_pos += arg_len; + argbuf[arg_pos++] = ' '; + break; + default: + modebuf[mode_pos++] = modes[-1]; + break; + } + } + } + /********************/ /* PROTOCOL HELPERS */ *************** *** 445,449 **** bahamut_new_server(struct server *server) { ! server->proto.clients = dict_new(); } --- 592,597 ---- bahamut_new_server(struct server *server) { ! server->proto = calloc(1, sizeof(*server->proto)); ! server->proto->clients = dict_new(); } *************** *** 462,467 **** { printf("in bahamut_del_server(\"%s\")\n", server->name); ! dict_foreach(server->proto.clients, bahamut_del_server_client, NULL); ! dict_delete(server->proto.clients); } --- 610,615 ---- { printf("in bahamut_del_server(\"%s\")\n", server->name); ! dict_foreach(server->proto->clients, bahamut_del_server_client, NULL); ! dict_delete(server->proto->clients); } *************** *** 469,473 **** bahamut_new_user(struct userNode *user) { ! dict_insert(user->uplink->proto.clients, user->nick, user); return 0; } --- 617,621 ---- bahamut_new_user(struct userNode *user) { ! dict_insert(user->uplink->proto->clients, user->nick, user); return 0; } *************** *** 479,483 **** bahamut_del_user(struct userNode *user) { ! dict_remove(user->uplink->proto.clients, user->nick); } --- 627,631 ---- bahamut_del_user(struct userNode *user) { ! dict_remove(user->uplink->proto->clients, user->nick); } *************** *** 538,542 **** /* burst local nicks */ ! dict_foreach(self->proto.clients, burst_send_nick, 0); } --- 686,690 ---- /* burst local nicks */ ! dict_foreach(self->proto->clients, burst_send_nick, 0); } *************** *** 575,585 **** { struct privmsg_desc *pd = data; 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); } } --- 723,734 ---- { struct privmsg_desc *pd = data; + if (!un->proto) return; 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); } } *************** *** 598,602 **** } else { mcf_size = 8; ! mcf_list = malloc(mcf_size*sizeof(mode_change_func_t)); } } --- 747,751 ---- } else { mcf_size = 8; ! mcf_list = calloc(mcf_size, sizeof(mode_change_func_t)); } } *************** *** 902,909 **** char *ban = argv[next_arg++]; if (add) { ! AddChannelBan(1, &ban, cn, GetUser(argv[-1]), now, 0); if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban); ! } ! else DelChannelBan(1, &ban, cn, NULL, 0); break; } } --- 1051,1059 ---- char *ban = argv[next_arg++]; if (add) { ! ChangeChannelModes(cn, GetUser(argv[-1]), 0, "*+b", ban); if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban); ! } else { ! ChangeChannelModes(cn, GetUser(argv[-1]), 0, "*-b", ban); ! } break; } } *************** *** 1295,1304 **** /* set up privmsg and notice callbacks */ num_privmsg_funcs = 16; ! privmsg_funcs = malloc(sizeof(privmsg_func_t)*num_privmsg_funcs); ! memset(privmsg_funcs, 0, sizeof(privmsg_func_t)*num_privmsg_funcs); num_notice_funcs = 16; ! notice_funcs = malloc(sizeof(privmsg_func_t)*num_notice_funcs); ! memset(notice_funcs, 0, sizeof(privmsg_func_t)*num_notice_funcs); /* register callbacks to us */ --- 1445,1452 ---- /* set up privmsg and notice callbacks */ num_privmsg_funcs = 16; ! privmsg_funcs = calloc(num_privmsg_funcs, sizeof(privmsg_func_t)); num_notice_funcs = 16; ! notice_funcs = calloc(num_notice_funcs, sizeof(privmsg_func_t)); /* register callbacks to us */ *************** *** 1335,1339 **** reg_privmsg_func(struct userNode *user, privmsg_func_t handler) { ! user->proto.privmsg_func = handler; } --- 1483,1488 ---- reg_privmsg_func(struct userNode *user, privmsg_func_t handler) { ! if (!user->proto) user->proto = calloc(1, sizeof(*user->proto)); ! user->proto->privmsg_func = handler; } *************** *** 1341,1345 **** reg_notice_func(struct userNode *user, privmsg_func_t handler) { ! user->proto.notice_func = handler; } --- 1490,1495 ---- reg_notice_func(struct userNode *user, privmsg_func_t handler) { ! if (!user->proto) user->proto = calloc(1, sizeof(*user->proto)); ! user->proto->notice_func = handler; } Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** proto.h 2001/08/29 15:14:40 1.40 --- proto.h 2001/09/18 02:13:09 1.41 *************** *** 138,141 **** --- 138,151 ---- void init_proto(void); struct userNode *add_local_user(const char *nick, const char *ident, const char *hostname, const char *modes, const char *userinfo, time_t timestamp); + /* These next three functions could almost be put in hash.c, + * since they are very similar for each protocol. However, + * it would require exposing the innards of the per-protocol + * fooNode_proto structs to hash.c, and I don't want to do + * that. (In particular, ircu_p10 needs to know the numeric + * when changing chanmode for a user.) + */ + void chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list); + void chan_apply_mode(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, struct userNode **list); + void irc_change_channel_modes(struct chanNode *channel, struct userNode *source, const unsigned char *modes, va_list args); #endif /* !defined(PROTO_H) */ Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -r1.209 -r1.210 *** opserv.c 2001/08/24 20:33:45 1.209 --- opserv.c 2001/09/18 02:13:09 1.210 *************** *** 1628,1632 **** if (getipbyname(scanhost, &addr)) { ! sockcheck_queue_address(addr, scanhost); opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost); } else { --- 1628,1632 ---- if (getipbyname(scanhost, &addr)) { ! sockcheck_queue_address(addr); opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost); } else { *************** *** 1846,1850 **** { if (user->ip) { ! sockcheck_queue_address(htonl(user->ip), intoa(htonl(user->ip))); } return 0; --- 1846,1850 ---- { if (user->ip) { ! sockcheck_queue_address(htonl(user->ip)); } return 0; *************** *** 2964,2968 **** { (void)extra; ! sockcheck_queue_address(match->ip, match->hostname); return 0; } --- 2964,2968 ---- { (void)extra; ! sockcheck_queue_address(match->ip); return 0; } Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -r1.154 -r1.155 *** nickserv.c 2001/08/19 03:06:09 1.154 --- nickserv.c 2001/09/18 02:13:09 1.155 *************** *** 55,58 **** --- 55,59 ---- #include "nickserv.h" #include "policer.h" + #include "proto.h" #include "recdb.h" #include "timeq.h" Index: main.c =================================================================== RCS file: /cvsroot/srvx/services/src/main.c,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -r1.109 -r1.110 *** main.c 2001/08/24 20:33:45 1.109 --- main.c 2001/09/18 02:13:09 1.110 *************** *** 62,65 **** --- 62,66 ---- #include "modules.h" #include "policer.h" + #include "proto.h" #include "recdb.h" #include "timeq.h" Index: helpfile.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** helpfile.c 2001/08/19 03:06:09 1.43 --- helpfile.c 2001/09/18 02:13:09 1.44 *************** *** 267,271 **** va_start(ap, format); ! res = vsend_message(PRIVMSG_TARGET_USER(dest), src, dest->handle_info, 0, NULL, format, ap); va_end(ap); return res; --- 267,271 ---- va_start(ap, format); ! res = vsend_message(dest->nick, src, dest->handle_info, 0, NULL, format, ap); va_end(ap); return res; *************** *** 348,352 **** va_list ap; va_start(ap, format); ! res = vsend_message(PRIVMSG_TARGET_USER(dest), src, dest->handle_info, 0, expand, format, ap); va_end(ap); return res; --- 348,352 ---- va_list ap; va_start(ap, format); ! res = vsend_message(dest->nick, src, dest->handle_info, 0, expand, format, ap); va_end(ap); return res; Index: hash.h =================================================================== RCS file: /cvsroot/srvx/services/src/hash.h,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -r1.68 -r1.69 *** hash.h 2001/08/19 03:06:09 1.68 --- hash.h 2001/09/18 02:13:09 1.69 *************** *** 94,99 **** struct userNode { - struct userNode_proto proto; - unsigned long dead : 1; unsigned long modes; /* user flags +isw etc... */ --- 94,97 ---- *************** *** 109,112 **** --- 107,112 ---- struct modeList channels; + /* from proto */ + struct userNode_proto *proto; /* from nickserv */ struct handle_info *handle_info; *************** *** 119,124 **** struct chanNode { - struct chanNode_proto proto; - char name[CHANNELLEN + 1]; chan_mode_t modes; --- 119,122 ---- *************** *** 138,141 **** --- 136,140 ---- struct chanData *channel_info; + struct channelNode_proto *proto; }; *************** *** 156,160 **** struct server { - struct serverNode_proto proto; time_t boot, link; unsigned int hops, clients, in_burst; --- 155,158 ---- *************** *** 163,166 **** --- 161,165 ---- struct server *uplink; + struct serverNode_proto *proto; struct serverList children; }; *************** *** 209,212 **** --- 208,212 ---- void DelChannel(struct chanNode* channel); + void ChangeChannelModes(struct chanNode *channel, struct userNode *source, const char *modes, ...); struct modeNode *AddChannelUser(struct userNode *user, struct chanNode *channel, int is_burst); Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -r1.142 -r1.143 *** hash.c 2001/08/19 03:06:09 1.142 --- hash.c 2001/09/18 02:13:09 1.143 *************** *** 377,389 **** for (n = 0; n < user->channels.used; n++) { struct modeNode *mn = user->channels.list[n]; ! char modes[128]; irc_join(user, mn->channel); ! switch (mn->modes & (MODE_CHANOP | MODE_VOICE)) { ! case 0: modes[0] = 0; break; ! case MODE_VOICE: snprintf(modes, sizeof(modes), "+v %s", MODE_TARGET_USER(user)); break; ! case MODE_CHANOP: snprintf(modes, sizeof(modes), "+o %s", MODE_TARGET_USER(user)); break; ! case MODE_CHANOP|MODE_VOICE: snprintf(modes, sizeof(modes), "+ov %s %s", MODE_TARGET_USER(user), MODE_TARGET_USER(user)); break; ! } ! if (modes[0]) irc_mode(user, mn->channel, modes); } } --- 377,389 ---- for (n = 0; n < user->channels.used; n++) { struct modeNode *mn = user->channels.list[n]; ! unsigned int pos = 0; ! char modes[16]; ! irc_join(user, mn->channel); ! modes[pos++] = '+'; ! if (mn->modes & MODE_CHANOP) modes[pos++] = 'o'; ! if (mn->modes & MODE_VOICE) modes[pos++] = 'v'; ! modes[pos] = 0; ! if (modes[1]) ChangeChannelModes(mn->channel, user, modes, user, user); } } *************** *** 572,575 **** --- 572,637 ---- } + void + ChangeChannelModes(struct chanNode *channel, struct userNode *source, const char *modes_real, ...) + { + va_list args; + const unsigned char *modes = modes_real; + char *ban_text; + int is_add = 1, bit; + + va_start(args, modes_real); + if (*modes == '*') modes++; + while (*modes) { + switch (*modes++) { + struct userNode *user; + struct modeNode *mn; + case '+': is_add = 1; break; + case '-': is_add = 0; break; + case 'o': + user = va_arg(args, struct userNode *); + if (!(mn = GetUserMode(channel, user))) break; + if (is_add) { + mn->modes |= MODE_CHANOP; + } else { + mn->modes &= ~MODE_CHANOP; + } + break; + case 'v': + user = va_arg(args, struct userNode *); + if (!(mn = GetUserMode(channel, user))) break; + if (is_add) { + mn->modes |= MODE_VOICE; + } else { + mn->modes &= ~MODE_VOICE; + } + break; + case 'b': + ban_text = va_arg(args, char *); + if (is_add) { + AddChannelBan(1, &ban_text, channel, source, now, *modes_real != '*'); + } else { + DelChannelBan(1, &ban_text, channel, source, *modes_real != '*'); + } + break; + default: + bit = channel_inverse_modes[*modes]; + if (bit) { + if (is_add) { + channel->modes |= 1 << (bit - 1); + } else { + channel->modes &= ~(1 << (bit - 1)); + } + } + break; + } + } + va_end(args); + if (modes_real[0] != '*') { + va_start(args, modes_real); + irc_change_channel_modes(channel, source, modes, args); + va_end(args); + } + } + struct modeNode * AddChannelUser(struct userNode *user, struct chanNode *channel, int is_burst) *************** *** 696,771 **** DelChannelUser(victim, channel, 0, 0); - } - - static void - chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list) - { - char buffer[400]; - unsigned int start, i, here_len, queued; - - queued = 0; - start = sizeof(buffer)-1; - buffer[start] = 0; - for (i=0; i<count; i++) { - here_len = strlen(list[i]); - if ((start < queued+here_len+3) || (queued >= MAXMODEPARAMS)) { - while (queued) { - buffer[--start] = what[1]; - queued--; - } - buffer[--start] = what[0]; - irc_mode(who, channel, buffer+start); - start = sizeof(buffer)-1; - } - start -= here_len; - memcpy(buffer+start, list[i], here_len); /* omit terminator */ - buffer[--start] = ' '; - queued++; - } - if (queued) { - while (queued) { - buffer[--start] = what[1]; - queued--; - } - buffer[--start] = what[0]; - irc_mode(who, channel, buffer+start); - start = sizeof(buffer)-1; - } - } - - static void - chan_apply_mode(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, struct userNode **list) - { - char buffer[400]; - unsigned int start, i, queued, len; - queued = 0; - start = sizeof(buffer)-1; - buffer[start] = 0; - - for (i=0; i<count; i++) { - len = strlen(MODE_TARGET_USER(list[i])); - if ((start < queued+3+len) || (queued >= MAXMODEPARAMS)) { - while (queued) { - buffer[--start] = what[1]; - queued--; - } - buffer[--start] = what[0]; - irc_mode(who, channel, buffer+start); - start = sizeof(buffer)-1; - } - start -= len; - memcpy(buffer+start, MODE_TARGET_USER(list[i]), len); - buffer[--start] = ' '; - queued++; - } - if (queued) { - while (queued) { - buffer[--start] = what[1]; - queued--; - } - buffer[--start] = what[0]; - irc_mode(who, channel, buffer+start); - start = sizeof(buffer)-1; - } } --- 758,761 ---- Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** global.c 2001/08/19 03:06:09 1.35 --- global.c 2001/09/18 02:13:09 1.36 *************** *** 51,54 **** --- 51,55 ---- #include "nickserv.h" #include "policer.h" + #include "proto.h" #include "recdb.h" #include "timeq.h" *************** *** 359,363 **** } ! #define notice_user(USER, MESSAGE) notice_target(PRIVMSG_TARGET_USER(USER), MESSAGE) static int --- 360,364 ---- } ! #define notice_user(USER, MESSAGE) notice_target((USER)->nick, MESSAGE) static int Index: common.h =================================================================== RCS file: /cvsroot/srvx/services/src/common.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -r1.66 -r1.67 *** common.h 2001/08/19 03:06:09 1.66 --- common.h 2001/09/18 02:13:09 1.67 *************** *** 62,65 **** --- 62,68 ---- #endif + #define MAXLEN 512 + #define MAXNUMPARAMS 200 + #define ArrayLength(x) (sizeof(x)/sizeof(x[0])) #define safestrncpy(dest, src, len) do { char *d = (dest); unsigned int l = (len); strncpy(d, (src), l); d[l-1] = 0; } while (0) Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -r1.182 -r1.183 *** chanserv.c 2001/08/29 15:14:40 1.182 --- chanserv.c 2001/09/18 02:13:09 1.183 *************** *** 1723,1726 **** --- 1723,1727 ---- } + #if CHANSERV_JOINS_CHANNELS static CHANSERV_FUNC(cmd_opchan) { *************** *** 1735,1738 **** --- 1736,1740 ---- return 1; } + #endif static int *************** *** 2044,2048 **** static CHANSERV_FUNC(cmd_down) { - char *change; struct modeNode *mn; (void)argv;(void)argc; --- 2046,2049 ---- *************** *** 2061,2071 **** } ! DelChannelOp(1, &user, channel, channel->channel_info->bot, 0); ! DelChannelVoice(1, &user, channel, channel->channel_info->bot, 0); ! ! change = alloca(6 + 2*strlen(MODE_TARGET_USER(user))); ! sprintf(change, "-ov %s %s", MODE_TARGET_USER(user), MODE_TARGET_USER(user)); ! irc_mode(channel->channel_info->bot, channel, change); ! return 1; } --- 2062,2066 ---- } ! ChangeChannelModes(channel, channel->channel_info->bot, "-ov", user, user); return 1; } *************** *** 4591,4595 **** sprintf(info, "[%s] %s", user->nick, uData->info); ! irc_privmsg(channel->channel_info->bot, PRIVMSG_TARGET_CHANNEL(channel), info); } --- 4586,4590 ---- sprintf(info, "[%s] %s", user->nick, uData->info); ! irc_privmsg(channel->channel_info->bot, channel->name, info); } *************** *** 4801,4813 **** if(protect_user(victim, user, channel->channel_info)) { ! char *change; ! ! DelChannelOp(1, &user, channel, channel->channel_info->bot, 0); ! AddChannelOp(1, &victim, channel, channel->channel_info->bot, 0); ! ! change = alloca(7+2*strlen(MODE_TARGET_USER(victim))); ! sprintf(change, "+o-o %s %s", MODE_TARGET_USER(victim), MODE_TARGET_USER(user)); ! ! irc_mode(channel->channel_info->bot, channel, change); chanserv_notice(user, CSMSG_USER_PROTECTED, victim->nick); } --- 4796,4800 ---- if(protect_user(victim, user, channel->channel_info)) { ! ChangeChannelModes(channel, channel->channel_info->bot, "+o-o", victim, user); chanserv_notice(user, CSMSG_USER_PROTECTED, victim->nick); } *************** *** 6091,6095 **** oldcs = GetUser(chanserv_conf.old_chanserv_name); if (oldcs) { ! irc_privmsg(chanserv, PRIVMSG_TARGET_USER(oldcs), text); } else { log(CS_LOG, LOG_ERROR, "Could not find user %s to privmsg!\n", chanserv_conf.old_chanserv_name); --- 6078,6082 ---- oldcs = GetUser(chanserv_conf.old_chanserv_name); if (oldcs) { ! irc_privmsg(chanserv, oldcs->nick, text); } else { log(CS_LOG, LOG_ERROR, "Could not find user %s to privmsg!\n", chanserv_conf.old_chanserv_name); |
From: Entrope <en...@us...> - 2001-09-10 19:37:33
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv5789 Modified Files: TODO Log Message: update TODO list for 1.1 release Index: TODO =================================================================== RCS file: /cvsroot/srvx/services/TODO,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -r1.66 -r1.67 *** TODO 2001/07/26 14:28:28 1.66 --- TODO 2001/09/10 19:37:30 1.67 *************** *** 4,37 **** (Pre-1.0-release items should go into TODO on the rel-1_0 branch, not here.) ! FOR 1.2 RELEASE --------------- ! Core code: Command weighting changes for all services - allow weights to be modified (all services but ChanServ) and saved (Global, NickServ). ! Use ircu-like glob matching functions - glob comparisons, glob collapsing, ! and compiled globs. Compiled globs could be used in trace, log searches, ! ChanServ permanent bans. Could go in its own file, match.c. Better host mask generation. Could be hard coded for certain ISP's ! (home.com) or use a database. At the minimum, turn strings of ! numbers (e.g. dialup123.pool123.isp.com) into wildcards (dialup*.pool*.isp.com). - Add a flexible ACL system (to limit using powers like handle +h). - Update proto_ircu2_p10.c to always pass command name to cmd_* functions in argv[0], with argv[-1] containing either NULL or the source. (This makes parsing rather easier, and is already done in proto_bahamut.c) ! Modules: ! General cleanup. ! ! Make sure module commands don't conflict with built in commands. ! Improve dependency support if possible. ! Update helpfile to reflect module support. [Un/Re]Loadall commands need to be added, and all modules present in the --- 4,41 ---- (Pre-1.0-release items should go into TODO on the rel-1_0 branch, not here.) ! FOR 1.1 RELEASE --------------- ! Command parsing/interpreting: Command weighting changes for all services - allow weights to be modified (all services but ChanServ) and saved (Global, NickServ). + + Add a flexible ACL system (to limit using powers like handle +h). + + Freeform aliasing. ! Allow commands to be visible/executable by several bots. + (All of these can be implemented in a new command parser and + rule/ACL architecture.) + + Core code: Better host mask generation. Could be hard coded for certain ISP's ! (home.com) or use a database. At a minimum, turn strings of ! numbers (such as dialup123.pool123.isp.com) into wildcards (dialup*.pool*.isp.com). Update proto_ircu2_p10.c to always pass command name to cmd_* functions in argv[0], with argv[-1] containing either NULL or the source. (This makes parsing rather easier, and is already done in proto_bahamut.c) ! Deprecate general use of irc_mode directly from services. Instead, ! add a varadic function to hash.c that can op/deop/etc. channel users ! "intelligently" based on the mode change string. ! DCC/telnet interface support (or straight IRC support :).. ! Modules: ! Improve dependency support and how modules work. [Un/Re]Loadall commands need to be added, and all modules present in the *************** *** 39,51 **** similar to _startup, yes/no/1/0 etc. - Clean up module_info macro, and make sure calls to it send appropriate - size instead of just 255. - - Make aliases more compatible with the module code. (?) - Make module meta-information part of the module, rather than an external file. ! A lot of hardcore testing! :) ChanServ: --- 43,50 ---- similar to _startup, yes/no/1/0 etc. Make module meta-information part of the module, rather than an external file. ! Modularize the services. ChanServ: *************** *** 54,82 **** More criteria for channel searches. - Implement some commands like !userinfo and !handleinfo for in-channel use. - Per-channel notes, like web page or problem history. Allow info lines to be modified by owners/helpers/opers. - ChanServ reportedly sends info lines for people who quit, then - reconnect, auth, and rejoin a channel. - Make ChanServ show infolines if somebody parts the channel after doing a setinfo (but not if they, say, ping out or otherwise QUIT). - Allow accounts in a channel to be suspended for a time. - More sanity checks. For example, don't invite a user if they are already in the channel. - - Bot management. ! Complete the user flags system. ! NickServ: ! Allow people to auth if a hostmask matches their current IP, even if their ! hostname in IRC is name-resolved. (Requires adding the by-IP hostmask ! when they register.) HelpServ: --- 53,72 ---- More criteria for channel searches. Per-channel notes, like web page or problem history. Allow info lines to be modified by owners/helpers/opers. Make ChanServ show infolines if somebody parts the channel after doing a setinfo (but not if they, say, ping out or otherwise QUIT). More sanity checks. For example, don't invite a user if they are already in the channel. ! Complete the user flags system (specifically, !togop and account ! suspension, which are set on a <user,channel> basis). ! OpServ: ! Improve the set command. Let it create keys, and modify objects and ! stringlists. HelpServ: *************** *** 86,116 **** help). ! AFTER 1.0 (maybe after 1.2) RELEASE ! ----------------------------------- Core code: - (maybe) Freeform aliasing. It would be nice (though not necessary) - to be able to do complete aliasing, IRC client style. For example, - "alias OpServ dill gline $1 86400 DiLL is my bitch." - Reintroduce killed +k users in a sane, flood controlled fashion if possible. ! DCC/telnet interface support (or straight IRC support :).. ! For things like voice/devoice/op/deop/unban, change from using array of ! strings to array of bits (to prevent looking up strings twice in the ! lists). ! ! Allow for the stacking of arbitrary combinations of modes, including ! channel modes, op/deop, and ban. NickServ: (Configurable) Temporary auto-gag for someone trying to guess a password. - OpServ: - Improve the set command. Let it create keys, and modify objects and - stringlists. - Global: Use Global to announce everything from flood notices, alerts, --- 76,94 ---- help). ! AFTER 1.1 RELEASE ! ----------------- Core code: Reintroduce killed +k users in a sane, flood controlled fashion if possible. ! Database journalling, to reduce data loss. ! ChanServ: ! Make it easy to rename channel access levels. NickServ: (Configurable) Temporary auto-gag for someone trying to guess a password. Global: Use Global to announce everything from flood notices, alerts, *************** *** 120,126 **** Allow target definition based on arbitrary combinations of specific users, channels, and basic built-in targets such as "ircops" or "helpers". - - IPC interface: - Define and implement. Documentation: --- 98,101 ---- |
From: Entrope <en...@us...> - 2001-09-10 19:29:50
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv3737/src Modified Files: saxdb.c Log Message: clean up compile under gcc-3.0 Index: saxdb.c =================================================================== RCS file: /cvsroot/srvx/services/src/saxdb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** saxdb.c 2001/08/01 22:14:35 1.1 --- saxdb.c 2001/09/10 19:29:47 1.2 *************** *** 30,42 **** #if HAVE_GETC_UNLOCKED ! #undef getc(STR) #define getc(STR) getc_unlocked(STR) #endif #if HAVE_PUTC_UNLOCKED ! #undef putc(STR) #define putc(CHR,STR) putc_unlocked(CHR,STR) #endif #if HAVE_FEOF_UNLOCKED ! #undef feof(STR) #define feof(STR) feof_unlocked(STR) #endif --- 30,42 ---- #if HAVE_GETC_UNLOCKED ! #undef getc #define getc(STR) getc_unlocked(STR) #endif #if HAVE_PUTC_UNLOCKED ! #undef putc #define putc(CHR,STR) putc_unlocked(CHR,STR) #endif #if HAVE_FEOF_UNLOCKED ! #undef feof #define feof(STR) feof_unlocked(STR) #endif |
From: Entrope <en...@us...> - 2001-09-10 19:17:15
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv495 Modified Files: Tag: rel-1_0 Makefile.am Log Message: fix build when $(builddir) != $(srcdir) Index: Makefile.am =================================================================== RCS file: /cvsroot/srvx/services/Makefile.am,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -C2 -r1.9.2.4 -r1.9.2.5 *** Makefile.am 2001/08/26 03:43:35 1.9.2.4 --- Makefile.am 2001/09/10 19:17:10 1.9.2.5 *************** *** 8,23 **** srvx: src/srvx ! cp src/srvx src/*.help . install-exec-local: $(INSTALL) -d -m 755 $(prefix) ! $(INSTALL) -m 744 src/srvx $(prefix) ! $(INSTALL) -m 644 src/*.help $(prefix) ! $(INSTALL) -m 600 srvx.conf.example $(prefix) ! $(INSTALL) -m 644 sockcheck.db.example $(prefix) ! mv $(prefix)/bin/srvx $(prefix) @echo @echo srvx-$(VERSION) has been installed to $(prefix) @echo Remember to edit srvx.conf.example and sockcheck.db.example ! @echo And of course, bin/srvx --help before starting. @echo --- 8,22 ---- srvx: src/srvx ! cp ./src/srvx $(srcdir)/src/*.help . install-exec-local: $(INSTALL) -d -m 755 $(prefix) ! $(INSTALL) -m 744 ./src/srvx $(prefix) ! $(INSTALL) -m 644 $(srcdir)/src/*.help $(prefix) ! $(INSTALL) -m 600 $(srcdir)/srvx.conf.example $(prefix) ! $(INSTALL) -m 644 $(srcdir)/sockcheck.db.example $(prefix) @echo @echo srvx-$(VERSION) has been installed to $(prefix) @echo Remember to edit srvx.conf.example and sockcheck.db.example ! @echo And of course, ./srvx --help before starting. @echo |
From: Entrope <en...@us...> - 2001-09-10 19:11:52
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv31490/src Modified Files: Tag: rel-1_0 common.h opserv.c sockcheck.c sockcheck.h tools.c Log Message: nuke second parameter to sockcheck_queue_address, and intoa() which was used for it Index: common.h =================================================================== RCS file: /cvsroot/srvx/services/src/common.h,v retrieving revision 1.60.2.9 retrieving revision 1.60.2.10 diff -C2 -r1.60.2.9 -r1.60.2.10 *** common.h 2001/09/04 18:19:47 1.60.2.9 --- common.h 2001/09/10 19:11:49 1.60.2.10 *************** *** 178,182 **** void intervalString(char *output, time_t interval); int getipbyname(const char *name, unsigned long *ip); - char *intoa(unsigned long addr); const char * preposition(char *word); --- 178,181 ---- Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.187.2.54 retrieving revision 1.187.2.55 diff -C2 -r1.187.2.54 -r1.187.2.55 *** opserv.c 2001/09/05 05:36:48 1.187.2.54 --- opserv.c 2001/09/10 19:11:49 1.187.2.55 *************** *** 1703,1707 **** if (getipbyname(scanhost, &addr)) { ! sockcheck_queue_address(addr, scanhost); opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost); } else { --- 1703,1707 ---- if (getipbyname(scanhost, &addr)) { ! sockcheck_queue_address(addr); opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost); } else { *************** *** 1943,1947 **** { if (user->ip) { ! sockcheck_queue_address(htonl(user->ip), intoa(htonl(user->ip))); } return 0; --- 1943,1947 ---- { if (user->ip) { ! sockcheck_queue_address(htonl(user->ip)); } return 0; *************** *** 3065,3069 **** { (void)extra; ! sockcheck_queue_address(match->ip, match->hostname); return 0; } --- 3065,3069 ---- { (void)extra; ! sockcheck_queue_address(match->ip); return 0; } Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.54.2.28 retrieving revision 1.54.2.29 diff -C2 -r1.54.2.28 -r1.54.2.29 *** sockcheck.c 2001/09/08 18:32:08 1.54.2.28 --- sockcheck.c 2001/09/10 19:11:49 1.54.2.29 *************** *** 230,238 **** void ! sockcheck_queue_address(unsigned long addr, const char *name) { sockcheck_cache_info sci; if (disable_sockcheck) return; if (pending_ip_pipe[1] == -1) return; /* something went wrong in worker */ if (pthread_mutex_lock(&checked_ip_mutex)) { /* lock failure; this usually means coding error */ --- 230,242 ---- void ! sockcheck_queue_address(unsigned long addr) { sockcheck_cache_info sci; + unsigned char buff[17], *name; + if (disable_sockcheck) return; if (pending_ip_pipe[1] == -1) return; /* something went wrong in worker */ + name = buff + 1; + snprintf(name, sizeof(buff)-1, "%ld.%ld.%ld.%ld", (addr >> 24) & 255, (addr >> 16) & 255, (addr >> 8) & 255, (addr >> 0) & 255); if (pthread_mutex_lock(&checked_ip_mutex)) { /* lock failure; this usually means coding error */ *************** *** 246,253 **** if (sci->decision == REJECT) sockcheck_issue_gline(sci); } else { ! int namelen = strlen(name) + 1; ! unsigned char *buff = alloca(namelen); buff[0] = namelen; - memcpy(buff+1, name, namelen - 1); if (!sci) { sci = malloc(sizeof(*sci) + namelen); --- 250,255 ---- if (sci->decision == REJECT) sockcheck_issue_gline(sci); } else { ! int namelen = strlen(name) + 1; buff[0] = namelen; if (!sci) { sci = malloc(sizeof(*sci) + namelen); *************** *** 258,265 **** memcpy(sci->hostname, name, namelen); dict_insert(checked_ip_dict, sci->hostname, sci); - } else { - sci->addr = addr; } ! if (write(pending_ip_pipe[1], buff, namelen) < namelen) { log(PC_LOG, LOG_ERROR, "Error: write(pending_ip_pipe[1]) returned errno %d (%s)\n", errno, strerror(errno)); } --- 260,265 ---- memcpy(sci->hostname, name, namelen); dict_insert(checked_ip_dict, sci->hostname, sci); } ! if (write(pending_ip_pipe[1], name, namelen) < namelen) { log(PC_LOG, LOG_ERROR, "Error: write(pending_ip_pipe[1]) returned errno %d (%s)\n", errno, strerror(errno)); } Index: sockcheck.h =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.h,v retrieving revision 1.6.4.2 retrieving revision 1.6.4.3 diff -C2 -r1.6.4.2 -r1.6.4.3 *** sockcheck.h 2001/08/18 02:24:13 1.6.4.2 --- sockcheck.h 2001/09/10 19:11:49 1.6.4.3 *************** *** 34,38 **** void sockcheck_init(void); const char *sockcheck_add_test(const char *desc); ! void sockcheck_queue_address(unsigned long addr, const char *name); int sockcheck_uncache_host(const char *name); void sockcheck_get_stats(struct sockcheck_stats *stats); --- 34,38 ---- void sockcheck_init(void); const char *sockcheck_add_test(const char *desc); ! void sockcheck_queue_address(unsigned long addr); int sockcheck_uncache_host(const char *name); void sockcheck_get_stats(struct sockcheck_stats *stats); Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.73.2.26 retrieving revision 1.73.2.27 diff -C2 -r1.73.2.26 -r1.73.2.27 *** tools.c 2001/08/16 03:15:52 1.73.2.26 --- tools.c 2001/09/10 19:11:49 1.73.2.27 *************** *** 907,915 **** strcpy(buf->list+from, repl); } - - char *intoa(unsigned long addr) { - struct in_addr in; - - in.s_addr = addr; - return inet_ntoa(in); - } --- 907,908 ---- |
From: Entrope <en...@us...> - 2001-09-08 18:32:12
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv6816/src Modified Files: Tag: rel-1_0 sockcheck.c Log Message: remove unnecessary log from sockcheck Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.54.2.27 retrieving revision 1.54.2.28 diff -C2 -r1.54.2.27 -r1.54.2.28 *** sockcheck.c 2001/08/25 20:56:39 1.54.2.27 --- sockcheck.c 2001/09/08 18:32:08 1.54.2.28 *************** *** 768,772 **** /* disconnected -- next test! */ close(poller->fd); - log(PC_LOG, LOG_ERROR, "Client %s gave us a POLLHUP on fd %d\n", client->addr->hostname, poller->fd); goto next_test; } else if (poller->revents & (POLLOUT|POLLIN)) { --- 768,771 ---- |
From: Entrope <en...@us...> - 2001-09-05 05:37:22
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv7875 Modified Files: Tag: rel-1_0 configure.in Log Message: always define _THREAD_SAFE Index: configure.in =================================================================== RCS file: /cvsroot/srvx/services/Attic/configure.in,v retrieving revision 1.39.2.17 retrieving revision 1.39.2.18 diff -C2 -r1.39.2.17 -r1.39.2.18 *** configure.in 2001/08/26 03:43:35 1.39.2.17 --- configure.in 2001/09/05 05:37:19 1.39.2.18 *************** *** 29,33 **** case $target in *-freebsd2* | *-freebsdelf2* | *-freebsd*out3*) - EXTRA_DEFINE="-D_THREAD_SAFE" ANSI_SRC="-ansi" ;; --- 29,32 ---- *************** *** 37,43 **** ANSI_SRC="-ansi" ;; - *-bsdi*) - ANSI_SRC="" - ;; *-solaris*) EXTRA_DEFINE="-D__SOLARIS__" --- 36,39 ---- *************** *** 54,58 **** ;; esac ! CFLAGS="$CFLAGS -D_BSD_SOURCE -D_REENTRANT $EXTRA_DEFINE" dnl Checks for libraries. --- 50,54 ---- ;; esac ! CFLAGS="$CFLAGS -D_BSD_SOURCE -D_THREAD_SAFE -D_REENTRANT $EXTRA_DEFINE" dnl Checks for libraries. |
From: Entrope <en...@us...> - 2001-09-05 05:36:51
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv7757/src Modified Files: Tag: rel-1_0 opserv.c Log Message: FreeBSD compile fix/cleanup Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.187.2.53 retrieving revision 1.187.2.54 diff -C2 -r1.187.2.53 -r1.187.2.54 *** opserv.c 2001/09/04 21:28:40 1.187.2.53 --- opserv.c 2001/09/05 05:36:48 1.187.2.54 *************** *** 26,30 **** --- 26,35 ---- #include <errno.h> #endif + #ifdef HAVE_LIMITS_H #include <limits.h> + #endif + #ifdef HAVE_SYS_TYPES_H + #include <sys/types.h> + #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> |
From: Entrope <en...@us...> - 2001-09-05 04:43:12
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv30588/src Modified Files: Tag: rel-1_0 nickserv.c Log Message: sigh, fix right message Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.138.2.46 retrieving revision 1.138.2.47 diff -C2 -r1.138.2.46 -r1.138.2.47 *** nickserv.c 2001/09/05 04:10:02 1.138.2.46 --- nickserv.c 2001/09/05 04:43:09 1.138.2.47 *************** *** 125,130 **** #define NSMSG_HANDLE_SUSPENDED "Your $N handle has been suspended." #define NSMSG_AUTH_SUCCESS "I recognize you." ! #define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to handle $b%s$b by typing $b/msg $n auth %s password$b (using your password)." ! #define NSMSG_AUTH_ALLOWED_MSG "You may now authenticate to handle $b%s$b." #define NSMSG_AUTH_NORMAL_ONLY "User $b%s$b may now only authenticate to handles with matching hostmasks." #define NSMSG_AUTH_UNSPECIAL "User $b%s$b did not have any special auth allowance." --- 125,130 ---- #define NSMSG_HANDLE_SUSPENDED "Your $N handle has been suspended." #define NSMSG_AUTH_SUCCESS "I recognize you." ! #define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to handle $b%s$b." ! #define NSMSG_AUTH_ALLOWED_MSG "You may now authenticate to handle $b%s$b by typing $b/msg $n auth %s password$b (using your password)." #define NSMSG_AUTH_NORMAL_ONLY "User $b%s$b may now only authenticate to handles with matching hostmasks." #define NSMSG_AUTH_UNSPECIAL "User $b%s$b did not have any special auth allowance." |
From: Entrope <en...@us...> - 2001-09-05 04:10:05
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv24535/src Modified Files: Tag: rel-1_0 nickserv.c Log Message: improve help message after allowauth Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.138.2.45 retrieving revision 1.138.2.46 diff -C2 -r1.138.2.45 -r1.138.2.46 *** nickserv.c 2001/09/04 18:37:05 1.138.2.45 --- nickserv.c 2001/09/05 04:10:02 1.138.2.46 *************** *** 125,129 **** #define NSMSG_HANDLE_SUSPENDED "Your $N handle has been suspended." #define NSMSG_AUTH_SUCCESS "I recognize you." ! #define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to handle $b%s$b." #define NSMSG_AUTH_ALLOWED_MSG "You may now authenticate to handle $b%s$b." #define NSMSG_AUTH_NORMAL_ONLY "User $b%s$b may now only authenticate to handles with matching hostmasks." --- 125,129 ---- #define NSMSG_HANDLE_SUSPENDED "Your $N handle has been suspended." #define NSMSG_AUTH_SUCCESS "I recognize you." ! #define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to handle $b%s$b by typing $b/msg $n auth %s password$b (using your password)." #define NSMSG_AUTH_ALLOWED_MSG "You may now authenticate to handle $b%s$b." #define NSMSG_AUTH_NORMAL_ONLY "User $b%s$b may now only authenticate to handles with matching hostmasks." *************** *** 1031,1035 **** dict_insert(nickserv_allow_auth_dict, strdup(target->nick), hi); nickserv_notice(user, NSMSG_AUTH_ALLOWED, target->nick, hi->handle); ! nickserv_notice(target, NSMSG_AUTH_ALLOWED_MSG, hi->handle); log(NS_LOG, LOG_INFO, "%s allowed "IDENT_FORMAT" to authenticate to handle '%s'.\n", user->handle_info->handle, IDENT_DATA(target), hi->handle); } else { --- 1031,1035 ---- dict_insert(nickserv_allow_auth_dict, strdup(target->nick), hi); nickserv_notice(user, NSMSG_AUTH_ALLOWED, target->nick, hi->handle); ! nickserv_notice(target, NSMSG_AUTH_ALLOWED_MSG, hi->handle, hi->handle); log(NS_LOG, LOG_INFO, "%s allowed "IDENT_FORMAT" to authenticate to handle '%s'.\n", user->handle_info->handle, IDENT_DATA(target), hi->handle); } else { |
From: Entrope <en...@us...> - 2001-09-05 04:04:04
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv23097/src Modified Files: Tag: rel-1_0 main.c Log Message: compile fix for FreeBSD Index: main.c =================================================================== RCS file: /cvsroot/srvx/services/src/main.c,v retrieving revision 1.94.2.13 retrieving revision 1.94.2.14 diff -C2 -r1.94.2.13 -r1.94.2.14 *** main.c 2001/09/04 18:20:51 1.94.2.13 --- main.c 2001/09/05 04:04:01 1.94.2.14 *************** *** 54,57 **** --- 54,60 ---- #include <netinet/in.h> #endif + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> + #endif #include "common.h" |
From: Entrope <en...@us...> - 2001-09-04 21:30:22
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv3347/src Modified Files: Tag: rel-1_0 hash.c parse.c Log Message: use num_local instead of recalculating numerics everywhere Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.121.2.14 retrieving revision 1.121.2.15 diff -C2 -r1.121.2.14 -r1.121.2.15 *** hash.c 2001/09/04 18:39:36 1.121.2.14 --- hash.c 2001/09/04 21:30:19 1.121.2.15 *************** *** 407,411 **** pol_params = IsOper(uNode) ? oper_policer_params : luser_policer_params; uNode->command_policer = policer_new(pol_params, uNode->timestamp); ! uNode->num_local = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); /* insert into global nick dictionary */ --- 407,411 ---- pol_params = IsOper(uNode) ? oper_policer_params : luser_policer_params; uNode->command_policer = policer_new(pol_params, uNode->timestamp); ! uNode->num_local = base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN) & uNode->uplink->num_mask; /* insert into global nick dictionary */ *************** *** 416,420 **** } ! GetServer(numeric)->users[base64toint(numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN) & uplink->num_mask]=uNode; if (IsLocal(numeric)) irc_user(uNode); --- 416,420 ---- } ! GetServer(numeric)->users[uNode->num_local]=uNode; if (IsLocal(numeric)) irc_user(uNode); *************** *** 439,443 **** user->uplink->clients--; ! user->uplink->users[base64toint(user->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN) & user->uplink->num_mask] = NULL; if (IsOper(user)) userList_remove(&curr_opers, user); /* remove from global dictionary */ --- 439,443 ---- user->uplink->clients--; ! user->uplink->users[user->num_local] = NULL; if (IsOper(user)) userList_remove(&curr_opers, user); /* remove from global dictionary */ Index: parse.c =================================================================== RCS file: /cvsroot/srvx/services/src/Attic/parse.c,v retrieving revision 1.113.2.17 retrieving revision 1.113.2.18 diff -C2 -r1.113.2.17 -r1.113.2.18 *** parse.c 2001/09/04 18:39:36 1.113.2.17 --- parse.c 2001/09/04 21:30:19 1.113.2.18 *************** *** 674,678 **** { struct privmsg_desc *pd = data; ! int num = base64toint(un->numeric+SERVER_NUMERIC_LEN, USER_NUMERIC_LEN); if (!pd->is_notice) { if (privmsg_funcs[num]) { --- 674,678 ---- { struct privmsg_desc *pd = data; ! int num = un->num_local; if (!pd->is_notice) { if (privmsg_funcs[num]) { |
From: Entrope <en...@us...> - 2001-09-04 21:28:43
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv2742/src Modified Files: Tag: rel-1_0 opserv.c Log Message: include unix time version of channel creation timestamps Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.187.2.52 retrieving revision 1.187.2.53 diff -C2 -r1.187.2.52 -r1.187.2.53 *** opserv.c 2001/09/04 18:20:51 1.187.2.52 --- opserv.c 2001/09/04 21:28:40 1.187.2.53 *************** *** 548,552 **** opserv_notice(user, "%s Statistics", channel->name); strftime(buffer, sizeof(buffer), "Created on: %a %b %d %H:%M:%S %Y", localtime(&channel->timestamp)); ! opserv_notice(user, "%s", buffer); strcpy(buffer, "Modes: "); irc_make_chanmode(channel, buffer+strlen(buffer)); --- 548,552 ---- opserv_notice(user, "%s Statistics", channel->name); strftime(buffer, sizeof(buffer), "Created on: %a %b %d %H:%M:%S %Y", localtime(&channel->timestamp)); ! opserv_notice(user, "%s ("FMT_TIME_T")", buffer, channel->timestamp); strcpy(buffer, "Modes: "); irc_make_chanmode(channel, buffer+strlen(buffer)); |
From: Entrope <en...@us...> - 2001-09-04 18:39:38
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv21250/src Modified Files: Tag: rel-1_0 hash.c hash.h parse.c Log Message: add nick change callback functions when handling remote JOINs and other crazy channels, inherit timestamp from next MODE change Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.121.2.13 retrieving revision 1.121.2.14 diff -C2 -r1.121.2.13 -r1.121.2.14 *** hash.c 2001/08/04 15:34:25 1.121.2.13 --- hash.c 2001/09/04 18:39:36 1.121.2.14 *************** *** 307,310 **** --- 307,329 ---- } + static nick_change_func_t *ncf2_list; + static unsigned int ncf2_size = 0, ncf2_used = 0; + + void + reg_nick_change_func(nick_change_func_t handler) + { + if (ncf2_used == ncf2_size) { + if (ncf2_size) { + ncf2_size <<= 1; + ncf2_list = realloc(ncf2_list, ncf2_size*sizeof(nick_change_func_t)); + } else { + ncf2_size = 8; + ncf2_list = malloc(ncf2_size*sizeof(nick_change_func_t)); + } + } + ncf2_list[ncf2_used++] = handler; + } + + static del_user_func_t *duf_list; static unsigned int duf_size = 0, duf_used = 0; *************** *** 473,476 **** --- 492,498 ---- void NickChange(userNode* user, const char *new_nick) { + char old_nick[NICKLEN+1]; + unsigned int nn; + /* don't do anything if there's no change */ if (!strncmp(new_nick, user->nick, NICKLEN)) return; *************** *** 479,482 **** --- 501,507 ---- dict_remove(clients, user->nick); + /* save old nick for callbacks */ + safestrncpy(old_nick, user->nick, sizeof(old_nick)); + /* copy new nick */ safestrncpy(user->nick, new_nick, sizeof(user->nick)); *************** *** 486,489 **** --- 511,519 ---- if (IsLocal(user->numeric)) irc_nick(user); + + /* make callbacks */ + for (nn=0; nn<ncf2_used; nn++) { + ncf2_list[nn](user, old_nick); + } } *************** *** 644,648 **** mod_chanmode(cNode, modes, (char *)key, limit); ! if (new || cNode->timestamp > time_) { if (key) { safestrncpy(cNode->key, key, sizeof(cNode->key)); --- 674,678 ---- mod_chanmode(cNode, modes, (char *)key, limit); ! if (new || (cNode->timestamp == 0) || (cNode->timestamp > time_)) { if (key) { safestrncpy(cNode->key, key, sizeof(cNode->key)); Index: hash.h =================================================================== RCS file: /cvsroot/srvx/services/src/hash.h,v retrieving revision 1.52.2.9 retrieving revision 1.52.2.10 diff -C2 -r1.52.2.9 -r1.52.2.10 *** hash.h 2001/08/04 14:14:45 1.52.2.9 --- hash.h 2001/09/04 18:39:36 1.52.2.10 *************** *** 190,193 **** --- 190,195 ---- void DelUser(userNode* user, userNode *killer, int announce, const char *why); void ReintroduceUser(userNode* user); + typedef void (*nick_change_func_t)(struct userNode *user, const char *oldnick); + void reg_nick_change_func(nick_change_func_t handler); void NickChange(userNode* user, const char *new_nick); Index: parse.c =================================================================== RCS file: /cvsroot/srvx/services/src/Attic/parse.c,v retrieving revision 1.113.2.16 retrieving revision 1.113.2.17 diff -C2 -r1.113.2.16 -r1.113.2.17 *** parse.c 2001/08/16 02:39:18 1.113.2.16 --- parse.c 2001/09/04 18:39:36 1.113.2.17 *************** *** 576,580 **** struct userNode *un = data; struct chanNode *cn; ! cn = AddChannel(name, now, "", "", 0, un->numeric, NULL); if (cn->members.used == 1) { struct modeNode *mn = GetUserMode(cn, un); --- 576,580 ---- struct userNode *un = data; struct chanNode *cn; ! cn = AddChannel(name, 0, "", "", 0, un->numeric, NULL); if (cn->members.used == 1) { struct modeNode *mn = GetUserMode(cn, un); |
From: Entrope <en...@us...> - 2001-09-04 18:37:09
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv20549/src Modified Files: Tag: rel-1_0 nickserv.c Log Message: don't log auth attempts for non-existent handles Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.138.2.44 retrieving revision 1.138.2.45 diff -C2 -r1.138.2.44 -r1.138.2.45 *** nickserv.c 2001/08/22 04:28:24 1.138.2.44 --- nickserv.c 2001/09/04 18:37:05 1.138.2.45 *************** *** 976,980 **** if (!hi) { nickserv_notice(user, NSMSG_HANDLE_NOT_FOUND); - log(NS_LOG, LOG_OTHER, IDENT_FORMAT" tried to authenticate to a nonexistent handle.\n", IDENT_DATA(user)); return 0; } --- 976,979 ---- |
From: Entrope <en...@us...> - 2001-09-04 18:35:58
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv20319/src Modified Files: Tag: rel-1_0 chanserv.c Log Message: be more careful dereferencing pointers voice users in channel userlists when they auth (if they don't get ops) Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.161.2.82 retrieving revision 1.161.2.83 diff -C2 -r1.161.2.82 -r1.161.2.83 *** chanserv.c 2001/09/02 06:52:04 1.161.2.82 --- chanserv.c 2001/09/04 18:35:55 1.161.2.83 *************** *** 4655,4660 **** for(channel = user->handle_info->channels; channel; channel = channel->next) { ! struct chanNode *cn = channel->channel->channel; ! if(!cn || IsSuspended(channel->channel) || !GetUserMode(cn, user)) continue; if(channel->user->access >= ulMaster) --- 4655,4660 ---- for(channel = user->handle_info->channels; channel; channel = channel->next) { ! struct chanNode *cn; ! if(IsSuspended(channel->channel) || !(cn = channel->channel->channel) || !GetUserMode(cn, user)) continue; if(channel->user->access >= ulMaster) *************** *** 4666,4669 **** --- 4666,4673 ---- { AddChannelOp(1, &user, cn, chanserv->numeric, 1); + } + else if (GetChannelAccess(channel->channel, user->handle_info)) + { + AddChannelVoice(1, &user, cn, chanserv->numeric, 1); } |
From: Entrope <en...@us...> - 2001-09-04 18:20:54
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv17012/src Modified Files: Tag: rel-1_0 main.c opserv.c proto.h Log Message: clean up some #include's Index: main.c =================================================================== RCS file: /cvsroot/srvx/services/src/main.c,v retrieving revision 1.94.2.12 retrieving revision 1.94.2.13 diff -C2 -r1.94.2.12 -r1.94.2.13 *** main.c 2001/08/30 03:16:47 1.94.2.12 --- main.c 2001/09/04 18:20:51 1.94.2.13 *************** *** 51,54 **** --- 51,57 ---- #include <sys/resource.h> #endif + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> + #endif #include "common.h" Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.187.2.51 retrieving revision 1.187.2.52 diff -C2 -r1.187.2.51 -r1.187.2.52 *** opserv.c 2001/08/25 03:16:03 1.187.2.51 --- opserv.c 2001/09/04 18:20:51 1.187.2.52 *************** *** 27,30 **** --- 27,33 ---- #endif #include <limits.h> + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> + #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.24.2.4 retrieving revision 1.24.2.5 diff -C2 -r1.24.2.4 -r1.24.2.5 *** proto.h 2001/08/16 02:39:18 1.24.2.4 --- proto.h 2001/09/04 18:20:51 1.24.2.5 *************** *** 28,39 **** #define MAXNUMPARAMS 200 - #ifdef HAVE_SYS_TYPES_H - #include <sys/types.h> - #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> - #endif - #ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> #endif --- 28,33 ---- |
From: Entrope <en...@us...> - 2001-09-04 18:19:49
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv16724/src Modified Files: Tag: rel-1_0 common.h Log Message: C makes array bounds in function decl's meaningless, so don't list it Index: common.h =================================================================== RCS file: /cvsroot/srvx/services/src/common.h,v retrieving revision 1.60.2.8 retrieving revision 1.60.2.9 diff -C2 -r1.60.2.8 -r1.60.2.9 *** common.h 2001/08/14 15:31:29 1.60.2.8 --- common.h 2001/09/04 18:19:47 1.60.2.9 *************** *** 127,131 **** #define MD5_CRYPT_LENGTH 33 ! const char *cryptpass(const char *pass, char buffer[MD5_CRYPT_LENGTH]); int checkpass(const char *pass, const char *crypt); --- 127,132 ---- #define MD5_CRYPT_LENGTH 33 ! /* buffer[] must be at least MD5_CRYPT_LENGTH bytes long */ ! const char *cryptpass(const char *pass, char buffer[]); int checkpass(const char *pass, const char *crypt); |