int cfext;
int cfnext;
-int failedinit;
+int cffailedinit;
/* user accessible commands */
int cfcmd_debug(void *source, int cargc, char **cargv);
if (cfext < 0 || cfnext < 0) {
Error("chanfix", ERR_ERROR, "Couldn't register channel and/or nick extension");
- failedinit = 1;
+ cffailedinit = 1;
} else {
schedulerecurring(time(NULL), 0, CFSAMPLEINTERVAL, &cfsched_dosample, NULL);
schedulerecurring(time(NULL), 0, CFEXPIREINTERVAL, &cfsched_doexpire, NULL);
schedulerecurring(time(NULL), 0, CFAUTOSAVEINTERVAL, &cfsched_dosave, NULL);
- registercontrolcmd("cfdebug", 10, 1, &cfcmd_debug);
- registercontrolcmd("cfhistogram", 10, 1, &cfcmd_debughistogram);
+ registercontrolhelpcmd("cfdebug", NO_DEVELOPER, 1, &cfcmd_debug, "Display Debug Information on chanfix data for channel");
+ registercontrolhelpcmd("cfhistogram", NO_DEVELOPER, 1, &cfcmd_debughistogram, "Display Debug Histogram of chanfix data for channel");
#if CFDEBUG
- registercontrolcmd("cfsample", 10, 1, &cfcmd_debugsample);
- registercontrolcmd("cfexpire", 10, 1, &cfcmd_debugexpire);
+ registercontrolhelpcmd("cfsample", NO_DEVELOPER, &cfcmd_debugsample, "DEBUG Command - must not be loaded on live instances");
+ registercontrolhelpcmd("cfexpire", NO_DEVELOPER, 1, &cfcmd_debugexpire, "DEBUG Command - must not be loaded on live instances");
#endif
- registercontrolcmd("chanopstat", 10, 1, &cfcmd_chanopstat);
- registercontrolcmd("chanoplist", 10, 1, &cfcmd_chanoplist);
+ registercontrolhelpcmd("chanopstat", NO_OPER, 1, &cfcmd_chanopstat, "Shows chanop statistics for a given channel");
+ registercontrolhelpcmd("chanoplist", NO_OPER, 1, &cfcmd_chanoplist, "Shows lists of known chanops, including scores");
- registercontrolcmd("chanfix", 10, 1, &cfcmd_chanfix);
- registercontrolcmd("showregs", 10, 1, &cfcmd_showregs);
+ registercontrolhelpcmd("chanfix", NO_OPER, 1, &cfcmd_chanfix, "Perform a chanfix on a channel to op known users only");
+ registercontrolhelpcmd("showregs", NO_OPER, 1, &cfcmd_showregs, "Show regular ops known on a channel (including services)");
#if CFDEBUG
/* should we disable this in the 'final' build? */
-// registercontrolcmd("requestop", 0, 2, &cfcmd_requestop);
+ /* registercontrolcmd("requestop", 0, 2, &cfcmd_requestop); */
#endif
- registercontrolcmd("cfsave", 10, 0, &cfcmd_save);
- registercontrolcmd("cfload", 10, 0, &cfcmd_load);
+ registercontrolhelpcmd("cfsave", NO_DEVELOPER, 0, &cfcmd_save, "Force save of chanfix data");
+ registercontrolhelpcmd("cfload", NO_DEVELOPER, 0, &cfcmd_load, "Force load of chanfix data");
#if CFAUTOFIX
registerhook(HOOK_CHANNEL_DEOPPED, &cfhook_autofix);
cf_loadchanfix();
- failedinit = 0;
+ cffailedinit = 0;
}
}
int i;
nick *nip;
- if (failedinit == 0) {
+ if (cffailedinit == 0) {
deleteschedule(NULL, &cfsched_dosample, NULL);
deleteschedule(NULL, &cfsched_doexpire, NULL);
deleteschedule(NULL, &cfsched_dosave, NULL);
nick *nip;
chanfix *cf;
- if ((int)arg > 2) {
+ if ((long)arg > 2) {
memory = rc = mc = 0;
for (i=0; i<CHANNELHASHSIZE; i++) {
if(cp->users->content[a] != nouser) {
np = getnickbynumeric(cp->users->content[a]);
- if (IsService(np)) {
+ if (IsService(np) && (np->nick[1] == '\0')) {
localdosetmode_nick(&changes, np, MC_OP);
count++;
} else
/* don't reop users if we've already opped some services */
#if !CFDEBUG
- if (count > 0)
+ if (count > 0) {
+ localsetmodeflush(&changes, 1);
return CFX_FIXED;
+ }
#endif
/* now get a sorted list of regops */
if (count >= CFMAXOPS || rolist[i]->score < rolist[0]->score / 2)
break;
- if (rolist[i]->score < CFMINSCORE)
+ if (rolist[i]->score < CFMINSCORE && i != 0 )
continue;
np = cf_findnick(rolist[i], cp->index);
/* only if it's not a service, so we don't screw up 'count' */
- if (np && !IsService(np)) {
+ if (np && !(IsService(np) && np->nick[1] == '\0')) {
localdosetmode_nick(&changes, np, MC_OP);
count++;
localsetmodeflush(&changes, 1);
- irc_send("%s WA :cf_fixchannel(%s) done: %d client(s) opped.",
- longtonumeric(mynick->numeric,5), cp->index->name->content, count);
-
if (count == CFMAXOPS)
return CFX_FIXED;
else if (count == 0)