Makes @geoLookup optional depending on the availability of libGeoIP

This commit is contained in:
Felipe Zimmerle
2015-11-20 09:52:36 -03:00
parent 21cae53d47
commit 09a958544d
6 changed files with 51 additions and 9 deletions

View File

@@ -15,7 +15,9 @@
#include "operators/geo_lookup.h"
#ifdef WITH_GEOIP
#include <GeoIPCity.h>
#endif
#include <string>
#include <functional>
@@ -31,10 +33,11 @@ namespace operators {
bool GeoLookup::evaluate(Assay *assay, const std::string &exp) {
using std::placeholders::_1;
using std::placeholders::_2;
GeoIPRecord *gir;
bool ret = true;
#ifdef WITH_GEOIP
GeoIPRecord *gir;
if (assay) {
ret = Utils::GeoLookup::getInstance().lookup(exp, &gir,
std::bind(&GeoLookup::debug, this, assay, _1, _2));
@@ -85,6 +88,7 @@ bool GeoLookup::evaluate(Assay *assay, const std::string &exp) {
GeoIPRecord_delete(gir);
}
#endif // WITH_GEOIP
return ret;
}