X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_timedbans.cpp;h=94301bb7b6735572826e8b29b0db28871251af6d;hb=b43fc66c17c2bef6dca66a966676b8128d5774ee;hp=e18bca6a5ee9a386b09d7742af256bce937ebb8f;hpb=eba6c0fb9126d51b42deda79c6c4a43e15f8923f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index e18bca6a5..94301bb7b 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -17,7 +17,7 @@ /** Holds a timed ban */ -class TimedBan : public classbase +class TimedBan { public: std::string channel; @@ -33,9 +33,8 @@ timedbans TimedBanList; class CommandTban : public Command { public: - CommandTban (InspIRCd* Instance) : Command(Instance,"TBAN", 0, 3) + CommandTban(Module* Creator) : Command(Creator,"TBAN", 3) { - this->source = "m_timedbans.so"; syntax = " "; TRANSLATE4(TR_TEXT, TR_TEXT, TR_TEXT, TR_END); } @@ -45,8 +44,8 @@ class CommandTban : public Command Channel* channel = ServerInstance->FindChan(parameters[0]); if (channel) { - int cm = channel->GetStatus(user); - if ((cm == STATUS_HOP) || (cm == STATUS_OP)) + int cm = channel->GetPrefixValue(user); + if ((cm == HALFOP_VALUE) || (cm == OP_VALUE)) { if (!ServerInstance->IsValidMask(parameters[2])) { @@ -108,18 +107,21 @@ class CommandTban : public Command user->WriteNumeric(401, "%s %s :No such channel",user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } + + RouteDescriptor GetRouting(User* user, const std::vector& parameters) + { + return ROUTE_BROADCAST; + } }; class ModuleTimedBans : public Module { - CommandTban* mycommand; + CommandTban cmd; public: - ModuleTimedBans(InspIRCd* Me) - : Module(Me) + ModuleTimedBans() + : cmd(this) { - - mycommand = new CommandTban(ServerInstance); - ServerInstance->AddCommand(mycommand); + ServerInstance->AddCommand(&cmd); TimedBanList.clear(); Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -130,7 +132,7 @@ class ModuleTimedBans : public Module TimedBanList.clear(); } - virtual int OnDelBan(User* source, Channel* chan, const std::string &banmask) + virtual ModResult OnDelBan(User* source, Channel* chan, const std::string &banmask) { irc::string listitem = banmask.c_str(); irc::string thischan = chan->name.c_str(); @@ -144,7 +146,7 @@ class ModuleTimedBans : public Module break; } } - return 0; + return MOD_RES_PASSTHRU; } virtual void OnBackgroundTimer(time_t curtime) @@ -153,20 +155,20 @@ class ModuleTimedBans : public Module { if (curtime > i->expire) { - std::string chan = i->mask; + std::string chan = i->channel; std::string mask = i->mask; Channel* cr = ServerInstance->FindChan(chan); i = TimedBanList.erase(i); if (cr) { std::vector setban; - setban.push_back(safei->channel); + setban.push_back(chan); setban.push_back("-b"); setban.push_back(mask); CUList empty; - std::string expiry = "*** Timed ban on " + safei->mask + " expired."; - cr->WriteChannelWithServ(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); + std::string expiry = "*** Timed ban on " + chan + " expired."; + cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); ServerInstance->PI->SendChannelNotice(cr, '@', expiry); if (ServerInstance->Config->AllowHalfop) { @@ -185,7 +187,7 @@ class ModuleTimedBans : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Adds timed bans", VF_COMMON | VF_VENDOR); } };