]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/chancmds/giveowner.c
CHANSERV: GIVEOWNER: Oops, removed crash bug where rcup is referenced before
[irc/quakenet/newserv.git] / chanserv / chancmds / giveowner.c
index 0cde7d2102fa0f6ba8f553ff1be45af1ac839e33..7cd7f6101e33687cc1e2aa602182e95fe788ae32 100644 (file)
@@ -5,6 +5,18 @@
  * 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"
@@ -36,7 +48,7 @@ int csc_dogiveowner(void *source, int cargc, char **cargv) {
 
   /* 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];
@@ -46,17 +58,17 @@ int csc_dogiveowner(void *source, int cargc, char **cargv) {
 
   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);