usermanager, mod_auth_internal_hashed, mod_legacyauth: New order of parameters for...
[prosody.git] / plugins / mod_private.lua
index 8bcb6da60a938a7fefe54729ae0db1a686918a3e..abf1ec039a5d076c361d39784a2ce16dc453f757 100644 (file)
@@ -1,20 +1,9 @@
--- Prosody IM v0.1
--- Copyright (C) 2008 Matthew Wild
--- Copyright (C) 2008 Waqas Hussain
+-- Prosody IM
+-- Copyright (C) 2008-2010 Matthew Wild
+-- Copyright (C) 2008-2010 Waqas Hussain
 -- 
--- This program is free software; you can redistribute it and/or
--- modify it under the terms of the GNU General Public License
--- as published by the Free Software Foundation; either version 2
--- of the License, or (at your option) any later version.
--- 
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--- GNU General Public License for more details.
--- 
--- You should have received a copy of the GNU General Public License
--- along with this program; if not, write to the Free Software
--- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
 --
 
 
@@ -37,7 +26,11 @@ module:add_iq_handler("c2s", "jabber:iq:private",
                                if #query.tags == 1 then
                                        local tag = query.tags[1];
                                        local key = tag.name..":"..tag.attr.xmlns;
-                                       local data = datamanager.load(node, host, "private");
+                                       local data, err = datamanager.load(node, host, "private");
+                                       if err then
+                                               session.send(st.error_reply(stanza, "wait", "internal-server-error"));
+                                               return true;
+                                       end
                                        if stanza.attr.type == "get" then
                                                if data and data[key] then
                                                        session.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:private"}):add_child(st.deserialize(data[key])));