Changeset

978:c8f4502c764f

mod_pubsub_twitter: Wrap published item in an <item> element for pubsub
author Matthew Wild <mwild1@gmail.com>
date Mon, 08 Apr 2013 14:45:00 +0100
parents 977:f178318c9aeb
children 979:cec42f884475
files mod_pubsub_twitter/mod_pubsub_twitter.lua
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_twitter/mod_pubsub_twitter.lua	Mon Apr 08 01:01:11 2013 +0200
+++ b/mod_pubsub_twitter/mod_pubsub_twitter.lua	Mon Apr 08 14:45:00 2013 +0100
@@ -45,15 +45,16 @@
 	
 	local timestamp = ("%s-%s-%sT%sZ"):format(timestamp_year, month_number[timestamp_month], timestamp_date, timestamp_time);
 	
-	local item = st.stanza("entry", { xmlns = xmlns_atom })
-		:tag("id"):text(id):up()
-		:tag("author")
-			:tag("name"):text(result.from_user_name.." (@"..result.from_user..")"):up()
-			:tag("uri"):text("http://twitter.com/"..result.from_user):up()
-			:up()
-		:tag("published"):text(timestamp):up()
-		:tag("title"):text(result.text):up()
-		:tag("link", { rel = "alternate" , href = "https://twitter.com/"..result.from_user.."/status/"..id}):up();
+	local item = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = id })
+		:tag("entry", { xmlns = xmlns_atom })
+			:tag("id"):text(id):up()
+			:tag("author")
+				:tag("name"):text(result.from_user_name.." (@"..result.from_user..")"):up()
+				:tag("uri"):text("http://twitter.com/"..result.from_user):up()
+				:up()
+			:tag("published"):text(timestamp):up()
+			:tag("title"):text(result.text):up()
+			:tag("link", { rel = "alternate" , href = "https://twitter.com/"..result.from_user.."/status/"..id}):up();
 	
 	module:log("debug", "Publishing Twitter result: %s", tostring(item));