Changeset

97:83cd777fb294

clix.publish_atom: Add a way to attach Activitystrea.ms metadata to the entry
author Kim Alvefur <zash@zash.se>
date Fri, 17 Aug 2012 18:15:20 +0200
parents 96:a2214d821394
children 98:5ad042476235
files clix/publish_atom.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/clix/publish_atom.lua	Fri Aug 17 18:14:32 2012 +0200
+++ b/clix/publish_atom.lua	Fri Aug 17 18:15:20 2012 +0200
@@ -2,6 +2,8 @@
 local datetime = require "util.datetime".datetime;
 
 local xmlns_atom = "http://www.w3.org/2005/Atom";
+local xmlns_activitystreams = "http://activitystrea.ms/spec/1.0/";
+local activitystreams_schema_base = "http://activitystrea.ms/schema/1.0/";
 
 return function (opts, arg)
 	if opts.short_help then
@@ -40,6 +42,13 @@
 			atom_entry:tag("content"):text(opts.content):up();
 		end
 
+		for opt, optval in pairs(opts) do
+			if opt:match"^as_" then
+				atom_entry:tag(opt:sub(4):gsub("_", "-"), { xmlns = xmlns_activitystreams } )
+					:text(activitystreams_schema_base..optval):up();
+			end
+		end
+
 		conn.pubsub(opts.service, opts.node):publish(entry_id, nil, atom_entry
 		, function(ok)
 			-- TODO Report success?