From 04ce84ce7c817a896d35aba7b8f35b15bda58195 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 17 Jun 2012 17:45:12 +0200 Subject: m_chanhistory Add config setting to show/hide the informational notice before playing back history, don't playback to remote users --- src/modules/m_chanhistory.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index 9275152ea..f6454a622 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -77,6 +77,7 @@ class HistoryMode : public ModeHandler class ModuleChanHistory : public Module { HistoryMode m; + bool sendnotice; public: ModuleChanHistory() : m(this) { @@ -93,7 +94,9 @@ class ModuleChanHistory : public Module void OnRehash(User*) { - m.maxlines = ServerInstance->Config->ConfValue("chanhistory")->getInt("maxlines", 50); + ConfigTag* tag = ServerInstance->Config->ConfValue("chanhistory"); + m.maxlines = tag->getInt("maxlines", 50); + sendnotice = tag->getInt("notice", true); } ~ModuleChanHistory() @@ -121,14 +124,22 @@ class ModuleChanHistory : public Module void OnPostJoin(Membership* memb) { + if (IS_REMOTE(memb->user)) + return; + HistoryList* list = m.ext.get(memb->chan); if (!list) return; time_t mintime = 0; if (list->maxtime) mintime = ServerInstance->Time() - list->maxtime; - memb->user->WriteServ("NOTICE %s :Replaying up to %d lines of pre-join history spanning up to %d seconds", - memb->chan->name.c_str(), list->maxlen, list->maxtime); + + if (sendnotice) + { + memb->user->WriteServ("NOTICE %s :Replaying up to %d lines of pre-join history spanning up to %d seconds", + memb->chan->name.c_str(), list->maxlen, list->maxtime); + } + for(std::deque::iterator i = list->lines.begin(); i != list->lines.end(); ++i) { if (i->ts >= mintime) -- cgit v1.3.1-10-gc9f91