mod_http_admin_api: Use new API in mod_announce to send announcements
authorMatthew Wild <mwild1@gmail.com>
Wed, 24 Apr 2024 13:47:48 +0100
changeset 5895 512f912fdfa5
parent 5894 ba71fdc8ea73
child 5896 433a4dd1dc2a
mod_http_admin_api: Use new API in mod_announce to send announcements
mod_http_admin_api/mod_http_admin_api.lua
--- a/mod_http_admin_api/mod_http_admin_api.lua	Tue Apr 23 12:10:38 2024 +0100
+++ b/mod_http_admin_api/mod_http_admin_api.lua	Wed Apr 24 13:47:48 2024 +0100
@@ -799,9 +799,13 @@
 	if body.recipients == "online" then
 		announce.send_to_online(message, host);
 	elseif body.recipients == "all" then
-		for username in usermanager.users(host) do
-			message.attr.to = username .. "@" .. host
-			module:send(st.clone(message))
+		if announce.send_to_all then
+			announce.send_to_all(message, host);
+		else -- COMPAT w/ 0.12 and trunk before e22609460975
+			for username in usermanager.users(host) do
+				message.attr.to = username .. "@" .. host
+				module:send(st.clone(message))
+			end
 		end
 	else
 		for _, addr in ipairs(body.recipients) do