Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 7871:09aa0453bdcc
mod_pep: Add some additional debug logging
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 28 Jan 2017 15:31:57 +0100 |
parent | 7454:d10b4bfb20c5 |
child | 8124:20e92f6688b2 |
comparison
equal
deleted
inserted
replaced
7869:eb5fba4c8074 | 7871:09aa0453bdcc |
---|---|
183 session.send(st.reply(stanza)); | 183 session.send(st.reply(stanza)); |
184 module:fire_event("pep-publish-item", { | 184 module:fire_event("pep-publish-item", { |
185 node = node, user = jid_bare(session.full_jid), actor = session.jid, id = id, session = session, item = st.clone(payload); | 185 node = node, user = jid_bare(session.full_jid), actor = session.jid, id = id, session = session, item = st.clone(payload); |
186 }); | 186 }); |
187 return true; | 187 return true; |
188 end | 188 else |
189 module:log("debug", "Payload is missing the <item>", node); | |
190 end | |
191 else | |
192 module:log("debug", "Unhandled payload: %s", payload and payload:top_tag() or "(no payload)"); | |
189 end | 193 end |
190 elseif stanza.attr.type == 'get' then | 194 elseif stanza.attr.type == 'get' then |
191 local user = stanza.attr.to and jid_bare(stanza.attr.to) or session.username..'@'..session.host; | 195 local user = stanza.attr.to and jid_bare(stanza.attr.to) or session.username..'@'..session.host; |
192 if subscription_presence(user, stanza.attr.from) then | 196 if subscription_presence(user, stanza.attr.from) then |
193 local user_data = data[user]; | 197 local user_data = data[user]; |
219 session.send(stanza); | 223 session.send(stanza); |
220 return true; | 224 return true; |
221 end | 225 end |
222 elseif node then -- node doesn't exist | 226 elseif node then -- node doesn't exist |
223 session.send(st.error_reply(stanza, 'cancel', 'item-not-found')); | 227 session.send(st.error_reply(stanza, 'cancel', 'item-not-found')); |
228 module:log("debug", "Item '%s' not found", node) | |
224 return true; | 229 return true; |
225 else --invalid request | 230 else --invalid request |
226 session.send(st.error_reply(stanza, 'modify', 'bad-request')); | 231 session.send(st.error_reply(stanza, 'modify', 'bad-request')); |
232 module:log("debug", "Invalid request: %s", tostring(payload)); | |
227 return true; | 233 return true; |
228 end | 234 end |
229 else --no presence subscription | 235 else --no presence subscription |
230 session.send(st.error_reply(stanza, 'auth', 'not-authorized') | 236 session.send(st.error_reply(stanza, 'auth', 'not-authorized') |
231 :tag('presence-subscription-required', {xmlns='http://jabber.org/protocol/pubsub#errors'})); | 237 :tag('presence-subscription-required', {xmlns='http://jabber.org/protocol/pubsub#errors'})); |
238 module:log("debug", "Unauthorized request: %s", tostring(payload)); | |
232 return true; | 239 return true; |
233 end | 240 end |
234 end | 241 end |
235 end); | 242 end); |
236 | 243 |