]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-channel.c
e1a90ac9bbddd222e0896a11b4017cea4e5b3108
2 * CHANNEL functionality
10 #include "../nick/nick.h"
11 #include "../channel/channel.h"
13 void *channel_exe(struct searchNode
*thenode
, int type
, void *theinput
);
14 void channel_free(struct searchNode
*thenode
);
16 struct searchNode
*channel_parse(int type
, int argc
, char **argv
) {
17 struct searchNode
*thenode
;
20 if (type
!= SEARCHTYPE_NICK
) {
21 parseError
= "channel: this function is only valid for nick searches.";
26 parseError
= "channel: usage: channel <channel name>";
30 if (!(cp
=findchannel(argv
[0]))) {
31 parseError
= "channel: unknown channel";
35 thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
));
37 thenode
->returntype
= RETURNTYPE_STRING
;
38 thenode
->localdata
= cp
;
39 thenode
->exe
= channel_exe
;
40 thenode
->free
= channel_free
;
45 void *channel_exe(struct searchNode
*thenode
, int type
, void *theinput
) {
46 nick
*np
= (nick
*)theinput
;
47 channel
*cp
= thenode
->localdata
;
49 if (getnumerichandlefromchanhash(cp
->users
, np
->numeric
)) {
52 return falseval(type
);
56 void channel_free(struct searchNode
*thenode
) {