Changeset

147:0bc82a318c45

clix.archive: Add 'raw' output format, useful for exports
author Kim Alvefur <zash@zash.se>
date Mon, 08 Feb 2021 22:57:42 +0100
parents 146:ae85457eca8e
children 148:27a9f28724d3
files clix/archive.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/clix/archive.lua	Mon Feb 08 22:56:45 2021 +0100
+++ b/clix/archive.lua	Mon Feb 08 22:57:42 2021 +0100
@@ -31,6 +31,15 @@
 		print(m:get_child_text"body");
 		print"";
 	end
+	if opts.format == "raw" then
+		local st = require"util.stanza";
+		local datetime = require"util.datetime".datetime;
+		function print_message(i)
+		print(st.stanza("forwarded",{xmlns="urn:xmpp:forward:0"})
+			:tag("delay", {xmlns="urn:xmpp:delay", stamp=datetime(i.stamp)}):up()
+			:add_child(i.message));
+		end
+	end
 
 	local function on_connect(conn)
 		if opts.debug then