clix.publish_atom: Add a way to attach Activitystrea.ms metadata to the entry

Fri, 17 Aug 2012 18:15:20 +0200

author
Kim Alvefur <zash@zash.se>
date
Fri, 17 Aug 2012 18:15:20 +0200
changeset 97
83cd777fb294
parent 96
a2214d821394
child 98
5ad042476235

clix.publish_atom: Add a way to attach Activitystrea.ms metadata to the entry

clix/publish_atom.lua file | annotate | diff | comparison | revisions
--- 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?

mercurial