From 71b9af776ef53c6902c020cf729c5277b824e0f9 Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Sat, 24 Aug 2013 07:36:30 -0700 Subject: Option to select if chanhistory is on for bots --- docs/conf/modules.conf.example | 3 ++- src/modules/m_chanhistory.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 228d96312..ca1340f04 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -384,7 +384,8 @@ # This is the hard limit for 'X'. # If notice is set to yes, joining users will get a NOTICE before playback # telling them about the following lines being the pre-join history. -# +# If bots is set to yes, it will also send to users marked with +B +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Channel logging module: used to send snotice output to channels, to diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index bace497c2..f1f9ed614 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") { } @@ -125,6 +127,7 @@ class ModuleChanHistory : public Module 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 @@ -148,6 +151,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; -- cgit v1.2.3