From: rubin Date: Thu, 2 Jun 2005 23:17:07 +0000 (+0000) Subject: Improved usability of the REGISTER command, in preperation to make it usable by users X-Git-Tag: 1.9~647 X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/commitdiff_plain/f8f30e75066e4a0b84034e50e392ba713f27732d?hp=562697441bf6b9ec8f04f6841f4dbbaf0a92c8bb Improved usability of the REGISTER command, in preperation to make it usable by users --- diff --git a/ChangeLog.X3 b/ChangeLog.X3 index a5f4e7c..812a8b1 100644 --- a/ChangeLog.X3 +++ b/ChangeLog.X3 @@ -1,6 +1,12 @@ /*********************************************************************** X3 ChangeLog +2005-05-27 Alex Schumann + + * src/chanserv.c: Improved usability of register command + + * src/chanserv.help: Improved usability of register command + 2005-05-27 Alex Schumann * src/chanserv.c: Resync working now diff --git a/src/chanserv.c b/src/chanserv.c index 566b097..ca5e268 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -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); diff --git a/src/chanserv.help b/src/chanserv.help index 047592a..92e301c 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -378,11 +378,20 @@ "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 [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");