# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1638878635 -3600
# Node ID 376522fb3f5254ecf9288562086701cbb14b97e4
# Parent  a949f1aae171e3d67e7b5de5c469264edf33b10f
mod_pubsub: Allow specifying the JID of the pubsub service

This allows overriding it in cases where it is not equal to module.host,
like say, in mod_pep

diff -r a949f1aae171 -r 376522fb3f52 plugins/mod_pubsub/mod_pubsub.lua
--- a/plugins/mod_pubsub/mod_pubsub.lua	Mon Dec 06 22:38:27 2021 +0100
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Tue Dec 07 13:03:55 2021 +0100
@@ -231,6 +231,7 @@
 		check_node_config = check_node_config;
 		get_affiliation = get_affiliation;
 
+		jid = module.host;
 		normalize_jid = jid_bare;
 	}));
 end
diff -r a949f1aae171 -r 376522fb3f52 plugins/mod_pubsub/pubsub.lib.lua
--- a/plugins/mod_pubsub/pubsub.lib.lua	Mon Dec 06 22:38:27 2021 +0100
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Tue Dec 07 13:03:55 2021 +0100
@@ -309,7 +309,7 @@
 	end
 
 	for _, id in ipairs(ret) do
-		reply:tag("item", { jid = module.host, name = id }):up();
+		reply:tag("item", { jid = service.jid or module.host, name = id }):up();
 	end
 	event.exists = true;
 end