- chanrec* cr = Srv->FindChannel(i->channel);
- again = true;
- if (cr)
- {
- cr->WriteChannelWithServ(Srv->GetServerName().c_str(), "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";
- setban[2] = 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);
- /* FIX: Send mode remotely*/
- std::deque<std::string> n;
- n.push_back(i->channel);
- n.push_back("-b");
- n.push_back(i->mask);
- Event rmode((char *)&n, NULL, "send_mode");
- rmode.Send();
- DELETE(temp);
- }
- else
- {
- /* Where the hell did our channel go?! */
- TimedBanList.erase(i);
- }
- // 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.c_str(), safei->mask.c_str());
+ 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());
+
+ /* 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);