]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_timedbans.cpp
Weed out a few leftover server instances from before modules had ServerInstance....
[user/henk/code/inspircd.git] / src / modules / m_timedbans.cpp
index a10f90819e47580efda2db5026fa89b122a33523..07a5d8c990e894282b5cb4f22c2a845c26d3502d 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *         the file COPYING for details.
@@ -64,7 +64,7 @@ class CommandTban : public Command
                                TimedBan T;
                                std::string channelname = parameters[0];
                                long duration = ServerInstance->Duration(parameters[1]);
-                               unsigned long expire = duration + time(NULL);
+                               unsigned long expire = duration + ServerInstance->Time();
                                if (duration < 1)
                                {
                                        user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time");
@@ -91,8 +91,12 @@ class CommandTban : public Command
                                        T.expire = expire;
                                        TimedBanList.push_back(T);
                                        channel->WriteAllExcept(user, true, '@', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration);
+                                       ServerInstance->PI->SendChannelNotice(channel, '@', user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds.");
                                        if (ServerInstance->Config->AllowHalfop)
+                                       {
                                                channel->WriteAllExcept(user, true, '%', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration);
+                                               ServerInstance->PI->SendChannelNotice(channel, '%', user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds.");
+                                       }
                                        return CMD_SUCCESS;
                                }
                                return CMD_FAILURE;
@@ -165,8 +169,12 @@ class ModuleTimedBans : public Module
 
                                        CUList empty;
                                        cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.c_str());
+                                       ServerInstance->PI->SendChannelNotice(cr, '@', "*** Timed ban on " + safei->mask + " expired.");
                                        if (ServerInstance->Config->AllowHalfop)
+                                       {
                                                cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.c_str());
+                                               ServerInstance->PI->SendChannelNotice(cr, '%', "*** Timed ban on " + safei->mask + " expired.");
+                                       }
 
                                        /* Removes the ban item for us, no ::erase() needed */
                                        ServerInstance->PI->SendModeStr(safei->channel, std::string("-b ") + setban[2]);