]>
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
;
19 parseError
="kick: usage: (kick target)";
23 if ((np
=getnickbynick(argv
[0]))==NULL
) {
24 parseError
="kick: unknown nickname";
28 if (IsOper(np
) || IsService(np
)) {
29 parseError
="kick: can't kick opers or services";
33 if (!(thenode
=(struct searchNode
*)malloc(sizeof(struct searchNode
)))) {
34 parseError
= "malloc: could not allocate memory for this search.";
38 thenode
->returntype
= RETURNTYPE_BOOL
;
39 thenode
->localdata
= np
;
40 thenode
->exe
= kick_exe
;
41 thenode
->free
= kick_free
;
46 void *kick_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
50 np
=thenode
->localdata
;
51 cip
=(chanindex
*)theinput
;
53 if (cip
->channel
==NULL
|| getnumerichandlefromchanhash(cip
->channel
->users
, np
->numeric
)==NULL
)
56 localkickuser(NULL
, cip
->channel
, np
, "");
60 void kick_free(searchCtx
*ctx
, struct searchNode
*thenode
) {