]> jfr.im git - irc/evilnet/x3.git/commitdiff
Improved usability of the REGISTER command, in preperation to make it usable by users
authorrubin <redacted>
Thu, 2 Jun 2005 23:17:07 +0000 (23:17 +0000)
committerrubin <redacted>
Thu, 2 Jun 2005 23:17:07 +0000 (23:17 +0000)
ChangeLog.X3
src/chanserv.c
src/chanserv.help

index a5f4e7c93141e28ecdef7eaf9151f945325a6759..812a8b132e3c20c8d3a2260bdf342024a8edd4fe 100644 (file)
@@ -1,6 +1,12 @@
 /***********************************************************************
  X3 ChangeLog
 
+2005-05-27  Alex Schumann  <rubin@afternet.org>
+
+       * src/chanserv.c: Improved usability of register command
+
+       * src/chanserv.help: Improved usability of register command
+
 2005-05-27  Alex Schumann  <rubin@afternet.org>
 
        * src/chanserv.c: Resync working now
index 566b09758eff81b3ea62ee1fdb3b8483ee70545f..ca5e2684147641e9c9bd46598449d44ccf6a8124 100644 (file)
@@ -129,9 +129,11 @@ static const struct message_entry msgtab[] = {
     { "CSMSG_REG_SUCCESS", "You now have ownership of $b%s$b." },
     { "CSMSG_PROXY_SUCCESS", "%s now has ownership of $b%s$b." },
     { "CSMSG_ALREADY_REGGED", "$b%s$b is registered to someone else." },
-    { "CSMSG_MUST_BE_OPPED", "You must be a channel operator in $b%s$b to register it." },
+    { "CSMSG_MUST_BE_OPPED", "You must be a channel operator (+o) in $b%s$b to register it." },
     { "CSMSG_PROXY_FORBIDDEN", "You may not register a channel for someone else." },
-    { "CSMSG_OWN_TOO_MANY", "%s already owns enough channels (at least %d); use FORCE to override." },
+    { "CSMSG_OWN_TOO_MANY", "%s already owns more than the limit of %d channels. Use FORCE to override." },
+    { "CSMSG_YOU_OWN_TOO_MANY", "You already own more than the limit of %d channels. Ask a staff member for help." },
+    { "CSMSG_ANOTHER_SERVICE", "Another service bot is in that channel already. Ask a staff member for help." },
 
 /* Do-not-register channels */
     { "CSMSG_NOT_DNR", "$b%s$b is not a valid channel name or *account." },
@@ -1887,6 +1889,8 @@ static CHANSERV_FUNC(cmd_register)
     char *chan_name;
     unsigned int new_channel, force=0;
     struct do_not_register *dnr;
+    unsigned int n;
+
 
     if(channel)
     {
@@ -1902,8 +1906,7 @@ static CHANSERV_FUNC(cmd_register)
             return 0;
         }
 
-        if(!IsHelping(user)
-           && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP)))
+        if(!IsHelping(user) && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP)))
         {
             reply("CSMSG_MUST_BE_OPPED", channel->name);
             return 0;
@@ -1948,11 +1951,36 @@ static CHANSERV_FUNC(cmd_register)
             return 0;
         force = (argc > (new_channel+2)) && !irccasecmp(argv[new_channel+2], "force");
         dnr = chanserv_is_dnr(chan_name, handle);
+
+        /* Check if they are over the limit.. */
+        if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force)
+        {
+            reply("CSMSG_OWN_TOO_MANY", handle->handle, chanserv_conf.max_owned);
+            return 0;
+        }
+
     }
     else
     {
-       handle = user->handle_info;
+        handle = user->handle_info;
         dnr = chanserv_is_dnr(chan_name, handle);
+        /* Check if they are over the limit.. */
+        if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force)
+        {
+            reply("CSMSG_YOU_OWN_TOO_MANY", chanserv_conf.max_owned);
+            return 0;
+        }
+        /* Check if another service is in the channel */
+        if(channel)
+            for(n = 0; n < channel->members.used; n++)
+            {
+                mn = channel->members.list[n];
+                if((mn && mn->user && (mn->user->modes & FLAGS_SERVICE)) || IsLocal(mn->user))
+                {
+                    reply("CSMSG_ANOTHER_SERVICE");
+                    return 0;
+                }
+            }
     }
     if(dnr && !force)
     {
@@ -1963,11 +1991,13 @@ static CHANSERV_FUNC(cmd_register)
         return 0;
     }
 
+    /* now handled above for message specilization *
     if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force)
     {
         reply("CSMSG_OWN_TOO_MANY", handle->handle, chanserv_conf.max_owned);
         return 0;
     }
+    */
 
     if(new_channel)
         channel = AddChannel(argv[1], now, NULL, NULL, NULL);
index 047592a72a7c1ff764086beb4117d1524e65a0a7..92e301c7c00a6be0c06d1e7f890c8014e5a527c5 100644 (file)
 "PLIST" ("/msg $C PLIST <#channel>",
         "This command lists all users of level $bPeon$b on a channel's userlist. If a mask is supplied, only peons matching the mask will be shown.",
         "$uSee Also:$u addpeon, delpeon, mdelpeon, users");
-"REGISTER" ("/msg $C REGISTER <#channel> [user|*account] [force]",
-        "Registers a channel with $b$C$b, automatically granting owner access to the specified user. If no user is provided, $b$C$b gives owner access to the user executing the command.",
-        "If the registrar is on the network staff and provides the third argument, $bforce$b, it will allow a do-not-register channel to be registered anyway.",
-        "In addition, $bregister$b will only allow one user to own a certain number of channels without the $bforce$b argument.",
-        "$uSee Also:$u addowner, noregister, unregister");
+
+"REGISTER" (
+        "/msg $C REGISTER <#channel>",
+        "Registers a channel to you with $b$C$b.  X3 will protect your channel, preserve your ownership of the channel, and provide handy features such as userlists and stats.",
+        "If the channel exists, you must have ops (+o) and there is a limit to the number of channels you may have at once.",
+        "Network staff see /MSG $C HELP STAFF REGISTER",
+        "$uSee Also:$u unregister, giveownership");
+
+"STAFF REGISTER" (
+        "/msg $C REGISTER <#channel> [user|*account] [force]",
+        "Registers a channel to the givin user with $b$C$b.",
+        "If staff provides the third argument, $bforce$b, it will allow the registration even if it is a do-not-register channel or ther register limit will be exceded.",
+        "$uSee Also:$u addowner, noregister, register, unregister");
+
 "REMOVENOTE" ("/msg $S REMOVENOTE <typename> [FORCE]",
         "Permanently deletes a note type.  Without the argument $bFORCE$b, it will only delete an unused note type.  With the argument $bFORCE$b, it will delete the note from all channels and then delete the note type.",
         "$uSee Also:$u createnote");