- CUList empty;
- 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);
+ const std::string expiry = "*** Timed ban on " + cr->name + " expired.";
+ // 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() : '@';
+
+ ClientProtocol::Messages::Privmsg notice(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, cr, expiry, MSG_NOTICE);
+ cr->Write(ServerInstance->GetRFCEvents().privmsg, notice, pfxchar);
+ ServerInstance->PI->SendChannelNotice(cr, pfxchar, expiry);