]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanhistory.cpp
Make sure banredirect metadata can not be duplicated
[user/henk/code/inspircd.git] / src / modules / m_chanhistory.cpp
index 5cbc564fbd258dd86276bb6fc22e804882c9aeee..08f31657853bc610e9c8f8cad69f2930a2c43a2c 100644 (file)
@@ -37,12 +37,12 @@ struct HistoryList
 
 class HistoryMode : public ModeHandler
 {
-       bool IsValidDuration(const std::string duration)
+       bool IsValidDuration(const std::string& duration)
        {
                for (std::string::const_iterator i = duration.begin(); i != duration.end(); ++i)
                {
                        unsigned char c = *i;
-                       if (((c >= '0') && (c <= '9')) || (c == 's') || (c != 'S'))
+                       if (((c >= '0') && (c <= '9')) || (c == 's') || (c == 'S'))
                                continue;
 
                        if (duration_multi[c] == 1)
@@ -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;