Diff

plugins/mod_pep.lua @ 1619:ae3250783db2

mod_pep: Added support for pubsub item retraction
author Waqas Hussain <waqas20@gmail.com>
date Wed, 29 Jul 2009 17:57:24 +0500
parent 1522:569d58d21612
child 1625:b6645fe7d89f
line wrap: on
line diff
--- a/plugins/mod_pep.lua	Tue Jul 28 19:15:29 2009 +0100
+++ b/plugins/mod_pep.lua	Wed Jul 29 17:57:24 2009 +0500
@@ -30,6 +30,7 @@
 
 local function publish(session, node, item)
 	local disable = #item.tags ~= 1 or #item.tags[1].tags == 0;
+	if #item.tags == 0 then item.name = "retract"; end
 	local bare = session.username..'@'..session.host;
 	local stanza = st.message({from=bare, type='headline'})
 		:tag('event', {xmlns='http://jabber.org/protocol/pubsub#event'})
@@ -128,7 +129,7 @@
 		local payload = stanza.tags[1];
 		if payload.name == 'pubsub' then -- <pubsub xmlns='http://jabber.org/protocol/pubsub'>
 			payload = payload.tags[1];
-			if payload and payload.name == 'publish' and payload.attr.node then -- <publish node='http://jabber.org/protocol/tune'>
+			if payload and (payload.name == 'publish' or payload.name == 'retract') and payload.attr.node then -- <publish node='http://jabber.org/protocol/tune'>
 				local node = payload.attr.node;
 				payload = payload.tags[1];
 				if payload then -- <item>