]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_geoip.cpp
Remove current time parameter of the Timer constructor
[user/henk/code/inspircd.git] / src / modules / extra / m_geoip.cpp
index a36c39bc83cd3e6d078d311b4a11313df543a44f..394f7f9b4f7ff982c156c542b5fea5ed24dbcc63 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
@@ -37,7 +36,7 @@ class ModuleGeoIP : public Module
 
        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";
 
@@ -51,16 +50,12 @@ class ModuleGeoIP : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                gi = GeoIP_new(GEOIP_STANDARD);
                if (gi == NULL)
                                throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?");
 
-               ServerInstance->Modules->AddService(ext);
-               Implementation eventlist[] = { I_OnSetConnectClass, I_OnStats };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
-
                for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
                {
                        LocalUser* user = *i;
@@ -77,12 +72,12 @@ 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)
@@ -99,7 +94,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;
@@ -115,7 +110,7 @@ class ModuleGeoIP : public Module
                                unknown++;
                }
 
-               std::string p = ServerInstance->Config->ServerName + " 801 " + user->nick + " :GeoIPSTATS ";
+               std::string p = "801 " + user->nick + " :GeoIPSTATS ";
                for (std::map<std::string, unsigned int>::const_iterator i = results.begin(); i != results.end(); ++i)
                {
                        out.push_back(p + i->first + " " + ConvToStr(i->second));
@@ -129,4 +124,3 @@ class ModuleGeoIP : public Module
 };
 
 MODULE_INIT(ModuleGeoIP)
-