# HG changeset patch # User Matthew Wild # Date 1290270814 0 # Node ID ab0f0326b2b4f22d52e1234e10d7650cfe8cb04f # Parent a4dc96890729242c3f15c205838c5f7b7a853ac8# Parent 9c9af7a196ed6b40ceb52d16bfe8665175b23332 Merge with Zash diff -r a4dc96890729 -r ab0f0326b2b4 plugins/private.lua --- a/plugins/private.lua Tue Nov 16 11:49:42 2010 +0000 +++ b/plugins/private.lua Sat Nov 20 16:33:34 2010 +0000 @@ -1,12 +1,20 @@ +-- Implements XEP-0049: Private XML Storage + local xmlns_private = "jabber:iq:private"; function verse.plugins.private(stream) function stream:private_set(name, xmlns, data, callback) local iq = verse.iq({ type = "set" }) - :tag("query", { xmlns = xmlns_private }) - :tag(name, { xmlns = xmlns }); - if data then iq:add_child(data); end - self:send_iq(iq, function () callback(); end); + :tag("query", { xmlns = xmlns_private }); + if data then + if data.name == name and data.attr and data.attr.xmlns == xmlns then + iq:add_child(data); + else + iq:tag(name, { xmlns = xmlns }) + :add_child(data); + end + end + self:send_iq(iq, callback); end function stream:private_get(name, xmlns, callback) diff -r a4dc96890729 -r ab0f0326b2b4 squishy --- a/squishy Tue Nov 16 11:49:42 2010 +0000 +++ b/squishy Sat Nov 20 16:33:34 2010 +0000 @@ -41,6 +41,7 @@ Module "verse.plugins.disco" "plugins/disco.lua" Module "verse.plugins.pep" "plugins/pep.lua" Module "verse.plugins.adhoc" "plugins/adhoc.lua" +Module "verse.plugins.private" "plugins/private.lua" if GetOption "bosh" ~= false then Module "net.httpclient_listener" "net/httpclient_listener.lua"