]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-kick.c
6 #include "../localuser/localuserchannel.h"
11 void *kick_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
12 void kick_free(searchCtx
*ctx
, struct searchNode
*thenode
);
14 struct searchNode
*kick_parse(searchCtx
*ctx
, int argc
, char **argv
) {
15 struct searchNode
*thenode
, *kicknick
;
20 parseError
="kick: usage: (kick target)";
24 if (!(kicknick
=argtoconststr("kick", ctx
, argv
[0], &p
)))
28 kicknick
->free(ctx
, kicknick
);
31 parseError
="kick: unknown nickname";
35 if (IsOper(np
) || IsService(np
)) {
36 parseError
="kick: can't kick opers or services";
40 if (!(thenode
=(struct searchNode
*)malloc(sizeof(struct searchNode
)))) {
41 parseError
= "malloc: could not allocate memory for this search.";
45 thenode
->returntype
= RETURNTYPE_BOOL
;
46 thenode
->localdata
= np
;
47 thenode
->exe
= kick_exe
;
48 thenode
->free
= kick_free
;
53 void *kick_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
57 np
=thenode
->localdata
;
58 cip
=(chanindex
*)theinput
;
60 if (cip
->channel
==NULL
|| getnumerichandlefromchanhash(cip
->channel
->users
, np
->numeric
)==NULL
)
63 localkickuser(NULL
, cip
->channel
, np
, "");
67 void kick_free(searchCtx
*ctx
, struct searchNode
*thenode
) {