Comparison

plugins/mod_vcard.lua @ 2000:c31aa53348b8

mod_vcard: Fixed traceback on attempt to set vcards by non-c2s sessions.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 18 Oct 2009 06:55:00 +0500
parent 1957:5856b2dcf81e
child 2001:2f73fe2b3edd
comparison
equal deleted inserted replaced
1999:05054e360d89 2000:c31aa53348b8
38 session.send(st.reply(stanza):add_child(vCard)); -- send vCard! 38 session.send(st.reply(stanza):add_child(vCard)); -- send vCard!
39 else 39 else
40 session.send(st.error_reply(stanza, "cancel", "item-not-found")); 40 session.send(st.error_reply(stanza, "cancel", "item-not-found"));
41 end 41 end
42 elseif stanza.attr.type == "set" then 42 elseif stanza.attr.type == "set" then
43 if not to or to == session.username.."@"..session.host then 43 if not to then
44 if datamanager.store(session.username, session.host, "vcard", st.preserialize(stanza.tags[1])) then 44 if datamanager.store(session.username, session.host, "vcard", st.preserialize(stanza.tags[1])) then
45 session.send(st.reply(stanza)); 45 session.send(st.reply(stanza));
46 else 46 else
47 -- TODO unable to write file, file may be locked, etc, what's the correct error? 47 -- TODO unable to write file, file may be locked, etc, what's the correct error?
48 session.send(st.error_reply(stanza, "wait", "internal-server-error")); 48 session.send(st.error_reply(stanza, "wait", "internal-server-error"));