]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Merge pull request #616 from ShutterQuick/inspircd+chanhistbot
authorAttila Molnar <attilamolnar@hush.com>
Sat, 24 Aug 2013 14:50:02 +0000 (07:50 -0700)
committerAttila Molnar <attilamolnar@hush.com>
Sat, 24 Aug 2013 14:50:02 +0000 (07:50 -0700)
Option to select if chanhistory is on for bots

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

index 228d96312936702e79b9527b5f8626ec85e233b2..ca1340f040f4b7915f64075d4e3d84bb01e721e9 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 bace497c20dfb2a111b49bd8a11f2428740e6256..f1f9ed614907e79f401f5ec67f67853a402f9ad4 100644 (file)
@@ -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;