]>
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 if (!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
35 parseError
= "malloc: could not allocate memory for this search.";
39 thenode
->returntype
= RETURNTYPE_INT
;
40 thenode
->localdata
= NULL
;
41 thenode
->exe
= country_exe
;
42 thenode
->free
= country_free
;
47 void *country_exe(struct searchNode
*thenode
, int type
, void *theinput
) {
48 nick
*np
= (nick
*)theinput
;
50 if (type
!= RETURNTYPE_INT
)
53 return (void *)np
->exts
[ext
];
56 void country_free(struct searchNode
*thenode
) {