mirror of
https://github.com/anope/anope.git
synced 2026-07-10 00:03:13 +02:00
Made the chanstats confs try and look similar to every other configuration file
This commit is contained in:
@@ -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"; }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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), "
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user