Changeset

5014:b2006c1cfa85

mod_announce, mod_motd, mod_pubsub, mod_register, mod_watchregistrations, mod_welcome: Use module:send() instead of core_*_stanza()
author Kim Alvefur <zash@zash.se>
date Thu, 26 Jul 2012 04:35:13 +0200
parents 5013:ab693eea0869
children 5015:f19b38bfa015
files plugins/mod_announce.lua plugins/mod_motd.lua plugins/mod_pubsub.lua plugins/mod_register.lua plugins/mod_watchregistrations.lua plugins/mod_welcome.lua
diffstat 6 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_announce.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_announce.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -25,7 +25,7 @@
 			for username in pairs(host_session.sessions) do
 				c = c + 1;
 				message.attr.to = username.."@"..hostname;
-				core_post_stanza(host_session, message);
+				module:send(message);
 			end
 		end
 	end
--- a/plugins/mod_motd.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_motd.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -24,7 +24,7 @@
 			local motd_stanza =
 				st.message({ to = session.full_jid, from = motd_jid })
 					:tag("body"):text(motd_text);
-			core_route_stanza(hosts[host], motd_stanza);
+			module:send(motd_stanza);
 			module:log("debug", "MOTD send to user %s", session.full_jid);
 		end
 end, 1);
--- a/plugins/mod_pubsub.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_pubsub.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -201,7 +201,7 @@
 	for jid in pairs(jids) do
 		module:log("debug", "Sending notification to %s", jid);
 		message.attr.to = jid;
-		core_post_stanza(hosts[module.host], message);
+		module:send(message);
 	end
 end
 
--- a/plugins/mod_register.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_register.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -120,10 +120,10 @@
 			for jid, item in pairs(roster) do
 				if jid and jid ~= "pending" then
 					if item.subscription == "both" or item.subscription == "from" or (roster.pending and roster.pending[jid]) then
-						core_post_stanza(hosts[host], st.presence({type="unsubscribed", from=bare, to=jid}));
+						module:send(st.presence({type="unsubscribed", from=bare, to=jid}));
 					end
 					if item.subscription == "both" or item.subscription == "to" or item.ask then
-						core_post_stanza(hosts[host], st.presence({type="unsubscribe", from=bare, to=jid}));
+						module:send(st.presence({type="unsubscribe", from=bare, to=jid}));
 					end
 				end
 			end
--- a/plugins/mod_watchregistrations.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_watchregistrations.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -25,6 +25,6 @@
 	for jid in registration_watchers do
 		module:log("debug", "Notifying %s", jid);
 		message.attr.to = jid;
-		core_route_stanza(hosts[host], message);
+		module:send(message);
 	end
 end);
--- a/plugins/mod_welcome.lua	Thu Jul 26 04:33:17 2012 +0200
+++ b/plugins/mod_welcome.lua	Thu Jul 26 04:35:13 2012 +0200
@@ -16,6 +16,6 @@
 		local welcome_stanza =
 			st.message({ to = user.username.."@"..user.host, from = host })
 				:tag("body"):text(welcome_text:gsub("$(%w+)", user));
-		core_route_stanza(hosts[host], welcome_stanza);
+		module:send(welcome_stanza);
 		module:log("debug", "Welcomed user %s@%s", user.username, user.host);
 	end);