]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_geoip.cpp
Fix m_geoip warning about the use of C++11 features.
[user/henk/code/inspircd.git] / src / modules / extra / m_geoip.cpp
index 3561d1a5da2f21d18bbb61c4acf072b88f4145dc..570901430be5dae46f5455df8ab8048623933e40 100644 (file)
 #include "inspircd.h"
 #include "xline.h"
 
+// Fix warnings about the use of commas at end of enumerator lists on C++03.
+#if defined __clang__
+# pragma clang diagnostic ignored "-Wc++11-extensions"
+#elif defined __GNUC__
+# pragma GCC diagnostic ignored "-pedantic"
+#endif
+
 #include <GeoIP.h>
 
 #ifdef _WIN32
@@ -46,7 +53,9 @@ class ModuleGeoIP : public Module
        }
 
  public:
-       ModuleGeoIP() : ext("geoip_cc", this), gi(NULL)
+       ModuleGeoIP()
+               : ext("geoip_cc", ExtensionItem::EXT_USER, this)
+               , gi(NULL)
        {
        }
 
@@ -95,9 +104,9 @@ class ModuleGeoIP : public Module
                return MOD_RES_DENY;
        }
 
-       ModResult OnStats(char symbol, User* user, string_list &out) CXX11_OVERRIDE
+       ModResult OnStats(Stats::Context& stats) CXX11_OVERRIDE
        {
-               if (symbol != 'G')
+               if (stats.GetSymbol() != 'G')
                        return MOD_RES_PASSTHRU;
 
                unsigned int unknown = 0;
@@ -113,14 +122,13 @@ class ModuleGeoIP : public Module
                                unknown++;
                }
 
-               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));
+                       stats.AddRow(801, "GeoIPSTATS " + i->first + " " + ConvToStr(i->second));
                }
 
                if (unknown)
-                       out.push_back(p + "Unknown " + ConvToStr(unknown));
+                       stats.AddRow(801, "GeoIPSTATS Unknown " + ConvToStr(unknown));
 
                return MOD_RES_DENY;
        }