[srvx-commits] CVS: services/src proto-p10.c,NONE,1.1 proto-common.c,NONE,1.1 proto-bahamut.c,NONE,1
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv3145/src Modified Files: tools.c proto.h opserv.c nickserv.c messages.h main.c helpserv.c helpfile.h helpfile.c hash.h hash.c global.c chanserv.c Makefile.am Added Files: proto-p10.c proto-common.c proto-bahamut.c Removed Files: proto.c parse.h parse.c commands.h Log Message: update version number to srvx-1.2 (dust) preliminary Bahamut support (not 100% complete, but maybe 80% there) reorganized P10 support (may have broken a few things) ***** Error reading new file: [Errno 2] No such file or directory: 'proto-p10.c' ***** Error reading new file: [Errno 2] No such file or directory: 'proto-common.c' ***** Error reading new file: [Errno 2] No such file or directory: 'proto-bahamut.c' Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -r1.105 -r1.106 *** tools.c 24 May 2002 22:00:31 -0000 1.105 --- tools.c 26 Jun 2002 11:45:28 -0000 1.106 *************** *** 52,55 **** --- 52,57 ---- #define NUMNICKMASK (NUMNICKBASE - 1) + /* Yes, P10's encoding here is almost-but-not-quite MIME Base64. Yay + * for gratuitous incompatibilities. */ static const char convert2y[] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -r1.51 -r1.52 *** proto.h 18 May 2002 14:59:40 -0000 1.51 --- proto.h 26 Jun 2002 11:45:28 -0000 1.52 *************** *** 22,25 **** --- 22,31 ---- #define PROTO_H + /* Warning for those looking at how this code does multi-protocol + * support: It's an awful, nasty hack job. It is intended for short + * term use, not long term, since we are already developing srvx2, + * which has much nicer interfaces that hide most of the ugly + * differences between protocol dialects. */ + #define COMBO_NUMERIC_LEN 5 /* 1/2, 1/3 or 2/3 digits for server/client parts */ #define MAXLEN 512 /* This is used all over as a maximum string lenth - keep it large */ *************** *** 77,80 **** --- 83,113 ---- }; + #ifdef WITH_PROTOCOL_P10 + struct server* GetServerN(const char *numeric); + struct userNode* GetUserN(const char *numeric); + #endif + + /* Basic protocol parsing support. */ + void init_parse(void); + int parse_line(unsigned char *line, int recursive); + + /* Callback notifications for protocol support. */ + typedef void (*chanmsg_func_t) (struct userNode *user, struct chanNode *chan, char *text); + void reg_chanmsg_func(unsigned char prefix, struct userNode *service, chanmsg_func_t handler); + + typedef void (*privmsg_func_t) (struct userNode *user, struct userNode *target, char *text, int server_qualified); + void reg_privmsg_func(struct userNode *user, privmsg_func_t handler); + void reg_notice_func(struct userNode *user, privmsg_func_t handler); + + typedef void (*mode_change_func_t) (struct chanNode *channel, struct userNode *user, int change_type, void *change); + void reg_mode_change_func(mode_change_func_t handler); + + #define MODE_CHANGE_MISC 0x001 + #define MODE_CHANGE_OP 0x002 + #define MODE_CHANGE_DEOP 0x004 + #define MODE_CHANGE_BAN 0x008 + + extern struct userList dead_users; + /* replay silliness */ void replay_read_line(void); *************** *** 84,93 **** void irc_server(struct server *srv); void irc_user(struct userNode *user); ! void irc_nick(struct userNode *user); ! void irc_pass(const char *passwd); void irc_introduce(const char *passwd); - void irc_burst(struct chanNode *chan); - void irc_eob(void); - void irc_eob_ack(void); void irc_ping(const char *something); void irc_pong(const char *data); --- 117,122 ---- void irc_server(struct server *srv); void irc_user(struct userNode *user); ! void irc_nick(struct userNode *user, const char *new_nick); void irc_introduce(const char *passwd); void irc_ping(const char *something); void irc_pong(const char *data); *************** *** 96,102 **** /* messages */ ! void irc_privmsg(const char *from, const char *to, const char *message); ! void irc_notice(const char *from, const char *to, const char *message); ! void irc_wallchops(const char *from, const char *to, const char *message); /* channel maintenance */ --- 125,131 ---- /* messages */ ! void irc_privmsg(struct userNode *from, const char *to, const char *message); ! void irc_notice(struct userNode *from, const char *to, const char *message); ! void irc_wallchops(struct userNode *from, const char *to, const char *message); /* channel maintenance */ *************** *** 120,123 **** --- 149,161 ---- /* numeric messages */ void irc_numeric(struct userNode *user, unsigned int num, const char *format, ...); + /* RFC1459-compliant numeric responses */ + #define RPL_ENDOFSTATS 219 + #define RPL_STATSUPTIME 242 + #define RPL_MAXCONNECTIONS 250 + #define RPL_WHOISUSER 311 + #define RPL_WHOISSERVER 312 + #define RPL_WHOISOPERATOR 313 + #define RPL_ENDOFWHOIS 318 + #define ERR_NOSUCHNICK 401 #endif /* !defined(PROTO_H) */ Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.235 retrieving revision 1.236 diff -C2 -r1.235 -r1.236 *** opserv.c 18 Jun 2002 19:29:23 -0000 1.235 --- opserv.c 26 Jun 2002 11:45:28 -0000 1.236 *************** *** 50,54 **** #include "helpfile.h" #include "log.h" - #include "parse.h" #include "chanserv.h" #include "nickserv.h" --- 50,53 ---- *************** *** 830,837 **** inttobase64(numeric+2, 64*64*64-1, 3); } ! if (GetServer(numeric)) { opserv_notice(user, OSMSG_NUMERIC_COLLIDE); return 0; } if (GetServerH(argv[1])) { opserv_notice(user, OSMSG_NAME_COLLIDE); --- 829,838 ---- inttobase64(numeric+2, 64*64*64-1, 3); } ! #ifdef WITH_PROTOCOL_P10 ! if (GetServerN(numeric)) { opserv_notice(user, OSMSG_NUMERIC_COLLIDE); return 0; } + #endif if (GetServerH(argv[1])) { opserv_notice(user, OSMSG_NAME_COLLIDE); *************** *** 1113,1117 **** return 0; } ! channel = AddChannel(argv[-1], now, "", "", 0, "", ""); } if (GetUserMode(channel, opserv)) { --- 1114,1118 ---- return 0; } ! channel = AddChannel(argv[-1], now, "", "", 0, 0); } if (GetUserMode(channel, opserv)) { *************** *** 1351,1354 **** --- 1352,1356 ---- OPSERV_MIN_PARMS(2, false); + #ifdef WITH_PROTOCOL_P10 if (argv[1][0] == '*') { target = GetUserN(argv[1]+1); *************** *** 1356,1359 **** --- 1358,1364 ---- target = GetUserH(argv[1]); } + #else + target = GetUserH(argv[1]); + #endif if (!target) { opserv_notice(user, MSG_NICK_UNKNOWN, argv[1]); *************** *** 1381,1385 **** --- 1386,1392 ---- } opserv_notice(user, OSMSG_WHOIS_INFO, target->info); + #ifdef WITH_PROTOCOL_P10 opserv_notice(user, OSMSG_WHOIS_NUMERIC, target->numeric); + #endif opserv_notice(user, OSMSG_WHOIS_SERVER, target->uplink->name); opserv_notice(user, OSMSG_WHOIS_ACCOUNT, (target->handle_info ? target->handle_info->handle : "Not authenticated")); *************** *** 1668,1672 **** nn++; } ! table_send(opserv, user->numeric, 0, 0, tbl); for (nn=1; nn<tbl.length; nn++) { free((char*)tbl.contents[nn][1]); --- 1675,1679 ---- nn++; } ! table_send(opserv, user->nick, 0, 0, tbl); for (nn=1; nn<tbl.length; nn++) { free((char*)tbl.contents[nn][1]); *************** *** 1699,1703 **** --- 1706,1714 ---- tbl.contents[nn] = calloc(tbl.width, sizeof(**tbl.contents)); tbl.contents[nn][0] = server->name; + #ifdef WITH_PROTOCOL_P10 sprintf(buffer, "%s (%ld)", server->numeric, base64toint(server->numeric, strlen(server->numeric))); + #else + buffer[0] = 0; + #endif tbl.contents[nn][1] = buffer; ofs = strlen(buffer) + 1; *************** *** 1707,1711 **** nn++; } ! table_send(opserv, user->numeric, 0, 0, tbl); for (nn=1; nn<tbl.length; nn++) { free((char*)tbl.contents[nn][1]); --- 1718,1722 ---- nn++; } ! table_send(opserv, user->nick, 0, 0, tbl); for (nn=1; nn<tbl.length; nn++) { free((char*)tbl.contents[nn][1]); *************** *** 1850,1854 **** table.contents[nn][3] = gag->reason; } ! table_send(opserv, user->numeric, 0, NULL, table); for (nn=1; nn<table.length; nn++) { free((char*)table.contents[nn][2]); --- 1861,1865 ---- table.contents[nn][3] = gag->reason; } ! table_send(opserv, user->nick, 0, NULL, table); for (nn=1; nn<table.length; nn++) { free((char*)table.contents[nn][2]); *************** *** 2526,2530 **** if (!strcasecmp(argv[1], "JOIN")) { if (!channel ! && !(channel = AddChannel(argv[3], now, "", "", 0, "", NULL))) { opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]); return 0; --- 2537,2541 ---- if (!strcasecmp(argv[1], "JOIN")) { if (!channel ! && !(channel = AddChannel(argv[3], now, "", "", 0, NULL))) { opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]); return 0; *************** *** 2567,2571 **** if (!strcasecmp(argv[1], "SAY")) { unsplit_string(argv+4, argc-4); ! irc_privmsg(clone->numeric, argv[3], argv[4]); opserv_notice(user, OSMSG_CLONE_SAID, clone->nick, argv[3]); return 1; --- 2578,2582 ---- if (!strcasecmp(argv[1], "SAY")) { unsplit_string(argv+4, argc-4); ! irc_privmsg(clone, argv[3], argv[4]); opserv_notice(user, OSMSG_CLONE_SAID, clone->nick, argv[3]); return 1; *************** *** 4468,4472 **** str = database_get_data(conf_node, KEY_DEBUG_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.debug_channel = AddChannel(str, now, "+tinms", NULL, 0, "", NULL); AddChannelUser(opserv, opserv_conf.debug_channel)->modes |= MODE_CHANOP; } else { --- 4479,4483 ---- str = database_get_data(conf_node, KEY_DEBUG_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.debug_channel = AddChannel(str, now, "+tinms", NULL, 0, NULL); AddChannelUser(opserv, opserv_conf.debug_channel)->modes |= MODE_CHANOP; } else { *************** *** 4475,4479 **** str = database_get_data(conf_node, KEY_ALERT_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.alert_channel = AddChannel(str, now, "+tns", NULL, 0, "", NULL); AddChannelUser(opserv, opserv_conf.alert_channel)->modes |= MODE_CHANOP; } else { --- 4486,4490 ---- str = database_get_data(conf_node, KEY_ALERT_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.alert_channel = AddChannel(str, now, "+tns", NULL, 0, NULL); AddChannelUser(opserv, opserv_conf.alert_channel)->modes |= MODE_CHANOP; } else { *************** *** 4482,4486 **** str = database_get_data(conf_node, KEY_STAFF_AUTH_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.staff_auth_channel = AddChannel(str, now, "+timns", NULL, 0, "", NULL); AddChannelUser(opserv, opserv_conf.staff_auth_channel)->modes |= MODE_CHANOP; } else { --- 4493,4497 ---- str = database_get_data(conf_node, KEY_STAFF_AUTH_CHANNEL, RECDB_QSTRING); if (str) { ! opserv_conf.staff_auth_channel = AddChannel(str, now, "+timns", NULL, 0, NULL); AddChannelUser(opserv, opserv_conf.staff_auth_channel)->modes |= MODE_CHANOP; } else { *************** *** 4556,4560 **** conf_register_reload(opserv_conf_read); ! reg_privmsg_func(opserv->num_local, opserv_privmsg); if (opserv_conf.trigger_char) { reg_chanmsg_func(opserv_conf.trigger_char, opserv, opserv_chanmsg); --- 4567,4571 ---- conf_register_reload(opserv_conf_read); ! reg_privmsg_func(opserv, opserv_privmsg); if (opserv_conf.trigger_char) { reg_chanmsg_func(opserv_conf.trigger_char, opserv, opserv_chanmsg); Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -r1.170 -r1.171 *** nickserv.c 18 Jun 2002 03:23:39 -0000 1.170 --- nickserv.c 26 Jun 2002 11:45:28 -0000 1.171 *************** *** 46,50 **** #include "nickserv.h" #include "opserv.h" - #include "parse.h" #include "policer.h" #include "recdb.h" --- 46,49 ---- *************** *** 3245,3249 **** unsigned int i; nickserv = AddService(nick, "Nick Services"); ! reg_privmsg_func(nickserv->num_local, nickserv_msg); reg_new_user_func(handle_new_user); reg_nick_change_func(handle_nick_change); --- 3244,3248 ---- unsigned int i; nickserv = AddService(nick, "Nick Services"); ! reg_privmsg_func(nickserv, nickserv_msg); reg_new_user_func(handle_new_user); reg_nick_change_func(handle_nick_change); Index: messages.h =================================================================== RCS file: /cvsroot/srvx/services/src/messages.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** messages.h 6 May 2002 23:33:12 -0000 1.25 --- messages.h 26 Jun 2002 11:45:28 -0000 1.26 *************** *** 28,32 **** freak. */ ! #define CODENAME "purple" #define MSG_VERSION "$bsrvx "VERSION"$b ("CODENAME"), Built: " __DATE__ ", " __TIME__"." --- 28,32 ---- freak. */ ! #define CODENAME "dust" #define MSG_VERSION "$bsrvx "VERSION"$b ("CODENAME"), Built: " __DATE__ ", " __TIME__"." Index: main.c =================================================================== RCS file: /cvsroot/srvx/services/src/main.c,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -r1.124 -r1.125 *** main.c 8 Jun 2002 20:32:44 -0000 1.124 --- main.c 26 Jun 2002 11:45:28 -0000 1.125 *************** *** 66,70 **** #include "ioset.h" #include "log.h" - #include "parse.h" #include "policer.h" #include "recdb.h" --- 66,69 ---- Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** helpserv.c 21 Jun 2002 00:32:17 -0000 1.14 --- helpserv.c 26 Jun 2002 11:45:28 -0000 1.15 *************** *** 65,69 **** #include "alias.h" #include "opserv.h" - #include "parse.h" #include "global.h" #include "recdb.h" --- 65,68 ---- *************** *** 1118,1122 **** } ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); break; --- 1117,1121 ---- } ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); break; *************** *** 1141,1145 **** } ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); } } --- 1140,1144 ---- } ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); } } *************** *** 1389,1393 **** } ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); for (; line > 0; line--) { --- 1388,1392 ---- } ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); for (; line > 0; line--) { *************** *** 1653,1657 **** helpserv_notice(user, HSMSG_STATS_TIME, hs->helpchan->name); ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); for (i=1; i < 5; i++) { --- 1652,1656 ---- helpserv_notice(user, HSMSG_STATS_TIME, hs->helpchan->name); ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); for (i=1; i < 5; i++) { *************** *** 1695,1699 **** helpserv_notice(user, HSMSG_STATS_REQS); ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); for (i=1; i < 5; i++) { --- 1694,1698 ---- helpserv_notice(user, HSMSG_STATS_REQS); ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); for (i=1; i < 5; i++) { *************** *** 1749,1754 **** mktime(&week_tm); /* To fix up stuff after messing with tm_mday */ strftime(weekstr, MAX_LINE_SIZE, HSFMT_STATS_REPORT_WEEK, &week_tm); ! send_target_message(use_privmsg, user->numeric, srcbot, "%s", weekstr); ! table_send(srcbot, user->numeric, 0, (use_privmsg ? irc_privmsg : irc_notice), tbl); } --- 1748,1753 ---- mktime(&week_tm); /* To fix up stuff after messing with tm_mday */ strftime(weekstr, MAX_LINE_SIZE, HSFMT_STATS_REPORT_WEEK, &week_tm); ! send_target_message(use_privmsg, user->nick, srcbot, "%s", weekstr); ! table_send(srcbot, user->nick, 0, (use_privmsg ? irc_privmsg : irc_notice), tbl); } *************** *** 1832,1836 **** if (!(hs->helpchan = GetChannel(newchan))) { ! hs->helpchan = AddChannel(newchan, now, NULL, NULL, 0, hs->helpserv->numeric, NULL); AddChannelOp(1, &hs->helpserv, hs->helpchan, hs->helpserv, 0); } else if (!helpserv_in_channel(hs, old_helpchan)) { --- 1831,1836 ---- if (!(hs->helpchan = GetChannel(newchan))) { ! hs->helpchan = AddChannel(newchan, now, NULL, NULL, 0, NULL); ! AddChannelUser(hs->helpserv, hs->helpchan); AddChannelOp(1, &hs->helpserv, hs->helpchan, hs->helpserv, 0); } else if (!helpserv_in_channel(hs, old_helpchan)) { *************** *** 1893,1897 **** } ! table_send((from_opserv ? opserv : hs->helpserv), user->numeric, 0, NULL, tbl); return 1; --- 1893,1897 ---- } ! table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); return 1; *************** *** 2133,2140 **** hs->helpserv = AddService(nick, helpserv_conf.description); ! reg_privmsg_func(hs->helpserv->num_local, helpserv_botmsg); if (!(hs->helpchan = GetChannel(help_channel))) { ! hs->helpchan = AddChannel(help_channel, now, NULL, NULL, 0, hs->helpserv->numeric, NULL); AddChannelOp(1, &hs->helpserv, hs->helpchan, hs->helpserv, 0); } else { --- 2133,2141 ---- hs->helpserv = AddService(nick, helpserv_conf.description); ! reg_privmsg_func(hs->helpserv, helpserv_botmsg); if (!(hs->helpchan = GetChannel(help_channel))) { ! hs->helpchan = AddChannel(help_channel, now, NULL, NULL, 0, NULL); ! AddChannelUser(hs->helpserv, hs->helpchan); AddChannelOp(1, &hs->helpserv, hs->helpchan, hs->helpserv, 0); } else { *************** *** 2272,2276 **** } new_target = GetChannel(target); ! if (!new_target) new_target = AddChannel(target, now, NULL, NULL, 0, hs->helpserv->numeric, NULL); } else { new_target = NULL; --- 2273,2280 ---- } new_target = GetChannel(target); ! if (!new_target) { ! new_target = AddChannel(target, now, NULL, NULL, 0, NULL); ! AddChannelUser(hs->helpserv, new_target); ! } } else { new_target = NULL; *************** *** 3429,3433 **** helpserv_notice(user, HSMSG_REQLIST_AUTH); ! table_send(hs->helpserv, user->numeric, 0, NULL, tbl); for (j=1; j <= helper_reqs.used; j++) { --- 3433,3437 ---- helpserv_notice(user, HSMSG_REQLIST_AUTH); ! table_send(hs->helpserv, user->nick, 0, NULL, tbl); for (j=1; j <= helper_reqs.used; j++) { Index: helpfile.h =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** helpfile.h 6 May 2002 23:33:12 -0000 1.20 --- helpfile.h 26 Jun 2002 11:45:28 -0000 1.21 *************** *** 54,58 **** typedef struct helpfile_expansion (*expand_func_t)(char *variable); ! typedef void (*irc_send_func)(const char *from, const char *to, const char *msg); #ifdef __GNUC__ --- 54,58 ---- typedef struct helpfile_expansion (*expand_func_t)(char *variable); ! typedef void (*irc_send_func)(struct userNode *from, const char *to, const char *msg); #ifdef __GNUC__ Index: helpfile.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -r1.47 -r1.48 *** helpfile.c 7 May 2002 22:53:45 -0000 1.47 --- helpfile.c 26 Jun 2002 11:45:28 -0000 1.48 *************** *** 30,34 **** #include "log.h" #include "nickserv.h" - #include "proto.h" #include "recdb.h" --- 30,33 ---- *************** *** 50,54 **** unsigned int ii, jj, len, nreps, reps, tot_width, pos, spaces, *max_width; char line[MAX_LINE_SIZE+1]; ! struct handle_info *hi = IsChannelName(to) ? NULL : GetUserN(to)->handle_info; /* If size or irc_send are 0, we should try to use a default. */ --- 49,67 ---- unsigned int ii, jj, len, nreps, reps, tot_width, pos, spaces, *max_width; char line[MAX_LINE_SIZE+1]; ! struct handle_info *hi; ! ! if (IsChannelName(to)) { ! hi = NULL; ! } else { ! struct userNode *un = GetUserH(to); ! if (!un) { ! log(MAIN_LOG, LOG_ERROR, "Unable to find user with nickname %s (in table_send from %s)\n", to, from->nick); ! return; ! } ! hi = un->handle_info; ! #ifdef WITH_PROTOCOL_P10 ! to = un->numeric; ! #endif ! } /* If size or irc_send are 0, we should try to use a default. */ *************** *** 114,118 **** } line[--pos] = 0; ! irc_send(from->numeric, to, line); ii = 1; } --- 127,131 ---- } line[--pos] = 0; ! irc_send(from, to, line); ii = 1; } *************** *** 131,135 **** if ((reps == nreps) || (ii==table.length)) { line[--pos] = 0; ! irc_send(from->numeric, to, line); pos = reps = 0; } --- 144,148 ---- if ((reps == nreps) || (ii==table.length)) { line[--pos] = 0; ! irc_send(from, to, line); pos = reps = 0; } *************** *** 147,155 **** vsend_message(const char *dest, struct userNode *src, struct handle_info *handle, int msg_type, expand_func_t expand_f, const char *format, va_list al) { ! void (*irc_send)(const char *from, const char *to, const char *msg); char *input, line[MAX_LINE_SIZE]; unsigned int size, pos, length, chars_sent; int ret, use_color; /* expand the parameters we got .. */ chars_sent = 0; --- 160,178 ---- vsend_message(const char *dest, struct userNode *src, struct handle_info *handle, int msg_type, expand_func_t expand_f, const char *format, va_list al) { ! void (*irc_send)(struct userNode *from, const char *to, const char *msg); char *input, line[MAX_LINE_SIZE]; unsigned int size, pos, length, chars_sent; int ret, use_color; + #ifdef WITH_PROTOCOL_P10 + if (!IsChannelName(dest)) { + struct userNode *un = GetUserH(dest); + if (!un) { + log(MAIN_LOG, LOG_ERROR, "Unable to find user with nickname %s (in vsend_message from %s)\n", dest, src->nick); + return 0; + } + dest = un->numeric; + } + #endif /* expand the parameters we got .. */ chars_sent = 0; *************** *** 295,299 **** value = handle ? handle->handle : "Account"; break; ! #define SEND_LINE() do { line[pos] = 0; if (pos > 0) irc_send(src->numeric, dest, line); chars_sent += pos; pos = 0; } while (0) /* Custom expansion handled by helpfile-specific function. */ case '{': --- 318,322 ---- value = handle ? handle->handle : "Account"; break; ! #define SEND_LINE() do { line[pos] = 0; if (pos > 0) irc_send(src, dest, line); chars_sent += pos; pos = 0; } while (0) /* Custom expansion handled by helpfile-specific function. */ case '{': *************** *** 389,393 **** if (IsLocal(dest)) return 0; va_start(ap, format); ! res = vsend_message(dest->numeric, src, dest->handle_info, 0, NULL, format, ap); va_end(ap); return res; --- 412,416 ---- if (IsLocal(dest)) return 0; va_start(ap, format); ! res = vsend_message(dest->nick, src, dest->handle_info, 0, NULL, format, ap); va_end(ap); return res; *************** *** 413,417 **** va_list ap; va_start(ap, format); ! res = vsend_message(dest->numeric, src, dest->handle_info, 0, expand, format, ap); va_end(ap); return res; --- 436,440 ---- 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.81 retrieving revision 1.82 diff -C2 -r1.81 -r1.82 *** hash.h 12 May 2002 15:25:09 -0000 1.81 --- hash.h 26 Jun 2002 11:45:28 -0000 1.82 *************** *** 89,102 **** struct userNode { - unsigned int num_local : 18; - unsigned int dead : 1; - unsigned long ip; - long modes; /* user flags +isw etc... */ - - char numeric[COMBO_NUMERIC_LEN+1]; char nick[NICKLEN + 1]; /* Unique name of the client, nick or host */ char ident[USERLEN + 1]; /* Per-host identification for user */ char info[REALLEN + 1]; /* Free form additional client information */ char hostname[HOSTLEN + 1]; time_t timestamp; --- 89,103 ---- struct userNode { char nick[NICKLEN + 1]; /* Unique name of the client, nick or host */ char ident[USERLEN + 1]; /* Per-host identification for user */ char info[REALLEN + 1]; /* Free form additional client information */ char hostname[HOSTLEN + 1]; + #ifdef WITH_PROTOCOL_P10 + char numeric[COMBO_NUMERIC_LEN+1]; + unsigned int num_local : 18; + #endif + unsigned int dead : 1; + unsigned long ip; + long modes; /* user flags +isw etc... */ time_t timestamp; *************** *** 155,164 **** time_t boot; time_t link; - char numeric[COMBO_NUMERIC_LEN+1]; char description[SERVERDESCRIPTMAX+1]; ! unsigned int num_mask, hops, clients, max_clients; unsigned int burst : 1, self_burst : 1; struct server *uplink; struct userNode **users; /* flat indexed by numeric */ struct serverList children; }; --- 156,172 ---- time_t boot; time_t link; char description[SERVERDESCRIPTMAX+1]; ! #ifdef WITH_PROTOCOL_P10 ! char numeric[COMBO_NUMERIC_LEN+1]; ! unsigned int num_mask; ! #endif ! unsigned int hops, clients, max_clients; unsigned int burst : 1, self_burst : 1; struct server *uplink; + #ifdef WITH_PROTOCOL_P10 struct userNode **users; /* flat indexed by numeric */ + #else + dict_t users; /* indexed by nick */ + #endif struct serverList children; }; *************** *** 168,183 **** extern dict_t clients; extern dict_t servers; - extern struct server *servers_num[64*64]; extern unsigned int max_clients, invis_clients; extern time_t max_clients_time; extern struct userList curr_opers, curr_helpers; - struct server* GetServer(const char *numeric); /* using numeric */ struct server* GetServerH(const char *name); /* using full name */ - struct userNode* GetUserN(const char *numeric); /* using numeric */ struct userNode* GetUserH(const char *nick); /* using nick */ - struct userNode* GetUser(const char *user); /* either :Nick or NUM */ struct chanNode* GetChannel(const char *name); - struct modeNode* GetUserMode(struct chanNode* channel, struct userNode* user); --- 176,186 ---- *************** *** 195,199 **** typedef int (*new_user_func_t) (struct userNode *user); void reg_new_user_func(new_user_func_t handler); - struct userNode* AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); typedef void (*del_user_func_t) (struct userNode *user); void reg_del_user_func(del_user_func_t handler); --- 198,201 ---- *************** *** 213,217 **** #define IsChannelName(x) ((*(x) == '#' || *(x) == '+') && !strpbrk((x)+1,"\a,")) ! struct chanNode* AddChannel(const char *name, time_t time_, const char *modes, const char *key, int limit, char *members, char *banlist); void DelChannel(struct chanNode* channel); --- 215,219 ---- #define IsChannelName(x) ((*(x) == '#' || *(x) == '+') && !strpbrk((x)+1,"\a,")) ! struct chanNode* AddChannel(const char *name, time_t time_, const char *modes, const char *key, int limit, char *banlist); void DelChannel(struct chanNode* channel); *************** *** 244,248 **** void init_structs(void); - void send_burst(void); #endif --- 246,249 ---- Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -r1.159 -r1.160 *** hash.c 18 Jun 2002 23:14:57 -0000 1.159 --- hash.c 26 Jun 2002 11:45:28 -0000 1.160 *************** *** 27,31 **** #include "common.h" - #include "commands.h" #include "dict.h" #include "conf.h" --- 27,30 ---- *************** *** 33,47 **** #include "global.h" #include "log.h" - #include "nickserv.h" - #include "chanserv.h" - #include "policer.h" - #include "parse.h" #include "recdb.h" extern time_t boot_time; - extern struct policer_params *oper_policer_params, *luser_policer_params; struct server *self; - struct server *servers_num[64*64]; dict_t channels; dict_t clients; --- 32,40 ---- *************** *** 49,69 **** unsigned int max_clients, invis_clients; time_t max_clients_time; - unsigned int server_count; struct userList curr_opers; unsigned int nicklen = NICKLEN, force_n2k; - static unsigned int next_numeric = 0; - static void hash_cleanup(void); void init_structs(void) { - unsigned int i; char numer[COMBO_NUMERIC_LEN+1]; - for (i=0; i<ArrayLength(servers_num); i++) { - servers_num[i] = NULL; - } - channels = dict_new(); clients = dict_new(); --- 42,54 ---- *************** *** 88,127 **** } ! void ! send_burst(void) ! { ! unsigned int i, hop, max_hop=1; ! dict_iterator_t it; ! ! /* burst servers, closest first (but self is sent during auth) */ ! for (i=0; i<ArrayLength(servers_num); i++) { ! if (servers_num[i] && servers_num[i]->hops > max_hop) { ! max_hop = servers_num[i]->hops; ! } ! } ! for (hop=1; hop<=max_hop; hop++) { ! for (i=0;i<ArrayLength(servers_num);i++) { ! if (!servers_num[i]) continue; ! ! if ((servers_num[i]->hops == hop) && (servers_num[i] != self->uplink)) ! irc_server(servers_num[i]); ! } ! } ! ! /* burst local nicks */ ! for (i=0; i<=self->num_mask; i++) { ! if (self->users[i]) irc_user(self->users[i]); ! } ! ! /* burst channels */ ! for (it=dict_first(channels); it; it=iter_next(it)) { ! irc_burst(iter_data(it)); ! } ! ! irc_eob(); ! } ! ! static server_link_func_t *slf_list; ! static unsigned int slf_size = 0, slf_used = 0; void --- 73,78 ---- } ! server_link_func_t *slf_list; ! unsigned int slf_size = 0, slf_used = 0; void *************** *** 140,318 **** } - struct server * - AddServer(struct server *uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description) - { - struct server* sNode; - int slen, mlen; - - if ((sNode = GetServer(numeric))) { - /* This means we're trying to re-add an existant server. - * To be safe, we should forget the previous incarnation. - * (And all its linked servers.) - * - * It usually only happens in replays when the original - * had a ping timeout and the replay didn't (because - * replaying a ping timeout invariably gets things wrong). - */ - DelServer(sNode, 0, NULL); - } - - switch (strlen(numeric)) { - case 5: slen = 2; mlen = 3; break; - case 4: slen = 1; mlen = 3; break; - case 3: slen = 1; mlen = 2; break; - default: - log(MAIN_LOG, LOG_ERROR, "AddServer(\"%s\", \"%s\", ...): Numeric %s has invalid length.\n", uplink->name, name, numeric); - return NULL; - } - - sNode = calloc(1, sizeof(*sNode)); - sNode->uplink = uplink; - safestrncpy(sNode->name, name, sizeof(sNode->name)); - sNode->num_mask = base64toint(numeric+slen, mlen); - sNode->hops = hops; - sNode->clients = 0; - sNode->boot = boot; - sNode->link = link; - strncpy(sNode->numeric, numeric, slen); - safestrncpy(sNode->description, description, sizeof(sNode->description)); - sNode->users = calloc(sNode->num_mask+1, sizeof(*sNode->users)); - serverList_init(&sNode->children); - if (sNode->uplink) { - /* uplink may be NULL if we're just building ourself */ - serverList_append(&sNode->uplink->children, sNode); - } - servers_num[base64toint(numeric, slen)] = sNode; - dict_insert(servers, sNode->name, sNode); - - if (hops && !self->burst) { - unsigned int n; - for (n=0; n<slf_used; n++) { - slf_list[n](sNode); - } - } - - server_count++; - return sNode; - } - - void DelServer(struct server* serv, int announce, const char *message) - { - unsigned int i; - - /* If we receive an ERROR command before the SERVER - * command a NULL server can be passed */ - if (!serv) return; - - /* Hrm, what's the right way to SQUIT some other server? - * (This code is only to handle killing juped servers.) */ - if (announce && (serv->uplink == self) && (serv != self->uplink)) { - irc_squit(serv, message); - } - - /* must recursively remove servers linked to this one first */ - for (i=serv->children.used;i>0;) { - if (serv->children.list[--i] != self) { - DelServer(serv->children.list[i], false, NULL); - } - } - - /* clean up server's user hash tables */ - for (i=0;i<=serv->num_mask;i++) { - if (serv->users[i]) { - DelUser(serv->users[i], NULL, false, "server delinked"); - } - } - - /* delete server */ - if (serv->uplink) serverList_remove(&serv->uplink->children, serv); - if (serv == self->uplink) self->uplink = NULL; - servers_num[base64toint(serv->numeric, strlen(serv->numeric))] = NULL; - dict_remove(servers, serv->name); - serverList_clean(&serv->children); - free(serv->users); - free(serv); - server_count--; - } - - /* Numerics can be XYY, XYYY, or XXYYY; with X's identifying the - * server and Y's indentifying the client on that server. */ - struct server* - GetServer(const char *numeric) - { - switch (strlen(numeric)) { - default: - return servers_num[base64toint(numeric, 2)]; - case 4: - case 3: - case 1: - return servers_num[base64toint(numeric, 1)]; - case 0: - return NULL; - } - } - struct server* GetServerH(const char *name) { ! unsigned int n; ! for (n=0; n<ArrayLength(servers_num); n++) { ! if (!servers_num[n]) continue; ! if (!strcasecmp(name, servers_num[n]->name)) return servers_num[n]; ! } ! return NULL; ! } ! ! static int ! get_local_numeric(void) ! { ! if (self->clients >= self->num_mask) return -1; ! while (self->users[next_numeric]) { ! if (++next_numeric > self->num_mask) next_numeric = 0; ! } ! return next_numeric; } ! static void ! make_numeric(struct server *svr, int local_num, char *outbuf) ! { ! int slen, llen; ! ! if (force_n2k || svr->numeric[1]) { ! slen = 2; ! llen = 3; ! } else { ! slen = 1; ! llen = (local_num < 64*64) ? 2 : 3; ! } ! strncpy(outbuf, svr->numeric, slen); ! inttobase64(outbuf+slen, local_num, llen); ! outbuf[slen+llen] = 0; ! } ! ! struct userNode * ! AddService(const char *nick, const char *desc) ! { ! char numeric[COMBO_NUMERIC_LEN+1]; ! int local_num = get_local_numeric(); ! ! if (local_num == -1) return 0; ! make_numeric(self, local_num, numeric); ! return AddUser(self, nick, nick, self->name, "+oik", numeric, desc, now, "AAAAAA"); ! } ! ! struct userNode * ! AddClone(const char *nick, const char *ident, const char *hostname, const char *desc) ! { ! char numeric[COMBO_NUMERIC_LEN+1]; ! int local_num = get_local_numeric(); ! ! if (local_num == -1) return 0; ! make_numeric(self, local_num, numeric); ! return AddUser(self, nick, ident, hostname, "+i", numeric, desc, now, "AAAAAA"); ! } ! ! static new_user_func_t *nuf_list; ! static unsigned int nuf_size = 0, nuf_used = 0; void --- 91,102 ---- } struct server* GetServerH(const char *name) { ! return dict_find(servers, name, NULL); } ! new_user_func_t *nuf_list; ! unsigned int nuf_size = 0, nuf_used = 0; void *************** *** 350,355 **** ! static del_user_func_t *duf_list; ! static unsigned int duf_size = 0, duf_used = 0; void --- 134,139 ---- ! del_user_func_t *duf_list; ! unsigned int duf_size = 0, duf_used = 0; void *************** *** 380,500 **** } - struct userNode* - AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip) - { - struct userNode *oldUser, *uNode; - struct policer_params *pol_params; - unsigned int n; - - if ((strlen(numeric) < 3) || (strlen(numeric) > 5)) { - log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!\n", uplink, nick, numeric); - return NULL; - } - - if (!uplink) { - log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s doesn't exist!\n", uplink, nick, numeric); - return NULL; - } - - if (uplink != GetServer(numeric)) { - log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s differs from nominal uplink %s.\n", uplink, nick, numeric, uplink->name); - return NULL; - } - - if (strlen(nick) > nicklen) { - log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen); - irc_squit(self, "Nick too long; see main.log for details"); - return NULL; - } - - /* create new usernode and set all values */ - uNode = calloc(1, sizeof(*uNode)); - safestrncpy(uNode->nick, nick, sizeof(uNode->nick)); - safestrncpy(uNode->ident, ident, sizeof(uNode->ident)); - safestrncpy(uNode->info, userinfo, sizeof(uNode->info)); - safestrncpy(uNode->hostname, hostname, sizeof(uNode->hostname)); - safestrncpy(uNode->numeric, numeric, sizeof(uNode->numeric)); - uNode->ip = base64toint(realip, 6); - uNode->timestamp=timestamp; - modeList_init(&uNode->channels); - uNode->uplink = uplink; - if (++uNode->uplink->clients > uNode->uplink->max_clients) { - uNode->uplink->max_clients = uNode->uplink->clients; - } - pol_params = IsOper(uNode) ? oper_policer_params : luser_policer_params; - uNode->command_policer = policer_new(pol_params, uNode->timestamp); - mod_usermode(uNode, modes); - uNode->num_local = base64toint(numeric+strlen(uNode->uplink->numeric), 3) & uNode->uplink->num_mask; - - /* does the nick already exist? if so, how to handle? */ - if ((oldUser = GetUserH(nick))) { - if (oldUser->uplink == self) { - /* Since we want services to be authoritative over - * other servers, we'll issue a KILL regardless of - * timestamp comparisons. If this other user is +k, - * then somebody screwed up. */ - irc_kill(NULL, uNode, "Nick collision"); - } - } else { - dict_insert(clients, uNode->nick, uNode); - if (dict_size(clients) > max_clients) { - max_clients = dict_size(clients); - max_clients_time = now; - } - } - - uNode->uplink->users[uNode->num_local] = uNode; - - if (IsLocal(uNode)) irc_user(uNode); - - for (n=0; n<nuf_used; n++) { - if (nuf_list[n](uNode)) break; - } - - return uNode; - } - - /* removes user from it's server's hash table and nick hash table */ - void - DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why) - { - unsigned int n; - - /* remove user from all channels */ - for (n=user->channels.used; n>0;) { - DelChannelUser(user, user->channels.list[--n]->channel, false, 0); - } - /* Call these in reverse order so ChanServ can update presence - information before NickServ nukes the handle_info. */ - for (n = duf_used; n > 0; ) duf_list[--n](user); - - user->uplink->clients--; - user->uplink->users[user->num_local] = NULL; - if (IsOper(user)) userList_remove(&curr_opers, user); - /* remove from global dictionary, but only if not after a collide */ - if (user == dict_find(clients, user->nick, NULL)) { - dict_remove(clients, user->nick); - } - - if (IsInvisible(user)) invis_clients--; - - if (announce) { - if (IsLocal(user)) { - irc_quit(user, why); - } else { - irc_kill(killer, user, why); - } - } - - modeList_clean(&user->channels); - policer_delete(user->command_policer); - /* We don't free them, in case we try to privmsg them or something - * (like when a stupid oper kills themself). We just put them onto - * a list of clients that get freed after processing each line. - */ - user->dead = 1; - userList_append(&dead_users, user); - } - /* reintroduces a user after it has been killed. */ void --- 164,167 ---- *************** *** 502,505 **** --- 169,173 ---- { unsigned int n; + char modes[MAXLEN]; irc_user(user); *************** *** 508,517 **** for (n = 0; n < user->channels.used; n++) { struct modeNode *mn = user->channels.list[n]; - char modes[16]; switch (mn->modes & (MODE_CHANOP | MODE_VOICE)) { case 0: modes[0] = 0; break; case MODE_VOICE: snprintf(modes, sizeof(modes), "+v %s", user->numeric); break; case MODE_CHANOP: snprintf(modes, sizeof(modes), "+o %s", user->numeric); break; case MODE_CHANOP|MODE_VOICE: snprintf(modes, sizeof(modes), "+ov %s %s", user->numeric, user->numeric); break; } irc_join(user, mn->channel); --- 176,190 ---- for (n = 0; n < user->channels.used; n++) { struct modeNode *mn = user->channels.list[n]; switch (mn->modes & (MODE_CHANOP | MODE_VOICE)) { case 0: modes[0] = 0; break; + #ifdef WITH_PROTOCOL_P10 case MODE_VOICE: snprintf(modes, sizeof(modes), "+v %s", user->numeric); break; case MODE_CHANOP: snprintf(modes, sizeof(modes), "+o %s", user->numeric); break; case MODE_CHANOP|MODE_VOICE: snprintf(modes, sizeof(modes), "+ov %s %s", user->numeric, user->numeric); break; + #else + case MODE_VOICE: snprintf(modes, sizeof(modes), "+v %s", user->nick); break; + case MODE_CHANOP: snprintf(modes, sizeof(modes), "+o %s", user->nick); break; + case MODE_CHANOP|MODE_VOICE: snprintf(modes, sizeof(modes), "+ov %s %s", user->nick, user->nick); break; + #endif } irc_join(user, mn->channel); *************** *** 542,581 **** } ! /* copy new nick into struct */ safestrncpy(user->nick, new_nick, sizeof(user->nick)); ! ! /* reinsert link according to new nick */ dict_insert(clients, user->nick, user); ! ! if (IsLocal(user) && !no_announce) irc_nick(user); ! } ! ! struct userNode * ! GetUserN(const char *numeric) /* using numeric */ ! { ! struct userNode *un; ! struct server *s; ! int n, slen, ulen; ! ! switch (strlen(numeric)) { ! default: ! log(MAIN_LOG, LOG_WARNING, "GetUserN(%s): numeric too long!\n", numeric); ! return NULL; ! case 5: slen = 2; ulen = 3; break; ! case 4: slen = 1; ulen = 3; break; ! case 3: slen = 1; ulen = 2; break; ! case 2: case 1: case 0: ! log(MAIN_LOG, LOG_WARNING, "GetUserN(%s): numeric too short!\n", numeric); ! return NULL; ! } ! if (!(s = servers_num[base64toint(numeric, slen)])) { ! log(MAIN_LOG, LOG_WARNING, "GetUserN(%s): couldn't find server (len=%d)!\n", numeric, slen); ! return NULL; ! } ! n = base64toint(numeric+slen, ulen) & s->num_mask; ! if (!(un = s->users[n])) { ! log(MAIN_LOG, LOG_WARNING, "GetUserN(%s) couldn't find user!\n", numeric); ! } ! return un; } --- 215,231 ---- } ! user->timestamp = now; ! if (IsLocal(user) && !no_announce) irc_nick(user, new_nick); ! #if !defined(WITH_PROTOCOL_P10) ! /* Remove from uplink's clients dict */ ! dict_remove(user->uplink->users, user->nick); ! #endif ! /* Copy new nick into user structure */ safestrncpy(user->nick, new_nick, sizeof(user->nick)); ! /* Reinsert into dicts with the new nick */ dict_insert(clients, user->nick, user); ! #if !defined(WITH_PROTOCOL_P10) ! dict_insert(user->uplink->users, user->nick, user); ! #endif } *************** *** 586,595 **** } - struct userNode * - GetUser(const char *user) - { - return (user[0] == ':') ? GetUserH(user+1) : GetUserN(user); - } - static new_channel_func_t *ncf_list; static unsigned int ncf_size = 0, ncf_used = 0; --- 236,239 ---- *************** *** 628,636 **** } struct chanNode * ! AddChannel(const char *name, time_t time_, const char *modes, const char *key, int limit, char *members, char *banlist) { struct chanNode *cNode; - int rel_age; unsigned int nn; --- 272,281 ---- } + int rel_age; + struct chanNode * ! AddChannel(const char *name, time_t time_, const char *modes, const char *key, int limit, char *banlist) { struct chanNode *cNode; unsigned int nn; *************** *** 731,756 **** } - /* go through the list of users to add and add each one */ - if (members) { - struct userNode *un; - long mode; - char *user, *end, sep; - - for (user = members, sep = *members, mode = 0; sep; user = end) { - for (end = user + 3; (*end != ':') && (*end != ',') && *end; end++) ; - sep = *end++; end[-1] = 0; - if (sep == ':') { - mode = 0; - while ((sep = *end++)) { - if ((sep == 'o') && (rel_age >= 0)) mode |= MODE_CHANOP; - else if (sep == 'v') mode |= MODE_VOICE; - else break; - } - } - if (!(un = GetUserN(user))) continue; - AddChannelUser(un, cNode)->modes = mode; - } - } - return cNode; } --- 376,379 ---- *************** *** 980,984 **** buffer[--start] = what[0]; irc_mode(who, channel, buffer+start); - start = sizeof(buffer)-1; } } --- 603,606 ---- *************** *** 995,998 **** --- 617,621 ---- for (i=0; i<count; i++) { + #ifdef WITH_PROTOCOL_P10 if ((start < queued+3+COMBO_NUMERIC_LEN) || (queued >= MAXMODEPARAMS)) { while (queued) { *************** *** 1007,1010 **** --- 630,647 ---- start -= len; memcpy(buffer+start, list[i]->numeric, len); + #else + 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); + #endif buffer[--start] = ' '; queued++; Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** global.c 19 Jun 2002 03:22:42 -0000 1.42 --- global.c 26 Jun 2002 11:45:28 -0000 1.43 *************** *** 37,41 **** #include "conf.h" #include "hash.h" - #include "parse.h" #include "log.h" #include "nickserv.h" --- 37,40 ---- *************** *** 361,366 **** } - #define notice_user(USER, MESSAGE) notice_target((USER)->numeric, MESSAGE) - static int notice_channel(const char *key, void *data, void *extra) --- 360,363 ---- *************** *** 402,406 **** if(user->uplink != self) { ! notice_user(user, message); } } --- 399,403 ---- if(user->uplink != self) { ! notice_target(user->nick, message); } } *************** *** 413,417 **** user = curr_helpers.list[n]; if (IsOper(user)) continue; ! notice_user(user, message); } } --- 410,414 ---- user = curr_helpers.list[n]; if (IsOper(user)) continue; ! notice_target(user->nick, message); } } *************** *** 605,609 **** table.contents[nn][4] = strdup(buffer); } ! table_send(global, user->numeric, 0, NULL, table); for (nn=1; nn<table.length; nn++) { --- 602,606 ---- table.contents[nn][4] = strdup(buffer); } ! table_send(global, user->nick, 0, NULL, table); for (nn=1; nn<table.length; nn++) { *************** *** 675,680 **** if(message->flags & mask) { ! if (obstreperize && !count) send_target_message(0, user->numeric, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); ! notice_user(user, message); count++; } --- 672,677 ---- if(message->flags & mask) { ! if (obstreperize && !count) send_target_message(0, user->nick, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); ! notice_target(user->nick, message); count++; } *************** *** 682,686 **** message = message->next; } ! if (obstreperize && count) send_target_message(0, user->numeric, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } --- 679,683 ---- message = message->next; } ! if (obstreperize && count) send_target_message(0, user->nick, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } *************** *** 1003,1007 **** { global = AddService(nick, "Global Services"); ! reg_privmsg_func(global->num_local, global_privmsg); reg_new_user_func(global_process_user); reg_auth_func(global_process_auth); --- 1000,1004 ---- { global = AddService(nick, "Global Services"); ! reg_privmsg_func(global, global_privmsg); reg_new_user_func(global_process_user); reg_auth_func(global_process_auth); Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -r1.232 -r1.233 *** chanserv.c 24 Jun 2002 18:52:48 -0000 1.232 --- chanserv.c 26 Jun 2002 11:45:28 -0000 1.233 *************** *** 45,50 **** #include "helpfile.h" #include "log.h" - #include "parse.h" - #include "proto.h" #include "global.h" #include "nickserv.h" --- 45,48 ---- *************** *** 472,476 **** return 0; } - extern unsigned int server_count; extern time_t boot_time; extern struct policer_params *oper_policer_params, *luser_policer_params, *god_policer_params; --- 470,473 ---- *************** *** 483,487 **** static dict_t sChannels; static dict_t plain_dnrs, mask_dnrs, handle_dnrs; - static dict_t switch_dict; /* holds struct channel_trans* */ static struct --- 480,483 ---- *************** *** 513,523 **** char *ctcp_short_ban_duration; char *ctcp_long_ban_duration; - - /* only used if TRANSITION enabled */ - const char *old_chanserv_name; - unsigned int max_switch_load; - unsigned int switch_timeout; - regex_t access_regex; - regex_t auth_regex; } chanserv_conf; --- 509,512 ---- *************** *** 2165,2169 **** } ! if(new_channel) channel = AddChannel(argv[1], now, "", "", 0, chanserv->numeric, NULL); cData = register_channel(user->handle_info->handle, NULL, NULL, NULL, NULL, 0, channel); --- 2154,2162 ---- } ! if(new_channel) ! { ! channel = AddChannel(argv[1], now, "", "", 0, NULL); ! AddChannelUser(chanserv, channel); ! } cData = register_channel(user->handle_info->handle, NULL, NULL, NULL, NULL, 0, channel); *************** *** 2288,2292 **** } ! target = AddChannel(argv[1], now, "", "", 0, chanserv->numeric, NULL);; new_channel = 1; } --- 2281,2286 ---- } ! target = AddChannel(argv[1], now, "", "", 0, NULL); ! AddChannelUser(chanserv, target); new_channel = 1; } *************** *** 3052,3056 **** static CHANSERV_FUNC(cmd_down) { ! char change[6 + (2 * COMBO_NUMERIC_LEN)]; struct modeNode *mn; (void)argv;(void)argc; --- 3046,3050 ---- static CHANSERV_FUNC(cmd_down) { ! char change[MAXLEN]; struct modeNode *mn; (void)argv;(void)argc; *************** *** 3072,3076 **** --- 3066,3074 ---- DelChannelVoice(1, &user, channel, chanserv, 0); + #ifdef WITH_PROTOCOL_P10 sprintf(change, "-ov %s %s", user->numeric, user->numeric); + #else + sprintf(change, "-ov %s %s", user->nick, user->nick); + #endif irc_mode(chanserv, channel, change); *************** *** 4442,4449 **** chanserv_notice(user, CSMSG_NETWORK_INFO); ! chanserv_notice(user, CSMSG_NETWORK_SERVERS, server_count); chanserv_notice(user, CSMSG_NETWORK_USERS, dict_size(clients)); chanserv_notice(user, CSMSG_NETWORK_OPERS, curr_opers.used); - chanserv_notice(user, CSMSG_NETWORK_CHANNELS, registered_channels); --- 4440,4446 ---- chanserv_notice(user, CSMSG_NETWORK_INFO); ! chanserv_notice(user, CSMSG_NETWORK_SERVERS, dict_size(servers)); chanserv_notice(user, CSMSG_NETWORK_USERS, dict_size(clients)); chanserv_notice(user, CSMSG_NETWORK_OPERS, curr_opers.used); chanserv_notice(user, CSMSG_NETWORK_CHANNELS, registered_channels); *************** *** 4505,4509 **** table.length++; } ! table_send(chanserv, to->numeric, 0, NULL, table); } --- 4502,4506 ---- table.length++; } ! table_send(chanserv, to->nick, 0, NULL, table); } *************** *** 4562,4566 **** table.length++; } ! table_send(chanserv, user->numeric, 0, NULL, table); return 1; --- 4559,4563 ---- table.length++; } ! table_send(chanserv, user->nick, 0, NULL, table); return 1; *************** *** 4975,4979 **** dict_remove(sChannels, suspended->name); ! channel = AddChannel(suspended->name, now, NULL, NULL, 0, chanserv->numeric, NULL); AddChannelOp(1, &chanserv, channel, chanserv, 1); channel->channel_info = suspended->cData; --- 4972,4977 ---- dict_remove(sChannels, suspended->name); ! channel = AddChannel(suspended->name, now, NULL, NULL, 0, NULL); ! AddChannelUser(chanserv, channel); AddChannelOp(1, &chanserv, channel, chanserv, 1); channel->channel_info = suspended->cData; *************** *** 6046,6050 **** char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_UNF_RESPONSE); ! irc_privmsg(chanserv->numeric, channel->name, response); } else --- 6044,6048 ---- char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_UNF_RESPONSE); ! irc_privmsg(chanserv, channel->name, response); } else *************** *** 6063,6071 **** char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_PING_RESPONSE); ! irc_privmsg(chanserv->numeric, channel->name, response); } else { ! irc_privmsg(chanserv->numeric, channel->name, CSMSG_PING_RESPONSE); } return 1; --- 6061,6069 ---- char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_PING_RESPONSE); ! irc_privmsg(chanserv, channel->name, response); } else { ! irc_privmsg(chanserv, channel->name, CSMSG_PING_RESPONSE); } return 1; *************** *** 6080,6084 **** char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_WUT_RESPONSE); ! irc_privmsg(chanserv->numeric, channel->name, response); } else --- 6078,6082 ---- char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, CSMSG_WUT_RESPONSE); ! irc_privmsg(chanserv, channel->name, response); } else *************** *** 6106,6110 **** char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, resp); ! irc_privmsg(chanserv->numeric, channel->name, response); } else --- 6104,6108 ---- char response[MAXLEN]; sprintf(response, "%s: %s", user->nick, resp); ! irc_privmsg(chanserv, channel->name, response); } else *************** *** 6131,6135 **** char response[MAXLEN]; sprintf(response, "%s: A %d shows on the %d-sided die.", user->nick, rolled, sides); ! irc_privmsg(chanserv->numeric, channel->name, response); } else --- 6129,6133 ---- char response[MAXLEN]; sprintf(response, "%s: A %d shows on the %d-sided die.", user->nick, rolled, sides); ! irc_privmsg(chanserv, channel->name, response); } else *************** *** 6147,6155 **** char response[MAXLEN]; sprintf(response, "\001ACTION huggles %s\001", user->nick); ! irc_privmsg(chanserv->numeric, channel->name, response); } else { ! irc_privmsg(chanserv->numeric, user->numeric, "\001ACTION huggles you\001"); } return 1; --- 6145,6153 ---- char response[MAXLEN]; sprintf(response, "\001ACTION huggles %s\001", user->nick); ! irc_privmsg(chanserv, channel->name, response); } else { ! irc_privmsg(chanserv, user->nick, "\001ACTION huggles you\001"); } return 1; *************** *** 6369,6373 **** char info[MAXLEN]; sprintf(info, "[%s] %s", user->nick, uData->info); ! irc_privmsg(chanserv->numeric, channel->name, info); } --- 6367,6371 ---- char info[MAXLEN]; sprintf(info, "[%s] %s", user->nick, uData->info); ! irc_privmsg(chanserv, channel->name, info); } *************** *** 6556,6565 **** if(protect_user(victim, user, channel->channel_info)) { ! char change[7 + (2 * COMBO_NUMERIC_LEN)]; DelChannelOp(1, &user, channel, chanserv, 0); AddChannelOp(1, &victim, channel, chanserv, 0); sprintf(change, "+o-o %s %s", victim->numeric, user->numeric); irc_mode(chanserv, channel, change); --- 6554,6567 ---- if(protect_user(victim, user, channel->channel_info)) { ! char change[MAXLEN]; DelChannelOp(1, &user, channel, chanserv, 0); AddChannelOp(1, &victim, channel, chanserv, 0); + #ifdef WITH_PROTOCOL_P10 sprintf(cha... [truncated message content] |