]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_timedbans.cpp
Fix recommended by nenolod, silly mistake apparently :P
[user/henk/code/inspircd.git] / src / modules / m_timedbans.cpp
index a411dade9dc349fcd6a27180f219c0d159360495..77660da7b5a5aad1a09a150d17c972b622828186 100644 (file)
@@ -40,7 +40,7 @@ class CommandTban : public Command
                TRANSLATE4(TR_TEXT, TR_TEXT, TR_TEXT, TR_END);
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, User *user)
+       CmdResult Handle (const char* const* parameters, int pcnt, User *user)
        {
                Channel* channel = ServerInstance->FindChan(parameters[0]);
                if (channel)
@@ -85,11 +85,13 @@ class CommandTban : public Command
                                                was_added = true;
                                if (was_added)
                                {
+                                       CUList tmp;
                                        T.channel = channelname;
                                        T.mask = mask;
                                        T.expire = expire;
                                        TimedBanList.push_back(T);
-                                       channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name, user->nick, mask.c_str(), duration);
+                                       channel->WriteAllExcept(user, true, '@', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name, user->nick, mask.c_str(), duration);
+                                       channel->WriteAllExcept(user, true, '%', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name, user->nick, mask.c_str(), duration);
                                        return CMD_SUCCESS;
                                }
                                return CMD_FAILURE;
@@ -155,7 +157,6 @@ class ModuleTimedBans : public Module
                                        again = true;
                                        if (cr)
                                        {
-                                               cr->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :Timed ban on %s expired.", cr->name, i->mask.c_str());
                                                const char *setban[3];
                                                setban[0] = i->channel.c_str();
                                                setban[1] = "-b";
@@ -169,6 +170,10 @@ class ModuleTimedBans : public Module
                                                ServerInstance->SendMode(setban,3, ServerInstance->FakeClient);
                                                Event rmode((char *)&n, NULL, "send_mode");
                                                rmode.Send(ServerInstance);
+                                               CUList empty;
+                                               cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str());
+                                               if (ServerInstance->Config->AllowHalfop)
+                                                       cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str());
                                        }
                                        else
                                        {