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])); |