Software /
code /
prosody
Comparison
plugins/mod_private.lua @ 3114:75ea1aff69da
mod_private: Detect datamanager read errors, and respond with 'internal-server-error'.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 24 May 2010 01:00:30 +0500 |
parent | 2923:b7049746bd29 |
child | 3522:4646b5b039ca |
comparison
equal
deleted
inserted
replaced
3113:30896751dd43 | 3114:75ea1aff69da |
---|---|
24 if not(node or host) or (node == session.username and host == session.host) then | 24 if not(node or host) or (node == session.username and host == session.host) then |
25 node, host = session.username, session.host; | 25 node, host = session.username, session.host; |
26 if #query.tags == 1 then | 26 if #query.tags == 1 then |
27 local tag = query.tags[1]; | 27 local tag = query.tags[1]; |
28 local key = tag.name..":"..tag.attr.xmlns; | 28 local key = tag.name..":"..tag.attr.xmlns; |
29 local data = datamanager.load(node, host, "private"); | 29 local data, err = datamanager.load(node, host, "private"); |
30 if err then | |
31 session.send(st.error_reply(stanza, "wait", "internal-server-error")); | |
32 return true; | |
33 end | |
30 if stanza.attr.type == "get" then | 34 if stanza.attr.type == "get" then |
31 if data and data[key] then | 35 if data and data[key] then |
32 session.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:private"}):add_child(st.deserialize(data[key]))); | 36 session.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:private"}):add_child(st.deserialize(data[key]))); |
33 else | 37 else |
34 session.send(st.reply(stanza):add_child(stanza.tags[1])); | 38 session.send(st.reply(stanza):add_child(stanza.tags[1])); |