diff options
author | Adam <Adam@anope.org> | 2014-01-21 17:33:57 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-01-21 17:33:57 -0500 |
commit | 1027ec667a84b918f21b57fc4842bf6bb818105e (patch) | |
tree | fc8f137c2f5cc1bc471f7b9c104a4c7d0eecac2c | |
parent | 4d9273efa42a16380de8ac81c615eaac89052f68 (diff) |
Made the chanstats confs try and look similar to every other configuration file
-rw-r--r-- | data/chanstats.example.conf | 5 | ||||
-rw-r--r-- | data/irc2sql.example.conf | 15 | ||||
-rw-r--r-- | modules/extra/stats/cs_fantasy_stats.cpp | 4 | ||||
-rw-r--r-- | modules/extra/stats/cs_fantasy_top.cpp | 4 | ||||
-rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.cpp | 3 | ||||
-rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.h | 2 | ||||
-rw-r--r-- | modules/extra/stats/irc2sql/tables.cpp | 20 | ||||
-rw-r--r-- | modules/extra/stats/m_chanstats.cpp | 4 |
8 files changed, 21 insertions, 36 deletions
diff --git a/data/chanstats.example.conf b/data/chanstats.example.conf index ed7a07c8c..64f57da30 100644 --- a/data/chanstats.example.conf +++ b/data/chanstats.example.conf @@ -26,10 +26,9 @@ module /* * Enable Chanstats for newly registered nicks / channels. - * Set it to No to disable it. */ - NSDefChanstats = Yes - CSDefChanstats = Yes + ns_def_chanstats = yes + cs_def_chanstats = yes } command { service = "ChanServ"; name = "SET CHANSTATS"; command = "chanserv/set/chanstats"; } command { service = "NickServ"; name = "SET CHANSTATS"; command = "nickserv/set/chanstats"; } diff --git a/data/irc2sql.example.conf b/data/irc2sql.example.conf index 25327387b..e8fec08b1 100644 --- a/data/irc2sql.example.conf +++ b/data/irc2sql.example.conf @@ -71,22 +71,15 @@ module prefix = "anope_" /* - * GeoIP - Automagically add a users geoip to the user table. + * GeoIP - Automatically adds users geoip location to the user table. * Tables are created by irc2sql, you have to run the * geoipupdate script after you started Anope to download * and import the GeoIP database. - */ - - /* - * Enable GeoIP Lookup - */ - GeoIPLookup = yes - - /* - * Chose between the smaller 'country' or the bigger 'city' database. * + * The geoip database can be the smaller "country" database or the + * larger "city" database. Comment to disable geoip lookup. */ - GeoIPDatabase = "country" + geoip_database = "country" /* * Get the CTCP version from users diff --git a/modules/extra/stats/cs_fantasy_stats.cpp b/modules/extra/stats/cs_fantasy_stats.cpp index 43f7eb04a..ce5195122 100644 --- a/modules/extra/stats/cs_fantasy_stats.cpp +++ b/modules/extra/stats/cs_fantasy_stats.cpp @@ -75,9 +75,7 @@ class CSStats : public Module void OnReload(Configuration::Conf *conf) anope_override { - prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix"); - if (prefix.empty()) - prefix = "anope_"; + prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix", "anope_"); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("m_chanstats")->Get<const Anope::string>("engine")); } diff --git a/modules/extra/stats/cs_fantasy_top.cpp b/modules/extra/stats/cs_fantasy_top.cpp index f747bebd8..b110a58ce 100644 --- a/modules/extra/stats/cs_fantasy_top.cpp +++ b/modules/extra/stats/cs_fantasy_top.cpp @@ -100,9 +100,7 @@ class CSTop : public Module void OnReload(Configuration::Conf *conf) anope_override { - prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix"); - if (prefix.empty()) - prefix = "anope_"; + prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix", "anope_"); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("m_chanstats")->Get<const Anope::string>("engine")); } diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index e5d94fec9..d20e1a420 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -12,8 +12,7 @@ void IRC2SQL::OnReload(Configuration::Conf *conf) { Configuration::Block *block = Config->GetModule(this); prefix = block->Get<const Anope::string>("prefix", "anope_"); - UseGeoIP = block->Get<bool>("GeoIPLookup", "no"); - GeoIPDB = block->Get<const Anope::string>("GeoIPDatabase", "country"); + GeoIPDB = block->Get<const Anope::string>("geoip_database"); ctcpuser = block->Get<bool>("ctcpuser", "no"); ctcpeob = block->Get<bool>("ctcpeob", "yes"); Anope::string engine = block->Get<const Anope::string>("engine"); diff --git a/modules/extra/stats/irc2sql/irc2sql.h b/modules/extra/stats/irc2sql/irc2sql.h index 1e28d99d4..0c516f5e3 100644 --- a/modules/extra/stats/irc2sql/irc2sql.h +++ b/modules/extra/stats/irc2sql/irc2sql.h @@ -26,7 +26,7 @@ class IRC2SQL : public Module SQL::Query query; std::vector<Anope::string> TableList, ProcedureList, EventList; Anope::string prefix, GeoIPDB; - bool quitting, introduced_myself, UseGeoIP, ctcpuser, ctcpeob, firstrun; + bool quitting, introduced_myself, ctcpuser, ctcpeob, firstrun; BotInfo *StatServ; PrimitiveExtensibleItem<bool> versionreply; diff --git a/modules/extra/stats/irc2sql/tables.cpp b/modules/extra/stats/irc2sql/tables.cpp index d80f37535..661069443 100644 --- a/modules/extra/stats/irc2sql/tables.cpp +++ b/modules/extra/stats/irc2sql/tables.cpp @@ -17,7 +17,7 @@ void IRC2SQL::CheckTables() this->GetTables(); - if (UseGeoIP && GeoIPDB.equals_ci("country") && !this->HasTable(prefix + "geoip_country")) + if (GeoIPDB.equals_ci("country") && !this->HasTable(prefix + "geoip_country")) { query = "CREATE TABLE `" + prefix + "geoip_country` (" "`start` INT UNSIGNED NOT NULL," @@ -29,7 +29,7 @@ void IRC2SQL::CheckTables() ") ENGINE=MyISAM DEFAULT CHARSET=utf8;"; this->RunQuery(query); } - if (UseGeoIP && GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_blocks")) + if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_blocks")) { query = "CREATE TABLE `" + prefix + "geoip_city_blocks` (" "`start` INT UNSIGNED NOT NULL," @@ -41,7 +41,7 @@ void IRC2SQL::CheckTables() this->RunQuery(query); } - if (UseGeoIP && GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_location")) + if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_location")) { query = "CREATE TABLE `" + prefix + "geoip_city_location` (" "`locId` INT UNSIGNED NOT NULL," @@ -55,7 +55,7 @@ void IRC2SQL::CheckTables() ") ENGINE=MyISAM DEFAULT CHARSET=utf8;"; this->RunQuery(query); } - if (UseGeoIP && GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_region")) + if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_region")) { query = "CREATE TABLE `" + prefix + "geoip_city_region` (" "`country` CHAR(2) NOT NULL," "`region` CHAR(2) NOT NULL," @@ -157,10 +157,8 @@ void IRC2SQL::CheckTables() if (this->HasProcedure(prefix + "UserConnect")) this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "UserConnect")); - if (UseGeoIP) - { - if (GeoIPDB.equals_ci("country")) - geoquery = "UPDATE `" + prefix + "user` AS u " + if (GeoIPDB.equals_ci("country")) + geoquery = "UPDATE `" + prefix + "user` AS u " "JOIN ( SELECT `countrycode`, `countryname` " "FROM `" + prefix + "geoip_country` " "WHERE INET_ATON(ip_) <= `end` " @@ -168,8 +166,8 @@ void IRC2SQL::CheckTables() "ORDER BY `end` ASC LIMIT 1 ) as c " "SET u.geocode = c.countrycode, u.geocountry = c.countryname " "WHERE u.nick = nick_; "; - else if (GeoIPDB.equals_ci("city")) - geoquery = "UPDATE `" + prefix + "user` as u " + else if (GeoIPDB.equals_ci("city")) + geoquery = "UPDATE `" + prefix + "user` as u " "JOIN ( SELECT * FROM `" + prefix + "geoip_city_location` " "WHERE `locID` = ( SELECT `locID` " "FROM `" + prefix + "geoip_city_blocks` " @@ -185,7 +183,7 @@ void IRC2SQL::CheckTables() "WHERE `country` = l.country " "AND `region` = l.region )" "WHERE u.nick = nick_;"; - } + query = "CREATE PROCEDURE `" + prefix + "UserConnect`" "(nick_ varchar(255), host_ varchar(255), vhost_ varchar(255), " "chost_ varchar(255), realname_ varchar(255), ip_ varchar(255), " diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index 1ca670368..4151c4579 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -491,8 +491,8 @@ class MChanstats : public Module SmileysHappy = block->Get<const Anope::string>("SmileysHappy"); SmileysSad = block->Get<const Anope::string>("SmileysSad"); SmileysOther = block->Get<const Anope::string>("SmileysOther"); - NSDefChanstats = block->Get<bool>("NSDefChanstats", "no"); - CSDefChanstats = block->Get<bool>("CSDefChanstats", "no"); + NSDefChanstats = block->Get<bool>("ns_def_chanstats"); + CSDefChanstats = block->Get<bool>("cs_def_chanstats"); Anope::string engine = block->Get<const Anope::string>("engine"); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine); if (sql) |