From 845ca576b4c5a94f0a3ec12a4dd524a7d017155e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 28 Jan 2015 22:57:15 -0500 Subject: More properly track topic change sources and allow users with access to change topics through topiclock --- modules/extra/stats/irc2sql/irc2sql.cpp | 2 +- modules/extra/stats/irc2sql/irc2sql.h | 2 +- modules/extra/stats/m_chanstats.cpp | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'modules/extra/stats') diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index fd0ca5890..87ede04fd 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -243,7 +243,7 @@ void IRC2SQL::OnLeaveChannel(User *u, Channel *c) this->RunQuery(query); } -void IRC2SQL::OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) +void IRC2SQL::OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) { query = "UPDATE `" + prefix + "chan` " "SET topic=@topic@, topicauthor=@author@, topictime=FROM_UNIXTIME(@time@) " diff --git a/modules/extra/stats/irc2sql/irc2sql.h b/modules/extra/stats/irc2sql/irc2sql.h index 0c516f5e3..1ed5790aa 100644 --- a/modules/extra/stats/irc2sql/irc2sql.h +++ b/modules/extra/stats/irc2sql/irc2sql.h @@ -69,7 +69,7 @@ class IRC2SQL : public Module EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; - void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override; + void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override; void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) anope_override; }; diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index 7a2fe0486..27b1b3eae 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -517,14 +517,13 @@ class MChanstats : public Module info.AddOption(_("Chanstats")); } - void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override + void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override { - User *u = User::Find(user); - if (!u || !u->Account() || !c->ci || !cs_stats.HasExt(c->ci)) + if (!source || !source->Account() || !c->ci || !cs_stats.HasExt(c->ci)) return; query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);"; query.SetValue("channel", c->name); - query.SetValue("nick", GetDisplay(u)); + query.SetValue("nick", GetDisplay(source)); this->RunQuery(query); } -- cgit From a458f7c8409bcaac5f3ee42d65d40cd88de5a99f Mon Sep 17 00:00:00 2001 From: Jyzee Date: Thu, 30 Apr 2015 19:29:44 +0200 Subject: irc2sql: handle away messages. --- modules/extra/stats/irc2sql/irc2sql.cpp | 9 +++++++++ modules/extra/stats/irc2sql/irc2sql.h | 1 + 2 files changed, 10 insertions(+) (limited to 'modules/extra/stats') diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index 87ede04fd..a00181304 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -131,6 +131,15 @@ void IRC2SQL::OnUserNickChange(User *u, const Anope::string &oldnick) this->RunQuery(query); } +void IRC2SQL::OnUserAway(User *u, const Anope::string &message) +{ + query = "UPDATE `" + prefix + "user` SET away=@away@, awaymsg=@awaymsg@ WHERE nick=@nick@"; + query.SetValue("away", (!message.empty()) ? "Y" : "N"); + query.SetValue("awaymsg", message); + query.SetValue("nick", u->nick); + this->RunQuery(query); +} + void IRC2SQL::OnFingerprint(User *u) { query = "UPDATE `" + prefix + "user` SET secure=@secure@, fingerprint=@fingerprint@ WHERE nick=@nick@"; diff --git a/modules/extra/stats/irc2sql/irc2sql.h b/modules/extra/stats/irc2sql/irc2sql.h index 1ed5790aa..a7396fcf0 100644 --- a/modules/extra/stats/irc2sql/irc2sql.h +++ b/modules/extra/stats/irc2sql/irc2sql.h @@ -55,6 +55,7 @@ class IRC2SQL : public Module void OnUserConnect(User *u, bool &exempt) anope_override; void OnUserQuit(User *u, const Anope::string &msg) anope_override; void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override; + void OnUserAway(User *u, const Anope::string &message) anope_override; void OnFingerprint(User *u) anope_override; void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; -- cgit From 1666b1a8d8d629fd4ea89b083863dc217154eee9 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 8 Jul 2015 10:55:44 +0100 Subject: Fix a ton of typos. --- modules/extra/stats/m_chanstats.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/extra/stats') diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index 27b1b3eae..e21b3641d 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -424,7 +424,7 @@ class MChanstats : public Module "END;"; this->RunQuery(query); - /* dont prepend any database prefix to events so we can always delete/change old events */ + /* don't prepend any database prefix to events so we can always delete/change old events */ if (this->HasEvent("chanstats_event_cleanup_daily")) { query = "DROP EVENT chanstats_event_cleanup_daily"; -- cgit