diff mod_http_admin_api/mod_http_admin_api.lua @ 5891:512f912fdfa5

mod_http_admin_api: Use new API in mod_announce to send announcements
author Matthew Wild <mwild1@gmail.com>
date Wed, 24 Apr 2024 13:47:48 +0100
parents 432efc39572f
children 095030677ae6
line wrap: on
line diff
--- 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