pubsub2room: Access to attributes in templates

Thu, 07 Apr 2011 02:20:28 +0200

author
Kim Alvefur <zash@zash.se>
date
Thu, 07 Apr 2011 02:20:28 +0200
changeset 80
5cb658e37a37
parent 75
1b934a878e84
child 81
f86c79cabc75

pubsub2room: Access to attributes in templates

plugins/pubsub2room.lua file | annotate | diff | comparison | revisions
--- a/plugins/pubsub2room.lua	Fri Mar 25 19:20:14 2011 +0100
+++ b/plugins/pubsub2room.lua	Thu Apr 07 02:20:28 2011 +0200
@@ -23,6 +23,11 @@
 			n = t.stanza;
 		end
 		for x in k:gmatch("[^.]+") do
+			local m, a = x:match("^([^@]*)@(.*)$");
+			if m and a then
+				m = n:get_child(m);
+				return m and m.attr[a] or nil;
+			end
 			n = n:get_child(x);
 			if not n then return end
 		end

mercurial