X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_timedbans.cpp;h=874e6440f81495986d66d433dc02cbdcc32fb984;hb=3b78613576364c4ac6a4e4af43a2eea056c8dd3f;hp=8196d37ba6299a01f509c9ed70279a2a99fcec9c;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 8196d37ba..874e6440f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -28,7 +28,6 @@ class TimedBan { public: - std::string channel; std::string mask; time_t expire; Channel* chan; @@ -72,19 +71,17 @@ class CommandTban : public Command Channel* channel = ServerInstance->FindChan(parameters[0]); if (!channel) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such channel", parameters[0].c_str()); + user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); return CMD_FAILURE; } int cm = channel->GetPrefixValue(user); if (cm < HALFOP_VALUE) { - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have permission to set bans on this channel", - channel->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, "You do not have permission to set bans on this channel"); return CMD_FAILURE; } TimedBan T; - std::string channelname = parameters[0]; unsigned long duration = InspIRCd::Duration(parameters[1]); unsigned long expire = duration + ServerInstance->Time(); if (duration < 1) @@ -115,7 +112,6 @@ class CommandTban : public Command } CUList tmp; - T.channel = channelname; T.mask = mask; T.expire = expire + (IS_REMOTE(user) ? 5 : 0); T.chan = channel; @@ -148,13 +144,13 @@ class BanWatcher : public ModeWatcher if (adding) return; - irc::string listitem = banmask.c_str(); - irc::string thischan = chan->name.c_str(); for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end(); ++i) { - irc::string target = i->mask.c_str(); - irc::string tchan = i->channel.c_str(); - if ((listitem == target) && (tchan == thischan)) + if (i->chan != chan) + continue; + + const std::string& target = i->mask; + if (irc::equals(banmask, target)) { TimedBanList.erase(i); break; @@ -207,13 +203,11 @@ class ModuleTimedBans : public Module for (timedbans::iterator i = expired.begin(); i != expired.end(); i++) { - std::string chan = i->channel; std::string mask = i->mask; - Channel* cr = ServerInstance->FindChan(chan); - if (cr) + Channel* cr = i->chan; { CUList empty; - std::string expiry = "*** Timed ban on " + chan + " expired."; + std::string expiry = "*** Timed ban on " + cr->name + " expired."; cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); ServerInstance->PI->SendChannelNotice(cr, '@', expiry);