Fix bugs found on GameSurge
authorEntrope <entrope@clan-dk.org>
Sat, 28 Feb 2004 19:08:13 +0000 (19:08 +0000)
committerEntrope <entrope@clan-dk.org>
Sat, 28 Feb 2004 19:08:13 +0000 (19:08 +0000)
* Remove unused ARCH_REVISION macro in Makefile.am

* Fix !trim <userlevel> <duration> (so it does not trim ALL users)

* Properly allow owners to set levels to 501

* Set "deopped" when we deop the person who changed modes

* Mark the first user in a channel as a chanop (fixes a spurious
  HACK(4) for newly registered channels).

* Document user level ranges for the TRIM command.

* Document user-level-based SET options as being such (rather than
being multiple-choice options).
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-11

src/Makefile.am
src/chanserv.c
src/chanserv.help
src/hash.c

index 68b680427af82cbf0baeb5a2e8d788e8d2673700..c31f287bb1350e0edd6ca7abd522abc7e1dc7f8c 100644 (file)
@@ -1,7 +1,6 @@
 AM_CPPFLAGS = @RX_INCLUDES@
 LIBS = @LIBS@ @RX_LIBS@
 
-ARCH_REVISION=$(shell tla logs -f | tail -n 1)
 noinst_PROGRAMS = srvx
 EXTRA_PROGRAMS = checkdb globtest
 noinst_DATA = chanserv.help global.help modcmd.help nickserv.help opserv.help saxdb.help sendmail.help mod-sockcheck.help mod-helpserv.help mod-memoserv.help
index b5e3d1e6a97e6f22691986a65947787b591ded43..1da686389b8cae35d761544ba03c824685535624 100644 (file)
@@ -2406,7 +2406,7 @@ cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short m
            continue;
 
        if(((uData->access >= min_access) && (uData->access <= max_access))
-           || (max_access && (uData->access < actor->access)))
+           || (!max_access && (uData->access < actor->access)))
        {
            del_channel_user(uData, 1);
            count++;
@@ -4947,7 +4947,7 @@ channel_level_option(enum levelOption option, struct userNode *user, struct chan
             return 0;
         }
         uData = GetChannelUser(cData, user->handle_info);
-        if(!uData || (uData->access < value))
+        if(!uData)
         {
             reply("CSMSG_BAD_SETLEVEL");
             return 0;
@@ -6000,6 +6000,7 @@ handle_mode(struct chanNode *channel, struct userNode *user, const struct mod_ch
                 bounce->args[bnc].member = GetUserMode(channel, user);
                 if(bounce->args[bnc].member)
                     bnc++;
+                deopped = 1;
             }
             bounce->args[bnc].mode = MODE_CHANOP;
             bounce->args[bnc].member = change->args[ii].member;
index 1e9ccd030d4f9c3f15e64a87d010c05b14a0708d..2971dc1ba05d539e201af98b19a141c5b126bb19 100644 (file)
         "USERGREETING: A greeting message for users on the channel's userlist.",
         "MODES:        The channel's default modes.",
        "PUBCMD:       Restrictions to use commands in public.",
-        "STRICTOP:     Restrictions for opping users.",
-        "AUTOOP:       The users that $b$C$b will autoop.",
+        "GIVEOPS:      The users that $b$C$b will autoop.",
+        "ENFOPS:       Restrictions for opping users.",
         "ENFMODES:     Restrictions to change the default modes.",
         "ENFTOPIC:     Restrictions on changing the topic.",
         "PROTECT:      The protection level $b$C$b provides.",
         "$bIRCOP ONLY$b:",
         "NODELETE:  Prevents channel deletion.",
         "If you wish to reset your channel to the default settings, you can use the $bSET DEFAULTS$b command.",
-        "$uSee Also:$u set pubcmd, set strictop, set autoop, set enfmodes, set enftopic, set protect, set toys, set setters, set topicrefresh, set ctcpusers, set ctcpreaction, set defaults");
+        "$uSee Also:$u set pubcmd, set giveops, set enfops, set enfmodes, set enftopic, set protect, set toys, set setters, set topicrefresh, set ctcpusers, set ctcpreaction, set defaults");
 "SET DEFAULTTOPIC" ("/msg $C SET <#channel> DEFAULTTOPIC <New default topic>",
         "This changes the default topic for the channel.  $C will set the IRC topic to this value when the $btopic$b command is used with no arguments, when the topic refresh happens (if you have $bset topicrefresh$b), or when an unauthorized user changes the topic to something else.",
         "$uSee Also:$u set, set topicrefresh, set enftopic, set topicmask");
        "$b2$b  Toys will reply publicly.",
        "$uSee Also:$u set");
 "SET PUBCMD" ("/msg $C SET <#channel> PUBCMD <value>",
-        "This setting restricts the access necessary to use in-channel commands.  Valid settings are:",
-        "$b0$b  Anyone may use public commands",
-        "$b1$b  Peons and above may use public commands",
-        "$b2$b  Ops and above may use public commands",
-        "$b3$b  Masters and above may use public commands",
-        "$b4$b  Coowners and above may use public commands",
-        "$b5$b  Only owners may use public commands",
-        "$b6$b  No one may use public commands",
+        "This setting restricts the access necessary to use in-channel commands.  It is a numeric user level, or 501 to mean no one may use public commands.",
         "$uSee Also:$u set");
