cmdsummary *summary;
char cmdbuf[50];
char *ct;
+ unsigned int dumpcount=0;
n=getcommandlist(cscommands, cmdlist, 200);
rup=getreguserfromnick(sender);
chanservstdmessage(sender, QM_COMMANDLIST);
+ if (cargc>0 && rup && UIsDev(rup) && !ircd_strcmp(cargv[0], "-v")) {
+ dumpcount=1;
+ }
+
for (i=0;i<n;i++) {
+ /* Generate the appropriate strings for the command name (including
+ * prefixes for privileged users) and the summary text.
+ *
+ * We do this before we're sure we will print the command to make things
+ * easier when we are doing -v */
+ summary=(cmdsummary *)cmdlist[i]->ext;
+
+ if (rup && UHasStaffPriv(rup)) {
+ if (cmdlist[i]->level & QCMD_DEV) {
+ sprintf(cmdbuf,"+d %s",cmdlist[i]->command->content);
+ } else if(cmdlist[i]->level & QCMD_ADMIN) {
+ sprintf(cmdbuf,"+a %s",cmdlist[i]->command->content);
+ } else if(cmdlist[i]->level & QCMD_OPER) {
+ sprintf(cmdbuf,"+o %s",cmdlist[i]->command->content);
+ } else if(cmdlist[i]->level & QCMD_HELPER) {
+ sprintf(cmdbuf,"+h %s",cmdlist[i]->command->content);
+ } else if(cmdlist[i]->level & QCMD_STAFF) {
+ sprintf(cmdbuf,"+q %s",cmdlist[i]->command->content);
+ } else {
+ sprintf(cmdbuf," %s",cmdlist[i]->command->content);
+ }
+ ct=cmdbuf;
+ } else {
+ ct=cmdlist[i]->command->content;
+ }
+
+ if (summary->bylang[lang]) {
+ message=summary->bylang[lang]->content;
+ } else if (summary->bylang[0]) {
+ message=summary->bylang[0]->content;
+ } else {
+ message=summary->def->content;
+ }
+
+ if (dumpcount) {
+ chanservsendmessage(sender,"%-20s %u", cmdbuf, cmdlist[i]->calls);
+ continue;
+ }
if (cargc>0 && !match2strings(cargv[0],cmdlist[i]->command->content))
continue;
if ((cmdlist[i]->level & QCMD_NOTAUTHED) && rup)
continue;
+ if ((cmdlist[i]->level & QCMD_STAFF) &&
+ (!rup || !UHasStaffPriv(rup)))
+ continue;
+
if ((cmdlist[i]->level & QCMD_HELPER) &&
(!rup || !UHasHelperPriv(rup)))
continue;
(!rup || !UIsDev(rup) || !IsOper(sender)))
continue;
- summary=(cmdsummary *)cmdlist[i]->ext;
-
- if (rup && UHasHelperPriv(rup)) {
- if (cmdlist[i]->level & QCMD_DEV) {
- sprintf(cmdbuf,"+d %s",cmdlist[i]->command->content);
- } else if(cmdlist[i]->level & QCMD_ADMIN) {
- sprintf(cmdbuf,"+a %s",cmdlist[i]->command->content);
- } else if(cmdlist[i]->level & QCMD_OPER) {
- sprintf(cmdbuf,"+o %s",cmdlist[i]->command->content);
- } else if(cmdlist[i]->level & QCMD_HELPER) {
- sprintf(cmdbuf,"+h %s",cmdlist[i]->command->content);
- } else {
- sprintf(cmdbuf," %s",cmdlist[i]->command->content);
- }
- ct=cmdbuf;
- } else {
- ct=cmdlist[i]->command->content;
- }
-
- if (summary->bylang[lang]) {
- message=summary->bylang[lang]->content;
- } else if (summary->bylang[0]) {
- message=summary->bylang[0]->content;
- } else {
- message=summary->def->content;
- }
-
+ /* We passed all the checks, send the message */
chanservsendmessage(sender, "%-20s %s",ct, message);
}
rup=getreguserfromnick(sender);
/* Don't showhelp for privileged users to others.. */
- if (((cmd->level & QCMD_HELPER) && (!rup || !UHasHelperPriv(rup))) ||
+ if (((cmd->level & QCMD_STAFF) && (!rup || !UHasStaffPriv(rup))) ||
+ ((cmd->level & QCMD_HELPER) && (!rup || !UHasHelperPriv(rup))) ||
((cmd->level & QCMD_OPER) && (!rup || !UHasOperPriv(rup))) ||
((cmd->level & QCMD_ADMIN) && (!rup || !UHasAdminPriv(rup))) ||
((cmd->level & QCMD_DEV) && (!rup || !UIsDev(rup)))) {