]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_chanhistory: optionally exempt bots from receiving history.
authorMichael Hazell <michaelhazell@hotmail.com>
Fri, 29 Dec 2017 23:16:39 +0000 (18:16 -0500)
committerPeter Powell <petpow@saberuk.com>
Sun, 31 Dec 2017 10:59:02 +0000 (10:59 +0000)
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.

docs/conf/modules.conf.example
src/modules/m_chanhistory.cpp

index 9c19e3e43579d3c75333e8461854498e2801d710..4abd3ba58007e8a292186ebdb4ddd5085a7ed7d3 100644 (file)
 # 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
index e48e67fe5557ffb601425de6dde5ceba787e3b7b..08f31657853bc610e9c8f8cad69f2930a2c43a2c 100644 (file)
@@ -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;