[srvx-commits] CVS: services/src tools.c,1.92,1.93 proto_ircu_p10.h,1.3,1.4 proto_bahamut.h,1.5,1.6
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-08-24 21:05:33
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv17862/src Modified Files: tools.c proto_ircu_p10.h proto_bahamut.h proto.h Log Message: okay, fix some mode bugs, and next time i'll test before committing Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** tools.c 2001/08/24 20:33:45 1.92 --- tools.c 2001/08/24 21:05:31 1.93 *************** *** 88,94 **** } ! static const unsigned char *user_modes = PROTO_USER_MODE_CHARS; static unsigned char user_inverse_modes[256]; ! static const unsigned char *channel_modes = PROTO_CHANNEL_MODE_CHARS; static unsigned char channel_inverse_modes[256]; --- 88,94 ---- } ! static const unsigned char *user_modes = RFC1459_USER_MODE_CHARS PROTO_USER_MODE_CHARS; 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]; *************** *** 96,105 **** --- 96,112 ---- tools_build_inverse_modes(void) { unsigned int nn; + /* Go through and record which bit each character corresponds to. + * Since some modes don't exist in some protocols, the + * corresponding position in the *_modes string is a space; but we + * don't want to give spaces a value, so erase them afterwards. + */ for (nn=0; user_modes[nn]; nn++) { user_inverse_modes[user_modes[nn]] = nn + 1; } + user_inverse_modes[' '] = 0; for (nn=0; channel_modes[nn]; nn++) { channel_inverse_modes[channel_modes[nn]] = nn + 1; } + channel_inverse_modes[' '] = 0; } *************** *** 113,117 **** #define do_user_mode(FLAG) do { if (add) user->modes |= FLAG; else user->modes &= ~FLAG; } while (0) switch (modechar = *mode_change++) { ! case 0: return; case '+': add = 1; break; case '-': add = 0; break; --- 120,124 ---- #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; *************** *** 146,153 **** make_usermode(struct userNode *user, char *out, unsigned int len) { ! unsigned int nn, jj; len--; /* to allow for \0 at end */ ! for (nn=jj=0; user_modes[nn] && (jj<len); nn++) { ! if (user->modes & (1 << nn)) out[jj++] = user_modes[nn]; } out[jj++] = 0; --- 153,163 ---- make_usermode(struct userNode *user, char *out, unsigned int len) { ! unsigned int nn, jj=0; len--; /* to allow for \0 at end */ ! out[jj++] = '+'; ! for (nn=0; user_modes[nn] && (jj<len); nn++) { ! if ((user_modes[nn] != ' ') && (user->modes & (1 << nn))) { ! out[jj++] = user_modes[nn]; ! } } out[jj++] = 0; *************** *** 167,173 **** while (1) { switch (modechar = *mode_change++) { ! case 0: ! case ' ': ! return; case '+': add = 1; break; case '-': add = 0; break; --- 177,181 ---- while (1) { switch (modechar = *mode_change++) { ! case 0: case ' ': return; case '+': add = 1; break; case '-': add = 0; break; *************** *** 215,222 **** make_chanmode(struct chanNode *channel, char *out, unsigned int len) { ! unsigned int nn, jj; len--; /* to allow for \0 at end */ ! for (nn=jj=0; channel_modes[nn] && (jj<len); nn++) { ! if (channel->modes & (1 << nn)) out[jj++] = channel_modes[nn]; } if (channel->limit || channel->key[0]) { --- 223,233 ---- make_chanmode(struct chanNode *channel, char *out, unsigned int len) { ! unsigned int nn, jj=0; len--; /* to allow for \0 at end */ ! out[jj++] = '+'; ! for (nn=0; channel_modes[nn] && (jj<len); nn++) { ! if ((channel_modes[nn] != ' ') && (channel->modes & (1 << nn))) { ! out[jj++] = channel_modes[nn]; ! } } if (channel->limit || channel->key[0]) { Index: proto_ircu_p10.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** proto_ircu_p10.h 2001/08/19 01:28:39 1.3 --- proto_ircu_p10.h 2001/08/24 21:05:31 1.4 *************** *** 31,36 **** #define PROTO_HAS_NUMERIC 1 ! #define PROTO_USER_MODES (RFC1459_USER_MODES|FLAGS_DEAF|FLAGS_SERVICE|FLAGS_GLOBAL|FLAGS_HELPER) ! #define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS"dkgh" struct userNode_proto { --- 31,35 ---- #define PROTO_HAS_NUMERIC 1 ! #define PROTO_USER_MODE_CHARS "dkgh" struct userNode_proto { Index: proto_bahamut.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** proto_bahamut.h 2001/08/19 01:28:39 1.5 --- proto_bahamut.h 2001/08/24 21:05:31 1.6 *************** *** 24,32 **** #include "dict.h" - #define PROTO_CHANNEL_MODES (RFC1459_CHANNEL_MODES|MODE_REGISTERED|MODE_REGONLY|MODE_NOCOLOR|MODE_OPERONLY) /* note the spaces in *_MODE_CHARS; they are to cover for modes that ! * Bahamut doesn't support, but exist in successive bits of the mask ! */ ! #define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS" rRcO" struct userNode_proto { --- 24,31 ---- #include "dict.h" /* note the spaces in *_MODE_CHARS; they are to cover for modes that ! * Bahamut doesn't support, but exist in successive bits of the mask */ ! #define PROTO_USER_MODE_CHARS " h" ! #define PROTO_CHANNEL_MODE_CHARS " rRcO" struct userNode_proto { Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** proto.h 2001/08/19 03:06:09 1.38 --- proto.h 2001/08/24 21:05:31 1.39 *************** *** 67,83 **** #endif ! #ifndef PROTO_MODENODE_MODES ! #define PROTO_MODENODE_MODES RFC1459_MODENODE_MODES ! #define PROTO_MODENODE_MODE_CHARS RFC1459_MODENODE_MODE_CHARS #endif ! #ifndef PROTO_CHANNEL_MODES ! #define PROTO_CHANNEL_MODES RFC1459_CHANNEL_MODES ! #define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS #endif ! #ifndef PROTO_USER_MODES ! #define PROTO_USER_MODES RFC1459_USER_MODES ! #define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS #endif --- 67,80 ---- #endif ! #ifndef PROTO_MODENODE_MODE_CHARS ! #define PROTO_MODENODE_MODE_CHARS "" #endif ! #ifndef PROTO_CHANNEL_MODE_CHARS ! #define PROTO_CHANNEL_MODE_CHARS "" #endif ! #ifndef PROTO_USER_MODE_CHARS ! #define PROTO_USER_MODE_CHARS "" #endif |