]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-country.c
2 * COUNTRY functionality
10 #include "../irc/irc_config.h"
11 #include "../lib/irc_string.h"
13 void *country_exe(struct searchNode
*thenode
, void *theinput
);
14 void country_free(struct searchNode
*thenode
);
18 struct searchNode
*country_parse(int type
, int argc
, char **argv
) {
19 struct searchNode
*thenode
;
21 if (type
!= SEARCHTYPE_NICK
) {
22 parseError
= "country: this function is only valid for nick searches.";
26 ext
= findnickext("geoip");
28 parseError
= "country: Geoip module not loaded.";
33 if (!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
34 parseError
= "malloc: could not allocate memory for this search.";
38 thenode
->returntype
= RETURNTYPE_INT
;
39 thenode
->localdata
= NULL
;
40 thenode
->exe
= country_exe
;
41 thenode
->free
= country_free
;
46 void *country_exe(struct searchNode
*thenode
, void *theinput
) {
47 nick
*np
= (nick
*)theinput
;
49 return (void *)np
->exts
[ext
];
52 void country_free(struct searchNode
*thenode
) {