]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-channel.c
2 * CHANNEL functionality
10 #include "../channel/channel.h"
12 void *channel_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
13 void channel_free(searchCtx
*ctx
, struct searchNode
*thenode
);
15 struct searchNode
*channel_parse(searchCtx
*ctx
, int argc
, char **argv
) {
16 struct searchNode
*thenode
, *convsn
;
21 parseError
= "channel: usage: channel <channel name>";
25 if (!(convsn
=argtoconststr("channel", ctx
, argv
[0], &p
)))
29 convsn
->free(ctx
, convsn
);
31 parseError
= "channel: unknown channel";
35 if (!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
36 parseError
= "malloc: could not allocate memory for this search.";
40 thenode
->returntype
= RETURNTYPE_BOOL
;
41 thenode
->localdata
= cp
;
42 thenode
->exe
= channel_exe
;
43 thenode
->free
= channel_free
;
48 void *channel_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
49 nick
*np
= (nick
*)theinput
;
50 channel
*cp
= thenode
->localdata
;
52 if (getnumerichandlefromchanhash(cp
->users
, np
->numeric
)) {
59 void channel_free(searchCtx
*ctx
, struct searchNode
*thenode
) {