From 006217abc60b50b042a435d83b86118d6d50230a Mon Sep 17 00:00:00 2001 From: Entrope Date: Sat, 28 Feb 2004 21:33:30 +0000 Subject: [PATCH] more bug fixes from GameSurge * Refuse to let an owner !set setters 501. * Report proper level range when using !trim users . * Refuse to let anyone !set 502, etc. * Refuse to let people below owner level !set above their level. * Make !d 1d6+5 work. * Mark users as seen/present AFTER deciding whether to show their infoline, and PRIVMSG infolines rather than NOTICE them. * Translate "CSMSG_USER_PROTECTED" (kick protection enforcement message). * Enforce plain mode changes, not just ops/deops/bans etc. * Fix documentation for ChanServ UNREGISTER command. git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-12 --- src/chanserv.c | 33 ++++++++++++++++++++++----------- src/chanserv.help | 4 ++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/chanserv.c b/src/chanserv.c index 1da6863..236e980 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -237,6 +237,7 @@ static const struct message_entry msgtab[] = { { "CSMSG_CONFIRM_DEFAULTS", "To reset %s's settings to the defaults, you muse use 'set defaults %s'." }, { "CSMSG_SETTINGS_DEFAULTED", "All settings for %s have been reset to default values." }, { "CSMSG_BAD_SETLEVEL", "You cannot change any setting to above your level." }, + { "CSMSG_BAD_SETTERS", "You cannot change Setters to above your level." }, { "CSMSG_INVALID_MODE_LOCK", "$b%s$b is an invalid mode lock." }, { "CSMSG_INVALID_NUMERIC", "$b%d$b is not a valid choice. Choose one:" }, { "CSMSG_SET_DEFAULT_TOPIC", "$bDefaultTopic$b %s" }, @@ -2413,6 +2414,11 @@ cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short m } } + if(!max_access) + { + min_access = 1; + max_access = UL_OWNER; + } send_message(user, chanserv, "CSMSG_TRIMMED_USERS", count, min_access, max_access, channel->name, intervalString(interval, duration)); return 1; } @@ -4941,17 +4947,22 @@ channel_level_option(enum levelOption option, struct userNode *user, struct chan return 0; } value = user_level_from_name(argv[1], UL_OWNER+1); - if(!value && !isdigit(argv[1][0])) + if(!value && strcmp(argv[1], "0")) { reply("CSMSG_INVALID_ACCESS", argv[1]); return 0; } uData = GetChannelUser(cData, user->handle_info); - if(!uData) + if(!uData || ((uData->access < UL_OWNER) && (value > uData->access))) { reply("CSMSG_BAD_SETLEVEL"); return 0; } + if((option == lvlSetters) && (value > uData->access)) + { + reply("CSMSG_BAD_SETTERS"); + return 0; + } cData->lvlOpts[option] = value; } reply(levelOptions[option].format_name, cData->lvlOpts[option]); @@ -5517,10 +5528,12 @@ static CHANSERV_FUNC(cmd_d) const char *fmt; REQUIRE_PARAMS(2); - if((count = strtoul(argv[1], &sep, 10)) <= 1) + if((count = strtoul(argv[1], &sep, 10)) < 1) goto no_dice; if(sep[0] == 0) { + if(count == 1) + goto no_dice; sides = count; count = 1; modifier = 0; @@ -5563,7 +5576,7 @@ static CHANSERV_FUNC(cmd_d) sprintf(response, fmt, total, sides); } if(channel) - send_target_message(5, channel->name, cmd->parent->bot, "$b%s$b: %s", user->nick, response); + send_channel_message(channel, cmd->parent->bot, "$b%s$b: %s", user->nick, response); else send_message_type(4, user, cmd->parent->bot, "%s", response); return 1; @@ -5767,10 +5780,6 @@ handle_join(struct modeNode *mNode) } if(uData->access >= UL_PRESENT) cData->visited = now; - - uData->seen = now; - uData->present = 1; - if(cData->user_greeting) greeting = cData->user_greeting; if(uData->info @@ -5778,6 +5787,8 @@ handle_join(struct modeNode *mNode) && ((now - uData->seen) >= chanserv_conf.info_delay) && !uData->present) info = 1; + uData->seen = now; + uData->present = 1; } } if(!user->uplink->burst) @@ -5791,7 +5802,7 @@ handle_join(struct modeNode *mNode) if(greeting && !user->uplink->burst) send_message_type(4, user, chanserv, "(%s) %s", channel->name, greeting); if(uData && info) - send_target_message(4, channel->name, chanserv, "[%s] %s", user->nick, uData->info); + send_target_message(5, channel->name, chanserv, "[%s] %s", user->nick, uData->info); } return 0; } @@ -5929,7 +5940,7 @@ handle_part(struct userNode *user, struct chanNode *channel, UNUSED_ARG(const ch static void handle_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *channel) { - char *reason = "CSMSG_USER_PROTECTED"; + const char *reason = user_find_message(kicker, "CSMSG_USER_PROTECTED"); if(!channel->channel_info || !kicker || IsService(kicker) || (kicker == victim) || IsSuspended(channel->channel_info) @@ -6033,7 +6044,7 @@ handle_mode(struct chanNode *channel, struct userNode *user, const struct mod_ch } if(bounce) { - if((bounce->argc = bnc)) + if((bounce->argc = bnc) || bounce->modes_set || bounce->modes_clear) mod_chanmode_announce(chanserv, channel, bounce); mod_chanmode_free(bounce); } diff --git a/src/chanserv.help b/src/chanserv.help index 2971dc1..df1495d 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -413,9 +413,9 @@ "UNBANME" ("/msg $C UNBANME <#channel>", "Unbans your hostmask from the specified channel.", "$bSee Also:$b ban, unban"); -"UNREGISTER" ("/msg $C UNREGISTER <#channel>", +"UNREGISTER" ("/msg $C UNREGISTER <#channel> []", "Unregisters a channel that is registered with $b$C$b. $bIMPORTANT$b: Once the channel is unregistered, the userlist $bcannot$b be recovered.", - "If you are not network staff, you must add $bCONFIRM$b to the end of your line to confirm channel unregistration.", + "If you are not network staff, you must add a confimation string to the end of your line to confirm the unregistration. If you leave it out, $C will show the proper confirmation string.", "$bSee Also:$b register"); "UNSUSPEND" ("/msg $C UNSUSPEND <#channel> ", "This restores the target's access to the channel (after it has been suspended).", -- 2.20.1