X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanhistory.cpp;h=0e0841f6760a916d051afe2289882a764e4fe868;hb=c202dea024542b9c6c6b771bb9a3a081d9eacdc5;hp=464195e39c52dff9c8245f72281f768b727cf90a;hpb=fd0fa86da89ab4cefa778307088ef2552a05a170;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index 464195e39..0e0841f67 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -107,8 +107,10 @@ class ModuleChanHistory : public Module { HistoryMode m; bool sendnotice; + UserModeReference botmode; + bool dobots; public: - ModuleChanHistory() : m(this) + ModuleChanHistory() : m(this), botmode(this, "bot") { } @@ -116,17 +118,14 @@ class ModuleChanHistory : public Module { ServerInstance->Modules->AddService(m); ServerInstance->Modules->AddService(m.ext); - - Implementation eventlist[] = { I_OnPostJoin, I_OnUserMessage, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - OnRehash(NULL); } - void OnRehash(User*) CXX11_OVERRIDE + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("chanhistory"); m.maxlines = tag->getInt("maxlines", 50); sendnotice = tag->getBool("notice", true); + dobots = tag->getBool("bots", true); } void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList&, MessageType msgtype) CXX11_OVERRIDE @@ -150,6 +149,9 @@ class ModuleChanHistory : public Module if (IS_REMOTE(memb->user)) return; + if (memb->user->IsModeSet(botmode) && !dobots) + return; + HistoryList* list = m.ext.get(memb->chan); if (!list) return;