struct kill_localdata {
unsigned int marker;
int count;
- int type;
char reason[NSMAX_REASON_LEN];
};
-struct searchNode *kill_parse(searchCtx *ctx, int type, int argc, char **argv) {
+struct searchNode *kill_parse(searchCtx *ctx, int argc, char **argv) {
struct kill_localdata *localdata;
struct searchNode *thenode;
int len;
return NULL;
}
localdata->count = 0;
- localdata->type = type;
- if (type == SEARCHTYPE_CHANNEL)
+ if (ctx->searchcmd == reg_chansearch)
localdata->marker = nextchanmarker();
- else
+ else if (ctx->searchcmd == reg_nicksearch)
localdata->marker = nextnickmarker();
+ else {
+ parseError = "kill: invalid search type";
+ return NULL;
+ }
if (argc==1) {
char *p = argv[0];
localdata = thenode->localdata;
- if (localdata->type == SEARCHTYPE_CHANNEL) {
+ if (ctx->searchcmd == reg_chansearch) {
cip = (chanindex *)theinput;
cip->marker = localdata->marker;
localdata->count += cip->channel->users->totalusers;
- }
- else {
+ } else {
np = (nick *)theinput;
np->marker = localdata->marker;
localdata->count++;
}
/* For channel searches, mark up all the nicks in the relevant channels first */
- if (localdata->type == SEARCHTYPE_CHANNEL) {
+ if (ctx->searchcmd == reg_chansearch) {
nickmarker=nextnickmarker();
for (i=0;i<CHANNELHASHSIZE;i++) {
for (cip=chantable[i];cip;cip=cip->next) {
ctx->reply(senderNSExtern, "Warning: your pattern matched privileged users (%d in total) - these have not been touched.", safe);
/* notify opers of the action */
ctx->wall(NL_KICKKILLS, "%s/%s killed %d %s via %s [%d untouched].", senderNSExtern->nick, senderNSExtern->authname, (localdata->count - safe),
- (localdata->count - safe) != 1 ? "users" : "user", (localdata->type == SEARCHTYPE_CHANNEL) ? "chansearch" : "nicksearch", safe);
+ (localdata->count - safe) != 1 ? "users" : "user", (ctx->searchcmd == reg_chansearch) ? "chansearch" : "nicksearch", safe);
free(localdata);
free(thenode);
}