- chanrec* cr = Srv->FindChannel(i->channel);
- again = true;
- if (cr)
- {
- Srv->SendChannelServerNotice(Srv->GetServerName(),cr,"NOTICE "+std::string(cr->name)+" :Timed ban on "+i->mask+" expired.");
- char *setban[3];
- setban[0] = (char*)i->channel.c_str();
- setban[1] = "-b";
- setban[2] = (char*)i->mask.c_str();
- // kludge alert!
- // ::SendMode expects a userrec* to send the numeric replies
- // back to, so we create it a fake user that isnt in the user
- // hash and set its descriptor to FD_MAGIC_NUMBER so the data
- // falls into the abyss :p
- userrec* temp = new userrec;
- temp->fd = FD_MAGIC_NUMBER;
- temp->server = "";
- Srv->SendMode(setban,3,temp);
- DELETE(temp);
- }
- // we used to delete the item here, but we dont need to as the servermode above does it for us,
- break;
+ std::string mask = safei->mask;
+ std::vector<std::string> setban;
+ setban.push_back(safei->channel);
+ 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, safei->mask.c_str());
+ if (ServerInstance->Config->AllowHalfop)
+ cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, safei->mask.c_str());
+
+ /* 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);