more bug fixes from GameSurge
authorEntrope <entrope@clan-dk.org>
Sat, 28 Feb 2004 21:33:30 +0000 (21:33 +0000)
committerEntrope <entrope@clan-dk.org>
Sat, 28 Feb 2004 21:33:30 +0000 (21:33 +0000)
* Refuse to let an owner !set setters 501.

* Report proper level range when using !trim users <duration>.

* Refuse to let anyone !set <numericoption> 502, etc.

* Refuse to let people below owner level !set <numericoption> 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
src/chanserv.help

index 1da686389b8cae35d761544ba03c824685535624..236e980e2f8e5430354567a7d38addbfd2d0faed 100644 (file)
@@ -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);
     }
index 2971dc1ba05d539e201af98b19a141c5b126bb19..df1495d3573dc4fcc7873e13684c3fc23ff3b064 100644 (file)
 "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> [<confirmation>]",
         "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> <nick|*account>",
         "This restores the target's access to the channel (after it has been suspended).",