# pragma comment(lib, "GeoIP.lib")
#endif
-/* $ModDesc: Provides a way to restrict users by country using GeoIP lookup */
/* $LinkerFlags: -lGeoIP */
class ModuleGeoIP : public Module
LocalStringExt ext;
GeoIP* gi;
- void SetExt(LocalUser* user)
+ std::string* SetExt(LocalUser* user)
{
const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString().c_str());
if (!c)
std::string* cc = new std::string(c);
ext.set(user, cc);
+ return cc;
}
public:
{
std::string* cc = ext.get(user);
if (!cc)
- SetExt(user);
+ cc = SetExt(user);
std::string geoip = myclass->config->getString("geoip");
if (geoip.empty())