changeset 2413:b64c0150d663

mod_profile: Add warning and debug logging in order to catch a weird event
author Kim Alvefur <zash@zash.se>
date Sat, 03 Dec 2016 23:18:53 +0100
parents 9159f9166893
children 97b4229982f5
files mod_profile/mod_profile.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_profile/mod_profile.lua	Sat Dec 03 20:00:08 2016 +0100
+++ b/mod_profile/mod_profile.lua	Sat Dec 03 23:18:53 2016 +0100
@@ -143,7 +143,14 @@
 local function on_publish(event)
 	if event.actor == true then return end -- Not from a client
 	local node, item = event.node, event.item;
-	local username = jid_split(event.actor);
+	local username, host = jid_split(event.actor);
+	if host ~= module.host then
+		module:log("warn", "on_publish() called for non-local actor");
+		for k,v in pairs(event) do
+			module:log("debug", "event[%q] = %q", tosting(k), tostring(v));
+		end
+		return;
+	end
 	local data = storage:get(username) or {};
 	if node == "urn:xmpp:avatar:data" then
 		local new_photo = item:get_child_text("data", "urn:xmpp:avatar:data");