* CMDDESC: Gives total control over a channel to another user.
* CMDFUNC: csc_dogiveowner
* CMDPROTO: int csc_dogiveowner(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: GIVEOWNER <channel> <user> [<code>]
+ * CMDHELP: Gives complete control (+n flag) to the named user on the channel. The new owner
+ * CMDHELP: will have full control over the channel, including the ability to remove the
+ * CMDHELP: existing owner(s). As a precaution the named user must already have master (+m)
+ * CMDHELP: access on the channel. Use this command with extreme caution. Where:
+ * CMDHELP: channel - channel to use
+ * CMDHELP: user - user to give owner to, either a nickname on the network or #accountname.
+ * CMDHELP: code - a unique code used to authorize the operation. If the code is not
+ * CMDHELP: supplied, the appropriate code will be provided together with a
+ * CMDHELP: warning about the dangers of this command. If the wrong code is
+ * CMDHELP: entered owner access will not be granted.
+ * CMDHELP: GIVEOWNER requires owner (+n) access on the named channel.
*/
#include "../chanserv.h"
/* You need to either be +n or have the relevant override... */
if (!(cip=cs_checkaccess(sender, cargv[0], CA_OWNERPRIV,
- NULL, "chanlev", QPRIV_CHANGECHANLEV, 0)))
+ NULL, "giveowner", QPRIV_CHANGECHANLEV, 0)))
return CMD_ERROR;
rcp=cip->exts[chanservext];
rcup=findreguseronchannel(rcp, target);
+ /* Can't promote if already owner */
+ if (rcup && (rcup->flags & QCUFLAG_OWNER)) {
+ chanservstdmessage(sender,QM_GIVEOWNERALREADYOWNER,target->username,cip->name->content);
+ return CMD_ERROR;
+ }
+
/* You can only promote a master */
if (!rcup || !(rcup->flags & QCUFLAG_MASTER)) {
chanservstdmessage(sender,QM_GIVEOWNERNOTMASTER,target->username,cip->name->content);
return CMD_ERROR;
}
-
- /* Can't promote if already owner */
- if (rcup->flags & QCUFLAG_OWNER) {
- chanservstdmessage(sender,QM_GIVEOWNERALREADYOWNER,target->username,cip->name->content);
- return CMD_ERROR;
- }
/* Compute ze hash */
sprintf(hashstr,"%u.%u.%u",rcp->ID,target->ID,rup->ID);