Thread: [srvx-commits] CVS: services/src nickserv.c,1.186,1.187 modcmd.h,1.6,1.7 modcmd.c,1.15,1.16
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-08-07 01:44:33
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv11075/src
Modified Files:
nickserv.c modcmd.h modcmd.c
Log Message:
add modcmd flag for must-be-helping (and use that for nickserv level 0 commands)
log overrides properly .. note that staff-only flags will suppress the override
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -C2 -r1.186 -r1.187
*** nickserv.c 5 Aug 2002 03:22:19 -0000 1.186
--- nickserv.c 7 Aug 2002 01:44:30 -0000 1.187
***************
*** 3095,3098 ****
--- 3095,3104 ----
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, NULL);
}
+ } else if (min_level == 0) {
+ if (must_be_qualified) {
+ return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+helping", NULL);
+ } else {
+ return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+helping", NULL);
+ }
} else {
if (must_be_qualified) {
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** modcmd.h 5 Aug 2002 01:26:56 -0000 1.6
--- modcmd.h 7 Aug 2002 01:44:30 -0000 1.7
***************
*** 56,59 ****
--- 56,60 ----
#define MODCMD_REQUIRE_NETWORK_HELPER 0x080000
#define MODCMD_REQUIRE_SUPPORT_HELPER 0x100000
+ #define MODCMD_REQUIRE_HELPING 0x200000
#define MODCMD_REQUIRE_STAFF (MODCMD_REQUIRE_OPER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** modcmd.c 5 Aug 2002 19:32:20 -0000 1.15
--- modcmd.c 7 Aug 2002 01:44:30 -0000 1.16
***************
*** 40,43 ****
--- 40,44 ----
#define MCMSG_LOW_CHANNEL_ACCESS "You lack sufficient access to %s to use this command."
#define MCMSG_REQUIRES_JOINABLE "You must be in %s (or on its userlist) to use this command."
+ #define MCMSG_MUST_BE_HELPING "You must have security override (helping mode) on to use this command."
#define MCMSG_MISSING_COMMAND "You must specify a command as well as a channel."
#define MCMSG_NO_CHANNEL_BEFORE "You may not give a channel name before this command."
***************
*** 107,110 ****
--- 108,112 ----
{ "regchan", MODCMD_REQUIRE_REGCHAN },
{ "supporthelper", MODCMD_REQUIRE_SUPPORT_HELPER },
+ { "helping", MODCMD_REQUIRE_HELPING },
{ NULL, 0 }
};
***************
*** 270,274 ****
if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
! if (to->flags & MODCMD_REQUIRE_STAFF) to->flags |= MODCMD_REQUIRE_AUTHED;
}
--- 272,276 ----
if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
! if (to->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING)) to->flags |= MODCMD_REQUIRE_AUTHED;
}
***************
*** 451,454 ****
--- 453,459 ----
}
}
+ if ((cmd->flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
+ send_message(user, bot, MCMSG_MUST_BE_HELPING);
+ }
if (cmd->min_opserv_level > 0) {
if (!oper_has_access(user, bot, cmd->min_opserv_level, 0)) return 0;
***************
*** 471,474 ****
--- 476,485 ----
}
+ /* If it's an override, return a special value. */
+ if ((cmd->flags & MODCMD_REQUIRE_CHANUSER)
+ && (uData->access > ulOwner)
+ && !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
+ return 2;
+ }
return 1;
}
***************
*** 533,537 ****
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, *pcmd;
! unsigned int cmd_arg;
/* Find the command argument. */
--- 544,548 ----
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, *pcmd;
! unsigned int cmd_arg, perms;
/* Find the command argument. */
***************
*** 598,602 ****
return 0;
}
! if (!svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1)) return 0;
pcmd->uses++;
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
--- 609,614 ----
return 0;
}
! perms = svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1);
! if (!perms) return 0;
pcmd->uses++;
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
***************
*** 615,619 ****
pos += sprintf(logbuf+pos, "/%s@%s/%ld.%ld.%ld.%ld", user->ident, user->hostname, (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
}
! pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
--- 627,637 ----
pos += sprintf(logbuf+pos, "/%s@%s/%ld.%ld.%ld.%ld", user->ident, user->hostname, (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
}
! if (user->handle_info) {
! pos += sprintf(logbuf+pos, ":%s", user->handle_info->handle);
! if (perms & 2) {
! pos += sprintf(logbuf+pos, ":override");
! }
! }
! pos += sprintf(logbuf+pos, "]: ");
unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
***************
*** 1110,1113 ****
--- 1128,1135 ----
send_message(user, cmd->parent->bot, MCMSG_NEED_NOTHING, collapsed.name);
return 1;
+ }
+ if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_HELPING) {
+ send_message(user, cmd->parent->bot, MCMSG_MUST_BE_HELPING);
+ shown_flags |= MODCMD_REQUIRE_AUTHED | MODCMD_REQUIRE_STAFF;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_STAFF) {
|