summaryrefslogtreecommitdiff
path: root/modules/commands/cs_fantasy_stats.cpp
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2012-06-01 07:37:34 +0200
committerDukePyrolator <DukePyrolator@anope.org>2012-06-01 07:37:34 +0200
commitdb37b1c6345dff1415fb144cc21d7c782acb1296 (patch)
tree7c327b771d3855de38bc43da2aa36576ee46d668 /modules/commands/cs_fantasy_stats.cpp
parent38d5f20deba313355943883b7b539a82f7a701ee (diff)
updated chanstats
Diffstat (limited to 'modules/commands/cs_fantasy_stats.cpp')
-rw-r--r--modules/commands/cs_fantasy_stats.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/modules/commands/cs_fantasy_stats.cpp b/modules/commands/cs_fantasy_stats.cpp
index 3e9d482b8..a8f6fe2fc 100644
--- a/modules/commands/cs_fantasy_stats.cpp
+++ b/modules/commands/cs_fantasy_stats.cpp
@@ -68,6 +68,7 @@ class CSStats : public Module
CommandCSGStats commandcsgstats;
service_reference<SQLProvider> sql;
MySQLInterface sqlinterface;
+ Anope::string prefix;
public:
CSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcsstats(this), commandcsgstats(this), sql("", ""), sqlinterface(this)
@@ -83,6 +84,7 @@ class CSStats : public Module
void OnReload() anope_override
{
ConfigReader config;
+ prefix = config.ReadValue("chanstats", "prefix", "anope_", 0);
Anope::string engine = config.ReadValue("chanstats", "engine", "", 0);
this->sql = service_reference<SQLProvider>("SQLProvider", engine);
}
@@ -117,19 +119,14 @@ class CSStats : public Module
try
{
SQLQuery query;
+ query = "SELECT letters, words, line, smileys_happy+smileys_sad+smileys_other as smileys,"
+ "actions FROM `" + prefix + "chanstats` "
+ "WHERE `nick` = @nick@ AND `chan` = @channel@ AND `type` = 'total';";
if (is_global)
- query = "SELECT sum(letters) as letters, sum(words) as words, sum(line) as line,"
- " sum(smileys) as smileys, sum(actions) as actions"
- " FROM `anope_bs_chanstats_view_sum_all`"
- " WHERE `nickserv_display` = @display@";
+ query.setValue("channel", "");
else
- {
- query = "SELECT letters, words, line, smileys, actions "
- " FROM `anope_bs_chanstats_view_sum_all` "
- " WHERE `nickserv_display` = @display@ AND `chanserv_name` = @channel@;";
query.setValue("channel", source.c->ci->name);
- }
- query.setValue("display", display);
+ query.setValue("nick", display);
SQLResult res = this->RunQuery(query);
if (res.Rows() > 0)