# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1732283448 0
# Node ID cc665f3436902599ef7a19ff81e6cc76b1465e35
# Parent  56fa3bad16cc967c07febd59dbb06b5d9a7334d3
mod_firewall: SUBSCRIBED: Flip subscription check to match documentation

The documentation claims that this condition checks whether the recipient is
subscribed to the sender.

However, it was using the wrong method, and actually checking whether the
sender was subscribed to the recipient.

A quick poll of folk suggested that the documentation's approach is the right
one, so this should fix the code to match the documentation.

This should also fix the bundled anti-spam rules from blocking presence from
JIDs that you subscribe do (but don't have a mutual subscription with).

diff -r 56fa3bad16cc -r cc665f343690 mod_firewall/conditions.lib.lua
--- a/mod_firewall/conditions.lib.lua	Tue Nov 19 10:44:00 2024 +0100
+++ b/mod_firewall/conditions.lib.lua	Fri Nov 22 13:50:48 2024 +0000
@@ -123,7 +123,7 @@
 end
 
 function condition_handlers.SUBSCRIBED()
-	return "(bare_to == bare_from or to_node and rostermanager.is_contact_subscribed(to_node, to_host, bare_from))",
+	return "(bare_to == bare_from or to_node and rostermanager.is_user_subscribed(to_node, to_host, bare_from))",
 	       { "rostermanager", "split_to", "bare_to", "bare_from" };
 end