Changeset

7871:09aa0453bdcc

mod_pep: Add some additional debug logging
author Kim Alvefur <zash@zash.se>
date Sat, 28 Jan 2017 15:31:57 +0100
parents 7869:eb5fba4c8074
children 7872:3105d35cc2c2
files plugins/mod_pep.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pep.lua	Fri Jan 27 12:21:09 2017 +0100
+++ b/plugins/mod_pep.lua	Sat Jan 28 15:31:57 2017 +0100
@@ -185,7 +185,11 @@
 					node = node, user = jid_bare(session.full_jid), actor = session.jid, id = id, session = session, item = st.clone(payload);
 				});
 				return true;
+			else
+				module:log("debug", "Payload is missing the <item>", node);
 			end
+		else
+			module:log("debug", "Unhandled payload: %s", payload and payload:top_tag() or "(no payload)");
 		end
 	elseif stanza.attr.type == 'get' then
 		local user = stanza.attr.to and jid_bare(stanza.attr.to) or session.username..'@'..session.host;
@@ -221,14 +225,17 @@
 				end
 			elseif node then -- node doesn't exist
 				session.send(st.error_reply(stanza, 'cancel', 'item-not-found'));
+				module:log("debug", "Item '%s' not found", node)
 				return true;
 			else --invalid request
 				session.send(st.error_reply(stanza, 'modify', 'bad-request'));
+				module:log("debug", "Invalid request: %s", tostring(payload));
 				return true;
 			end
 		else --no presence subscription
 			session.send(st.error_reply(stanza, 'auth', 'not-authorized')
 				:tag('presence-subscription-required', {xmlns='http://jabber.org/protocol/pubsub#errors'}));
+			module:log("debug", "Unauthorized request: %s", tostring(payload));
 			return true;
 		end
 	end