]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_geoip.cpp
Modify the log message to contain the log type.
[user/henk/code/inspircd.git] / src / modules / extra / m_geoip.cpp
index c93479b3cffd9034e99de13f07e73aa48b47d595..fffadcd324e9a4338a915eb8d05647885e0fe169 100644 (file)
@@ -27,7 +27,6 @@
 # pragma comment(lib, "GeoIP.lib")
 #endif
 
-/* $ModDesc: Provides a way to restrict users by country using GeoIP lookup */
 /* $LinkerFlags: -lGeoIP */
 
 class ModuleGeoIP : public Module
@@ -35,14 +34,15 @@ 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());
+               const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString().c_str());
                if (!c)
                        c = "UNK";
 
                std::string* cc = new std::string(c);
                ext.set(user, cc);
+               return cc;
        }
 
  public:
@@ -50,7 +50,7 @@ class ModuleGeoIP : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                gi = GeoIP_new(GEOIP_STANDARD);
                if (gi == NULL)
@@ -76,16 +76,16 @@ class ModuleGeoIP : public Module
                        GeoIP_delete(gi);
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides a way to assign users to connect classes by country using GeoIP lookup", VF_VENDOR);
        }
 
-       ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass)
+       ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass) CXX11_OVERRIDE
        {
                std::string* cc = ext.get(user);
                if (!cc)
-                       SetExt(user);
+                       cc = SetExt(user);
 
                std::string geoip = myclass->config->getString("geoip");
                if (geoip.empty())
@@ -98,7 +98,7 @@ class ModuleGeoIP : public Module
                return MOD_RES_DENY;
        }
 
-       ModResult OnStats(char symbol, User* user, string_list &out)
+       ModResult OnStats(char symbol, User* user, string_list &out) CXX11_OVERRIDE
        {
                if (symbol != 'G')
                        return MOD_RES_PASSTHRU;
@@ -128,4 +128,3 @@ class ModuleGeoIP : public Module
 };
 
 MODULE_INIT(ModuleGeoIP)
-