summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hazell <michaelhazell@hotmail.com>2017-12-29 18:16:39 -0500
committerPeter Powell <petpow@saberuk.com>2017-12-31 10:59:02 +0000
commit758cf504f1b049c5a1b33f7f774042c5e3efaea5 (patch)
treef8a0ee8284f536d02ac00243ff244d8570a2ba53
parent9b3e0a2cea3ac158a56001e581177e41bd71bab8 (diff)
m_chanhistory: optionally exempt bots from receiving history.
Sending history to some bots can cause problems as without the IRCv3 chathistory batch they have no way of knowing what messages are history and what they should respond to. Closes #1450.
-rw-r--r--docs/conf/modules.conf.example3
-rw-r--r--src/modules/m_chanhistory.cpp5
2 files changed, 7 insertions, 1 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 9c19e3e43..4abd3ba58 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -383,7 +383,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.
-#<chanhistory maxlines="20" notice="yes">
+# If bots is set to yes, it will also send to users marked with +B
+#<chanhistory maxlines="20" notice="yes" bots="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# 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 e48e67fe5..08f316578 100644
--- a/src/modules/m_chanhistory.cpp
+++ b/src/modules/m_chanhistory.cpp
@@ -111,6 +111,7 @@ class ModuleChanHistory : public Module
{
HistoryMode m;
bool sendnotice;
+ bool dobots;
public:
ModuleChanHistory() : m(this)
{
@@ -131,6 +132,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&)
@@ -156,6 +158,9 @@ class ModuleChanHistory : public Module
if (IS_REMOTE(memb->user))
return;
+ if (!dobots && ServerInstance->Modules->Find("m_botmode.so") && memb->user->IsModeSet('B'))
+ return;
+
HistoryList* list = m.ext.get(memb->chan);
if (!list)
return;