util.sasl_cyrus: Protect the call to cyrussasl.server_new properly.
[prosody.git] / plugins / mod_pep.lua
index ef03ab0f68abdf8c729eeaf1f2ec8186f68809d4..c42876b85d360c767f11440491d2e0087933392f 100644 (file)
@@ -277,3 +277,21 @@ module:hook("iq/bare/disco", function(event)
                end
        end
 end);
+
+module:hook("account-disco-info", function(event)
+       local stanza = event.stanza;
+       stanza:tag('identity', {category='pubsub', type='pep'}):up();
+       stanza:tag('feature', {var='http://jabber.org/protocol/pubsub#publish'}):up();
+end);
+
+module:hook("account-disco-items", function(event)
+       local session, stanza = event.session, event.stanza;
+       local bare = session.username..'@'..session.host;
+       local user_data = data[bare];
+
+       if user_data then
+               for node, _ in pairs(user_data) do
+                       stanza:tag('item', {jid=bare, node=node}):up(); -- TODO we need to handle queries to these nodes
+               end
+       end
+end);