]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-country.c
2 * COUNTRY functionality
10 #include "../irc/irc_config.h"
11 #include "../nick/nick.h"
12 #include "../lib/irc_string.h"
14 void *country_exe(struct searchNode
*thenode
, int type
, void *theinput
);
15 void *country_exe_real(struct searchNode
*thenode
, int type
, void *theinput
);
16 void country_free(struct searchNode
*thenode
);
20 struct searchNode
*country_parse(int type
, int argc
, char **argv
) {
21 struct searchNode
*thenode
;
23 if (type
!= SEARCHTYPE_NICK
) {
24 parseError
= "country: this function is only valid for nick searches.";
28 ext
= findnickext("geoip");
30 parseError
= "country: Geoip module not loaded.";
35 thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
));
37 thenode
->returntype
= RETURNTYPE_INT
;
38 thenode
->localdata
= NULL
;
39 thenode
->exe
= country_exe
;
40 thenode
->free
= country_free
;
45 void *country_exe(struct searchNode
*thenode
, int type
, void *theinput
) {
46 nick
*np
= (nick
*)theinput
;
48 if (type
!= RETURNTYPE_INT
)
51 return (void *)np
->exts
[ext
];
54 void country_free(struct searchNode
*thenode
) {