[X2serv-cvs] [CVS] Module x3: Change committed
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2005-06-02 23:17:25
|
Committer : Alex Schumann <ru...@us...> CVSROOT : /cvsroot/x2serv Module : x3 Commit time: 2005-06-02 23:17:17 UTC Modified files: ChangeLog.X3 src/chanserv.c src/chanserv.help Log message: Improved usability of the REGISTER command, in preperation to make it usable by users ---------------------- diff included ---------------------- Index: x3/ChangeLog.X3 diff -u x3/ChangeLog.X3:1.37 x3/ChangeLog.X3:1.38 --- x3/ChangeLog.X3:1.37 Fri May 27 22:41:15 2005 +++ x3/ChangeLog.X3 Thu Jun 2 16:16:56 2005 @@ -3,6 +3,12 @@ 2005-05-27 Alex Schumann <ru...@af...> + * src/chanserv.c: Improved usability of register command + + * src/chanserv.help: Improved usability of register command + +2005-05-27 Alex Schumann <ru...@af...> + * src/chanserv.c: Resync working now 2005-05-27 Reed Loden <re...@re...> @@ -245,5 +251,5 @@ ***********************************************************************/ -#define CVS_VERSION "$Revision: 1.37 $" +#define CVS_VERSION "$Revision: 1.38 $" Index: x3/src/chanserv.c diff -u x3/src/chanserv.c:1.31 x3/src/chanserv.c:1.32 --- x3/src/chanserv.c:1.31 Fri May 27 22:41:15 2005 +++ x3/src/chanserv.c Thu Jun 2 16:16:57 2005 @@ -129,9 +129,11 @@ { "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 @@ char *chan_name; unsigned int new_channel, force=0; struct do_not_register *dnr; + unsigned int n; + if(channel) { @@ -1902,8 +1906,7 @@ 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 @@ 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 @@ 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: x3/src/chanserv.help diff -u x3/src/chanserv.help:1.17 x3/src/chanserv.help:1.18 --- x3/src/chanserv.help:1.17 Wed May 18 11:37:34 2005 +++ x3/src/chanserv.help Thu Jun 2 16:17:07 2005 @@ -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 <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"); ----------------------- End of diff ----------------------- |