* | 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.
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;
{
irc::string listitem = banmask.c_str();
irc::string thischan = chan->name.c_str();
- for (timedbans::iterator i = TimedBanList.begin(); i < TimedBanList.end(); i++)
+ for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end(); i++)
{
irc::string target = i->mask.c_str();
irc::string tchan = i->channel.c_str();
virtual void OnBackgroundTimer(time_t curtime)
{
- timedbans::iterator safei;
- for (timedbans::iterator i = TimedBanList.begin(); i < TimedBanList.end();)
+ for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end();)
{
- /* Safe copy of iterator, so we can erase as we iterate */
- safei = i;
- ++i;
-
- if (curtime > safei->expire)
+ if (curtime > i->expire)
{
- Channel* cr = ServerInstance->FindChan(safei->channel);
+ std::string chan = i->channel;
+ std::string mask = i->mask;
+ Channel* cr = ServerInstance->FindChan(chan);
+ i = TimedBanList.erase(i);
if (cr)
{
- std::string mask = safei->mask;
std::vector<std::string> setban;
- setban.push_back(safei->channel);
+ setban.push_back(chan);
setban.push_back("-b");
setban.push_back(mask);
CUList empty;
- cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.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)
- cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.c_str());
+ {
+ cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str());
+ ServerInstance->PI->SendChannelNotice(cr, '%', expiry);
+ }
- /* Removes the ban item for us, no ::erase() needed */
- ServerInstance->PI->SendModeStr(safei->channel, std::string("-b ") + setban[2]);
ServerInstance->SendMode(setban, ServerInstance->FakeClient);
-
- if (ServerInstance->Modes->GetLastParse().empty())
- TimedBanList.erase(safei);
- }
- else
- {
- /* Where the hell did our channel go?! */
- TimedBanList.erase(safei);
+ ServerInstance->PI->SendMode(chan, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate());
}
}
+ else
+ ++i;
}
}