]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockamsg.cpp
Unite SSL service providers and SSL profile classes
[user/henk/code/inspircd.git] / src / modules / m_blockamsg.cpp
index b456606a8ff997103f8ea684169d3473a6e1b06a..7d97069f540f9ad2b07d7980a97fa3158c492d03 100644 (file)
@@ -37,11 +37,11 @@ class BlockedMessage
 {
  public:
        std::string message;
-       irc::string target;
+       std::string target;
        time_t sent;
 
        BlockedMessage(const std::string& msg, const std::string& tgt, time_t when)
-               : message(msg), target(tgt.c_str()), sent(when)
+               : message(msg), target(tgt), sent(when)
        {
        }
 };
@@ -53,7 +53,8 @@ class ModuleBlockAmsg : public Module
        SimpleExtItem<BlockedMessage> blockamsg;
 
  public:
-       ModuleBlockAmsg() : blockamsg("blockamsg", this)
+       ModuleBlockAmsg()
+               : blockamsg("blockamsg", ExtensionItem::EXT_USER, this)
        {
        }
 
@@ -65,7 +66,7 @@ class ModuleBlockAmsg : public Module
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("blockamsg");
-               ForgetDelay = tag->getInt("delay", -1);
+               ForgetDelay = tag->getDuration("delay", -1);
                std::string act = tag->getString("action");
 
                if (act == "notice")
@@ -115,7 +116,7 @@ class ModuleBlockAmsg : public Module
                        // OR
                        // The number of target channels is equal to the number of channels the sender is on..a little suspicious.
                        // Check it's more than 1 too, or else users on one channel would have fun.
-                       if ((m && (m->message == parameters[1]) && (m->target != parameters[0]) && (ForgetDelay != -1) && (m->sent >= ServerInstance->Time()-ForgetDelay)) || ((targets > 1) && (targets == user->chans.size())))
+                       if ((m && (m->message == parameters[1]) && (!irc::equals(m->target, parameters[0])) && (ForgetDelay != -1) && (m->sent >= ServerInstance->Time()-ForgetDelay)) || ((targets > 1) && (targets == user->chans.size())))
                        {
                                // Block it...
                                if (action == IBLOCK_KILLOPERS || action == IBLOCK_NOTICEOPERS)
@@ -133,7 +134,7 @@ class ModuleBlockAmsg : public Module
                        {
                                // If there's already a BlockedMessage allocated, use it.
                                m->message = parameters[1];
-                               m->target = parameters[0].c_str();
+                               m->target = parameters[0];
                                m->sent = ServerInstance->Time();
                        }
                        else