summaryrefslogtreecommitdiff
path: root/modules/extra/stats/m_chanstats.cpp
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2014-01-17 06:49:49 +0100
committerDukePyrolator <DukePyrolator@anope.org>2014-01-17 06:49:49 +0100
commit4b192addd2fbd20c2dd98530cd57580fa41bd30e (patch)
tree75dc5f524a7b4304078670369e1ee6c41d98365f /modules/extra/stats/m_chanstats.cpp
parentd27594f8a61a7a3eae74a56983b2957233a0b64d (diff)
m_chanstats: do not count negative words if you have more smileys in a line than words
Diffstat (limited to 'modules/extra/stats/m_chanstats.cpp')
-rw-r--r--modules/extra/stats/m_chanstats.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp
index 13958dcc3..c3be9d640 100644
--- a/modules/extra/stats/m_chanstats.cpp
+++ b/modules/extra/stats/m_chanstats.cpp
@@ -589,7 +589,12 @@ class MChanstats : public Module
size_t smileys_other = CountSmileys(msg, SmileysOther);
// do not count smileys as words
- words = words - smileys_happy - smileys_sad - smileys_other;
+ size_t smileys = smileys_happy + smileys_sad + smileys_other;
+ if (smileys > words)
+ words = 0;
+ else
+ words = words - smileys;
+
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 1, @letters@, @words@, @action@, "
"@smileys_happy@, @smileys_sad@, @smileys_other@, '0', '0', '0', '0');";
query.SetValue("channel", c->name);