diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-06-17 17:45:12 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-06-17 17:45:12 +0200 |
commit | 04ce84ce7c817a896d35aba7b8f35b15bda58195 (patch) | |
tree | a388cac71e7f4ff804ae5296985c27e403985cf8 /src | |
parent | f293861ab70eab76ae0715a5f2c2769de332c779 (diff) |
m_chanhistory Add config setting to show/hide the informational notice before playing back history, don't playback to remote users
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_chanhistory.cpp | 17 |
1 files 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<HistoryItem>::iterator i = list->lines.begin(); i != list->lines.end(); ++i) { if (i->ts >= mintime) |