* CMDDESC: Ops you or other users on channel(s).
* CMDFUNC: csc_doop
* CMDPROTO: int csc_doop(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: OP [<channel> [<user1> [<user2> [...]]]]
+ * CMDHELP: Ops you on one or more channels, or ops other named users on a given channel.
+ * CMDHELP: This command cannot be used to op users who are otherwise prevented from getting
+ * CMDHELP: ops, e.g. via the +d chanlev flag (see CHANLEV) or bitch mode (see CHANFLAGS).
+ * CMDHELP: Where:
+ * CMDHELP: channel - channel to use. If no channel is specified, you will be given ops on
+ * CMDHELP: every channel where you have appropriate access and are not already
+ * CMDHELP: opped.
+ * CMDHELP: user<n> - user(s) to op instead of yourself. Each user must be specified as the
+ * CMDHELP: current nickname of a user on the named channel.
+ * CMDHELP: OP requires operator access (+o) on the named channel. If this command is used
+ * CMDHELP: to op other users, a notice will be sent to other channel operators on the
+ * CMDHELP: channel identifying you, unless you have master (+m) access.
*/
#include "../chanserv.h"
int csc_doop(void *source, int cargc, char **cargv) {
nick *sender=source, *np;
reguser *rup=getreguserfromnick(sender);
+ reguser *srup=rup;
chanindex *cip;
regchan *rcp=NULL;
regchanuser *rcup;
unsigned long *lp;
int i;
modechanges changes;
+ int donotice=0, bufpos=0;
+ char buf[512];
if (!rup)
return CMD_ERROR;
localsetmodeinit(&changes, ca[i], chanservnick);
localdosetmode_nick(&changes, sender, MC_OP);
localsetmodeflush(&changes,1);
+ cs_logchanop(rcp, sender->nick, rup);
}
}
}
return CMD_ERROR;
rcp=cip->exts[chanservext];
+
+ /* If the channel doesn't currently exist, forget it. */
+ if (!cip->channel) {
+ chanservstdmessage(sender, QM_EMPTYCHAN, cip->name->content);
+ return CMD_ERROR;
+ }
if (cargc==1) {
/* Only one arg: "op me" */
localsetmodeinit(&changes, cip->channel, chanservnick);
localdosetmode_nick(&changes, sender, MC_OP);
localsetmodeflush(&changes,1);
+ cs_logchanop(rcp, sender->nick, srup);
chanservstdmessage(sender, QM_DONE);
return CMD_OK;
}
+ /* You've got to be a master to 'silently' op other people */
+ if (!cs_checkaccess(sender, NULL, CA_MASTERPRIV, cip, "op", 0, 1))
+ donotice=1;
+
/* Set up the modes */
localsetmodeinit(&changes, cip->channel, chanservnick);
continue;
}
+ bufpos += sprintf(buf+bufpos,"%s%s",bufpos?", ":"",np->nick);
localdosetmode_nick(&changes, np, MC_OP);
+ cs_logchanop(rcp, np->nick, srup);
}
+ if (donotice && bufpos) {
+ sendopnoticetochannel(chanservnick, cip->channel, "%s opped %s", sender->nick, buf);
+ }
+
localsetmodeflush(&changes, 1);
chanservstdmessage(sender, QM_DONE);