Changeset

2384:7bec10f26082

mod_pep: Handle service discovery queries for bare account JIDs (thanks darkrain).
author Waqas Hussain <waqas20@gmail.com>
date Mon, 21 Dec 2009 06:26:37 +0500 (2009-12-21)
parents 2383:29a30884aadd
children 2385:470004f8f4ed
files plugins/mod_pep.lua
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pep.lua	Mon Dec 21 06:25:12 2009 +0500
+++ b/plugins/mod_pep.lua	Mon Dec 21 06:26:37 2009 +0500
@@ -277,3 +277,21 @@
 		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();
+		end
+	end
+end);