]>
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
, int type
, void *theinput
);
14 void *country_exe_real(struct searchNode
*thenode
, int type
, void *theinput
);
15 void country_free(struct searchNode
*thenode
);
19 struct searchNode
*country_parse(int type
, int argc
, char **argv
) {
20 struct searchNode
*thenode
;
22 if (type
!= SEARCHTYPE_NICK
) {
23 parseError
= "country: this function is only valid for nick searches.";
27 ext
= findnickext("geoip");
29 parseError
= "country: Geoip module not loaded.";
34 thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
));
36 thenode
->returntype
= RETURNTYPE_INT
;
37 thenode
->localdata
= NULL
;
38 thenode
->exe
= country_exe
;
39 thenode
->free
= country_free
;
44 void *country_exe(struct searchNode
*thenode
, int type
, void *theinput
) {
45 nick
*np
= (nick
*)theinput
;
47 if (type
!= RETURNTYPE_INT
)
50 return (void *)np
->exts
[ext
];
53 void country_free(struct searchNode
*thenode
) {