]>
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 type
, int argc
, char **argv
) {
16 struct searchNode
*thenode
;
19 if (type
!= SEARCHTYPE_NICK
) {
20 parseError
= "channel: this function is only valid for nick searches.";
25 parseError
= "channel: usage: channel <channel name>";
29 if (!(cp
=findchannel(argv
[0]))) {
30 parseError
= "channel: unknown channel";
34 if (!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
35 parseError
= "malloc: could not allocate memory for this search.";
39 thenode
->returntype
= RETURNTYPE_BOOL
;
40 thenode
->localdata
= cp
;
41 thenode
->exe
= channel_exe
;
42 thenode
->free
= channel_free
;
47 void *channel_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
48 nick
*np
= (nick
*)theinput
;
49 channel
*cp
= thenode
->localdata
;
51 if (getnumerichandlefromchanhash(cp
->users
, np
->numeric
)) {
58 void channel_free(searchCtx
*ctx
, struct searchNode
*thenode
) {