[srvx-commits] CVS: services/src modcmd.c,1.69,1.70 modcmd.h,1.20,1.21
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-10-07 03:42:11
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv10229/src Modified Files: modcmd.c modcmd.h Log Message: check pubcmd setting in the original channel, not the target channel Index: modcmd.c =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -r1.69 -r1.70 *** modcmd.c 5 Oct 2003 03:27:49 -0000 1.69 --- modcmd.c 7 Oct 2003 03:42:06 -0000 1.70 *************** *** 438,442 **** int svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, int options) { - extern struct userNode *chanserv; unsigned int uData_checked = 0; struct userData *uData = NULL; --- 438,441 ---- *************** *** 526,554 **** } } - /* Count the abstraction violations while we support !set pubcmd.. */ - if ((options & SVCCMD_IN_CHANNEL) && channel - && (bot == chanserv) && channel->channel_info - && (channel->channel_info->options[optPubCmd] != 'a')) { - char pubcmd = channel->channel_info->options[optPubCmd]; - int prohibit = 0; - if (!uData_checked) - uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; - if (uData) - switch (pubcmd) { - case 'p': prohibit = uData->access < ulPeon; break; - case 'o': prohibit = uData->access < ulOp; break; - case 'm': prohibit = uData->access < ulMaster; break; - case 'c': prohibit = uData->access < ulCoowner; break; - case 'w': prohibit = uData->access < ulOwner; break; - case 'n': prohibit = uData->access < ulHelper; break; - } - else - prohibit = 1; - if (prohibit) { - if (options & SVCCMD_NOISY) - send_message(user, bot, MCMSG_PUBLIC_DENY, channel->name); - return 0; - } - } if (flags & MODCMD_REQUIRE_STAFF) { if (((flags & MODCMD_REQUIRE_OPER) && IsOper(user)) --- 525,528 ---- *************** *** 652,660 **** int svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified) { struct svccmd *cmd; unsigned int cmd_arg, perms, flags, options; char channel_name[CHANNELLEN+1]; ! options = (server_qualified ? SVCCMD_QUALIFIED : 0) | (channel ? SVCCMD_IN_CHANNEL : 0) | SVCCMD_DEBIT | SVCCMD_NOISY; /* Find the command argument. */ cmd_arg = IsChannelName(argv[0]) ? 1 : 0; --- 626,658 ---- int svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified) { + extern struct userNode *chanserv; struct svccmd *cmd; unsigned int cmd_arg, perms, flags, options; char channel_name[CHANNELLEN+1]; ! /* First check pubcmd for the channel (while smashing abstraction ! * barriers left and right). */ ! if (channel && (channel->channel_info) && (service->bot == chanserv) ! && (channel->channel_info->options[optPubCmd] != 'a')) { ! struct userData *uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0); ! char pubcmd = channel->channel_info->options[optPubCmd]; ! int prohibit = 0; ! if (!uData) ! prohibit = 1; ! else switch (pubcmd) { ! case 'p': prohibit = uData->access < ulPeon; break; ! case 'o': prohibit = uData->access < ulOp; break; ! case 'm': prohibit = uData->access < ulMaster; break; ! case 'c': prohibit = uData->access < ulCoowner; break; ! case 'w': prohibit = uData->access < ulOwner; break; ! case 'n': prohibit = uData->access < ulHelper; break; ! } ! if (prohibit) { ! send_message(user, service->bot, MCMSG_PUBLIC_DENY, channel->name); ! return 0; ! } ! } ! ! options = (server_qualified ? SVCCMD_QUALIFIED : 0) | SVCCMD_DEBIT | SVCCMD_NOISY; /* Find the command argument. */ cmd_arg = IsChannelName(argv[0]) ? 1 : 0; Index: modcmd.h =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** modcmd.h 29 Jul 2003 01:50:48 -0000 1.20 --- modcmd.h 7 Oct 2003 03:42:07 -0000 1.21 *************** *** 70,74 **** #define SVCCMD_DEBIT 0x000002 #define SVCCMD_NOISY 0x000004 - #define SVCCMD_IN_CHANNEL 0x000008 /* Modularized commands work like this: --- 70,73 ---- |