[srvx-commits] CVS: services/src hash.h,1.65,1.66 opserv.c,1.205,1.206 proto_bahamut.c,1.5,1.6 proto
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-08-11 16:37:39
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv23658/src Modified Files: hash.h opserv.c proto_bahamut.c proto_bahamut.h proto_ircu_p10.c tools.c Log Message: get rid of most uses of MODE_KEY and MODE_LIMIT define a few Bahamut-specific channel modes Index: hash.h =================================================================== RCS file: /cvsroot/srvx/services/src/hash.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -r1.65 -r1.66 *** hash.h 2001/08/11 02:33:31 1.65 --- hash.h 2001/08/11 16:37:36 1.66 *************** *** 31,48 **** #include "dict.h" #define MODE_CHANOP 0x0001 #define MODE_VOICE 0x0002 - #define MODE_PRIVATE 0x0004 - #define MODE_SECRET 0x0008 - #define MODE_MODERATED 0x0010 - #define MODE_TOPICLIMIT 0x0020 - #define MODE_INVITEONLY 0x0040 - #define MODE_NOPRIVMSGS 0x0080 - #define MODE_KEY 0x0100 - #define MODE_BAN 0x0200 - #define MODE_LIMIT 0x0400 ! #define FLAGS_OPER 0x0001 /* Operator +O */ ! #define FLAGS_LOCOP 0x0002 /* Local operator +o */ #define FLAGS_INVISIBLE 0x0004 /* invisible +i */ #define FLAGS_WALLOP 0x0008 /* receives wallops +w */ --- 31,55 ---- #include "dict.h" + /* in modeNode->modes */ #define MODE_CHANOP 0x0001 #define MODE_VOICE 0x0002 ! /* in chanNode->modes */ ! #define MODE_PRIVATE 0x0001 /* Private (+p) */ ! #define MODE_SECRET 0x0002 /* Secret (+s); exclusive of MODE_PRIVATE */ ! #define MODE_MODERATED 0x0004 /* Moderated (+m) */ ! #define MODE_TOPICLIMIT 0x0008 /* Topic semi-locked (+t) */ ! #define MODE_INVITEONLY 0x0010 /* Invite only (+i) */ ! #define MODE_NOPRIVMSGS 0x0020 /* No outside privmsgs (+n) */ ! #define MODE_KEY 0x0040 /* Actually only used by ChanServ */ ! #define MODE_LIMIT 0x0080 /* Actually only used by ChanServ */ ! #define MODE_REGISTERED 0x0100 /* Channel is registered (Bahamut; +r) */ ! #define MODE_REGONLY 0x0200 /* Only auth'ed users may join (Bahamut; +R) */ ! #define MODE_NOCOLOR 0x0400 /* No colored msgs to channel (Bahamut; +c) */ ! #define MODE_OPERONLY 0x0800 /* Only irc operators may join (Bahamut; +O) */ ! ! /* in userNode->modes */ ! #define FLAGS_OPER 0x0001 /* IRC Operator +O */ ! #define FLAGS_LOCOP 0x0002 /* Local Operator +o */ #define FLAGS_INVISIBLE 0x0004 /* invisible +i */ #define FLAGS_WALLOP 0x0008 /* receives wallops +w */ Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -r1.205 -r1.206 *** opserv.c 2001/08/01 22:14:35 1.205 --- opserv.c 2001/08/11 16:37:36 1.206 *************** *** 1166,1170 **** unsplit_string(argv+1, argc-1); actor = opserv_actor(channel); ! if (channel->modes & MODE_KEY) { char *mc = alloca(strlen(channel->key)+4); sprintf(mc, "-k %s", channel->key); --- 1166,1170 ---- unsplit_string(argv+1, argc-1); actor = opserv_actor(channel); ! if (channel->key[0]) { char *mc = alloca(strlen(channel->key)+4); sprintf(mc, "-k %s", channel->key); Index: proto_bahamut.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** proto_bahamut.c 2001/08/11 02:33:31 1.5 --- proto_bahamut.c 2001/08/11 16:37:36 1.6 *************** *** 361,368 **** do_chan_mode(MODE_INVITEONLY, 'i'); do_chan_mode(MODE_NOPRIVMSGS, 'n'); - do_chan_mode(MODE_KEY, 'k'); - do_chan_mode(MODE_LIMIT, 'l'); #undef do_chan_mode ! if (chan->modes & MODE_KEY) { int len = strlen(chan->key); out[pos++] = ' '; --- 361,368 ---- do_chan_mode(MODE_INVITEONLY, 'i'); do_chan_mode(MODE_NOPRIVMSGS, 'n'); #undef do_chan_mode ! if (chan->key[0]) out[pos++] = 'k'; ! if (chan->limit) out[pos++] = 'l'; ! if (chan->key[0]) { int len = strlen(chan->key); out[pos++] = ' '; *************** *** 370,374 **** pos += len; } ! if (chan->modes & MODE_LIMIT) { out[pos++] = ' '; pos += sprintf(out+pos, "%d", chan->limit); --- 370,374 ---- pos += len; } ! if (chan->limit) { out[pos++] = ' '; pos += sprintf(out+pos, "%d", chan->limit); *************** *** 407,411 **** irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! putsock("%s %s %s %s "FMT_TIME_T, from ? from->nick : self->name, CMD_MODE, target->name, modes, target->timestamp); } --- 407,411 ---- irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! putsock("%s %s %s %s", (from ? from->nick : self->name), CMD_MODE, target->name, modes); } *************** *** 512,515 **** --- 512,518 ---- return 0; } + + /* TODO: we need callbacks when clients change nicks, so we can fix + * their entry in their uplink's clients dict. */ static void Index: proto_bahamut.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** proto_bahamut.h 2001/08/11 02:33:31 1.3 --- proto_bahamut.h 2001/08/11 16:37:36 1.4 *************** *** 27,31 **** #define USER_NUMERIC_LEN 2 #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN) ! #define MAXMODEPARAMS 6 #define MAXBANS 30 #define USERARRAYSIZE 4096 --- 27,31 ---- #define USER_NUMERIC_LEN 2 #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN) ! #define MAXMODEPARAMS 512 #define MAXBANS 30 #define USERARRAYSIZE 4096 Index: proto_ircu_p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** proto_ircu_p10.c 2001/08/11 02:33:31 1.15 --- proto_ircu_p10.c 2001/08/11 16:37:36 1.16 *************** *** 469,476 **** do_chan_mode(MODE_INVITEONLY, 'i'); do_chan_mode(MODE_NOPRIVMSGS, 'n'); - do_chan_mode(MODE_KEY, 'k'); - do_chan_mode(MODE_LIMIT, 'l'); #undef do_chan_mode ! if (chan->modes & MODE_KEY) { int len = strlen(chan->key); out[pos++] = ' '; --- 469,476 ---- do_chan_mode(MODE_INVITEONLY, 'i'); do_chan_mode(MODE_NOPRIVMSGS, 'n'); #undef do_chan_mode ! if (chan->key[0]) out[pos++] = 'k'; ! if (chan->limit) out[pos++] = 'l'; ! if (chan->key[0]) { int len = strlen(chan->key); out[pos++] = ' '; *************** *** 478,482 **** pos += len; } ! if (chan->modes & MODE_LIMIT) { out[pos++] = ' '; pos += sprintf(out+pos, "%d", chan->limit); --- 478,482 ---- pos += len; } ! if (chan->limit) { out[pos++] = ' '; pos += sprintf(out+pos, "%d", chan->limit); Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -r1.87 -r1.88 *** tools.c 2001/08/01 22:14:35 1.87 --- tools.c 2001/08/11 16:37:36 1.88 *************** *** 129,132 **** --- 129,135 ---- while (*word == ' ') word++; while (1) { + /* TODO: update this to include the new Bahamut channel modes, + * but to only support them #if (PROTOCOL_CHANMODE_BITS & MODE_foo) + */ switch (*mode_change++) { case 0: *************** *** 145,155 **** case 'k': if (add) { ! channel->modes |= MODE_KEY; ! if(key) ! { safestrncpy(channel->key, key, sizeof(channel->key)); ! } ! else ! { for (n=0; *word != ' ' && *word; n++) { channel->key[n] = *word++; --- 148,154 ---- case 'k': if (add) { ! if(key) { safestrncpy(channel->key, key, sizeof(channel->key)); ! } else { for (n=0; *word != ' ' && *word; n++) { channel->key[n] = *word++; *************** *** 159,169 **** } } else { ! channel->modes &= ~MODE_KEY; } break; case 'l': if (add) { ! channel->modes |= MODE_LIMIT; ! if(limit) { channel->limit = limit; } else { --- 158,167 ---- } } else { ! channel->key[0] = 0; } break; case 'l': if (add) { ! if (limit) { channel->limit = limit; } else { *************** *** 172,181 **** while (*word != ' ' && *word) word++; while (*word == ' ') word++; - - if (!channel->limit) { - channel->modes &= ~MODE_LIMIT; - } } else { ! channel->modes &= ~MODE_LIMIT; } } --- 170,175 ---- while (*word != ' ' && *word) word++; while (*word == ' ') word++; } else { ! channel->limit = 0; } } |