-"SET STRICTOP" ("/msg $C SET <#channel> STRICTOP <value>",
-        "This setting restricts who may op users who are not at least ops on the userlist.  If $C sees someone with access below the specified access op someone not on the userlist (or who is a peon), it will deop the second user.  Valid settings are:",
-        "$b0$b  Anyone may op unknown users",
-        "$b1$b  Ops and above may op unknown users",
-        "$b2$b  Masters and above may op unknown users",
-        "$b3$b  Coowners and above may op unknown users",
-        "$b4$b  Only owners may op unknown users",
-        "$b5$b  No one may op unknown users",
+"SET ENFOPS" ("/msg $C SET <#channel> ENFOPS <value>",
+        "This setting restricts who may op users who are not at least ops on the userlist.  If $C sees someone with access below the specified access op someone not on the userlist (or who is a peon), it will deop the second user.  It is a numeric user level, or 501 to mean no one may op unrecognized users.",
         "$uSee Also:$u set");
-"SET AUTOOP" ("/msg $C SET <#channel> AUTOOP <value>",
-        "This setting restricts the minimum access someone must be to be automatically op'ed by $C.  Valid settings are:",
-        "$b0$b  Everyone will be automatically op'ed",
-        "$b1$b  Ops and above will be automatically op'ed",
-        "$b2$b  Masters and above will be automatically op'ed",
-        "$b3$b  Coowners and above will be automatically op'ed",
-        "$b4$b  Only owners will be automatically op'ed",
-        "$b5$b  No one will be automatically op'ed",
+"SET GIVEOPS" ("/msg $C SET <#channel> GIVEOPS <value>",
+        "This setting restricts the minimum access someone must be to be automatically op'ed by $C.  It is a numeric user level.",
         "$uSee Also:$u set");
 "SET ENFMODES" ("/msg $C SET <#channel> ENFMODES <value>",
-        "This setting restricts the minimum access someone must have to change the channel modes from what is specified in the channel settings.  Valid settings are:",
-        "$b0$b  Anyone may override the mode lock",
-        "$b1$b  Ops and above may override the mode lock",
-        "$b2$b  Masters and above may override the mode lock",
-        "$b3$b  Coowners and above may override the mode lock",
-        "$b4$b  Only owners may override the mode lock",
-        "$b5$b  No one may override the mode lock",
+        "This setting restricts the minimum access someone must have to change the channel modes from what is specified in the channel settings.  It is a numeric user level, or 501 to mean no one may override the default modes.",
         "$uSee Also:$u set");
 "SET ENFTOPIC" ("/msg $C SET <#channel> ENFTOPIC <value>",
-        "This setting restricts the minimum access someone must have to change the channel topic.  Valid settings are:",
-        "$b0$b  Anyone may change the topic",
-        "$b1$b  Ops and above may change the topic",
-        "$b2$b  Masters and above may change the topic",
-        "$b3$b  Coowners and above may change the topic",
-        "$b4$b  Only owners may change the topic",
-        "$b5$b  No one may change the topic",
+        "This setting restricts the minimum access someone must have to change the channel topic.  It is a numeric user level, or 501 to mean no one may override the default topic.",
         "If a topic mask is set, then a person may change the topic as long as it matches that mask $bor$b they have the above access.",
         "If no topic mask is set, then a person must have the above access to change the topic from the default.",
         "$uSee Also:$u set, set topic, set topicmask");
         "$b3$b  No users will be protected.",
         "$uSee Also:$u set");
 "SET SETTERS" ("/msg $C SET <#channel> SETTERS <value>",
-        "This setting restricts the protection that $C enforces.  Valid settings are:",
-        "$b0$b  Masters and above may change settings.",
-        "$b1$b  Co-owners and above may change settings.",
-        "$b2$b  Only owners may change settings.",
+        "This setting restricts the protection that $C enforces.  It is a numeric user level.",
         "$uSee Also:$u set");
 "SET TOPICREFRESH" ("/msg $C SET <#channel> TOPICREFRESH <value>",
         "This setting controls if (and how often) $C refreshes the topic to the default value.  Valid settings are:",
         "$b4$b  Refresh every 24 hours.",
         "$uSee Also:$u set, set topic");
 "SET CTCPUSERS" ("/msg $C SET <#channel> CTCPUSERS <value>",
-        "This setting controls who is allowed to send CTCPs to the channel.  CTCP ACTION, the way that /me is implemented, are always allowed:",
-        "$b0$b  Anyone may send CTCPs to the channel.",
-        "$b1$b  Peons and above may send CTCPs to the channel.",
-        "$b2$b  Ops and above may send CTCPs to the channel.",
-        "$b3$b  Masters and above may send CTCPs to the channel.",
-        "$b4$b  Coowners and above may send CTCPs to the channel.",
-        "$b5$b  Owners may send CTCPs to the channel.",
-        "$b6$b  No one may send CTCPs to the channel.",
+        "This setting controls who is allowed to send CTCPs to the channel.  CTCP ACTION, the way that /me is implemented, are always allowed.  For any other CTCP, the user must have this access level.  501 indicates no users may use CTCPs in the channel.",
         "If a user below the specified level sends a CTCP (besides ACTION) to the channel, the enforcement is specified by the $bCTCPReaction$b setting.",
         "$uSee Also:$u set, set ctcpreaction");
 "SET CTCPREACTION" ("/msg $C SET <#channel> CTCPREACTION <value>",
 "TOPIC" ("/msg $C TOPIC <#channel> [topic]",
         "Sets the current topic for the specified channel.  If no topic is specified, then set the current topic to the default topic.");
 "TRIM" ("/msg $C TRIM <#channel> <target> <duration>",
-       "The trim command removes target objects inactive for more than a certain duration from a channel. The target must be a channel access level, \"users\", or \"bans\". The duration argument specifies the amount of time the target has been inactive for to be removed.",
+       "The trim command removes target objects inactive for more than a certain duration from a channel. The target must be a channel access level, a range of access levels (for example, \"300-399\"), \"users\" or \"bans\". The duration argument specifies the amount of time the target has been inactive for to be removed.",
         "$uSee Also:$u durations");
 "UNBAN" ("/msg $C UNBAN <#channel> <mask|nick>",
         "Unbans the specified nick or hostmask. If a nick is given, $b$C$b determines what hostmask(s) to unban.",
index bd205afa7d969c1a13a8a1073b33f17107f6d3eb..92067ed4132060b020251461e39eba15963e2de5 100644 (file)
@@ -465,6 +465,9 @@ AddChannelUser(struct userNode *user, struct chanNode* channel)
        modeList_append(&channel->members, mNode);
        modeList_append(&user->channels, mNode);
 
+        if (channel->members.used == 1)
+            mNode->modes |= MODE_CHANOP;
+
         for (n=0; n<jf_used; n++) {
             /* Callbacks return true if they kick or kill the user,
              * and we can continue without removing mNode. */