mirror of
https://github.com/anope/anope.git
synced 2026-06-29 12:16:38 +02:00
m_chanstats: fixed the config options NSDefChanstats and CSDefChanstats
This commit is contained in:
@@ -26,10 +26,10 @@ module
|
||||
|
||||
/*
|
||||
* Enable Chanstats for newly registered nicks / channels.
|
||||
* Set it to 0 to disable it.
|
||||
* Set it to No to disable it.
|
||||
*/
|
||||
NSDefChanstats = 1
|
||||
CSDefChanstats = 1
|
||||
NSDefChanstats = Yes
|
||||
CSDefChanstats = Yes
|
||||
}
|
||||
command { service = "ChanServ"; name = "SET CHANSTATS"; command = "chanserv/set/chanstats"; }
|
||||
command { service = "NickServ"; name = "SET CHANSTATS"; command = "nickserv/set/chanstats"; }
|
||||
|
||||
@@ -168,6 +168,7 @@ class MChanstats : public Module
|
||||
SQL::Query query;
|
||||
Anope::string SmileysHappy, SmileysSad, SmileysOther, prefix;
|
||||
std::vector<Anope::string> TableList, ProcedureList, EventList;
|
||||
bool NSDefChanstats, CSDefChanstats;
|
||||
|
||||
void RunQuery(const SQL::Query &q)
|
||||
{
|
||||
@@ -490,7 +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");
|
||||
Anope::string engine = block->Get<const Anope::string>("engine");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
|
||||
if (sql)
|
||||
@@ -629,6 +631,18 @@ class MChanstats : public Module
|
||||
query.SetValue("channel", ci->name);
|
||||
this->RunQuery(query);
|
||||
}
|
||||
|
||||
void OnChanRegistered(ChannelInfo *ci)
|
||||
{
|
||||
if (CSDefChanstats)
|
||||
ci->Extend<bool>("CS_STATS");
|
||||
}
|
||||
|
||||
void OnNickRegister(User *user, NickAlias *na)
|
||||
{
|
||||
if (NSDefChanstats)
|
||||
na->nc->Extend<bool>("NS_STATS");
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(MChanstats)
|
||||
|
||||
Reference in New Issue
Block a user