- CUList empty;
- 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);
-
- Modes::ChangeList setban;
- setban.push_remove(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask);
- ServerInstance->Modes->Process(ServerInstance->FakeClient, cr, NULL, setban);
+ const std::string message = InspIRCd::Format("Timed ban %s set by %s on %s has expired.",
+ mask.c_str(), i->setter.c_str(), cr->name.c_str());
+ // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
+ PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
+ char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
+
+ cr->WriteRemoteNotice(message, pfxchar);