]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_geoip Set cc in OnSetConnectClass to the newly created string if it was NULL
authorattilamolnar <attilamolnar@hush.com>
Sat, 18 May 2013 14:04:10 +0000 (16:04 +0200)
committerattilamolnar <attilamolnar@hush.com>
Sat, 18 May 2013 14:04:10 +0000 (16:04 +0200)
src/modules/extra/m_geoip.cpp

index c93479b3cffd9034e99de13f07e73aa48b47d595..a36c39bc83cd3e6d078d311b4a11313df543a44f 100644 (file)
@@ -35,7 +35,7 @@ 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());
                if (!c)
@@ -43,6 +43,7 @@ class ModuleGeoIP : public Module
 
                std::string* cc = new std::string(c);
                ext.set(user, cc);
+               return cc;
        }
 
  public:
@@ -85,7 +86,7 @@ class ModuleGeoIP : public Module
        {
                std::string* cc = ext.get(user);
                if (!cc)
-                       SetExt(user);
+                       cc = SetExt(user);
 
                std::string geoip = myclass->config->getString("geoip");
                if (geoip.empty())