Changeset

1753:54c8a0cb2996

mod_storage_(archive-capable): Change order of arguments to :append to be the same as return values from :find iterator (see prosody 41725f3df3cc)
author Kim Alvefur <zash@zash.se>
date Tue, 19 May 2015 18:34:08 +0200
parents 1752:3f3689a16133
children 1754:c04d10557bbc
files mod_storage_gdbm/mod_storage_gdbm.lua mod_storage_memory/mod_storage_memory.lua mod_storage_muc_log/mod_storage_muc_log.lua mod_storage_xmlarchive/mod_storage_xmlarchive.lua
diffstat 4 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_gdbm/mod_storage_gdbm.lua	Tue May 19 16:46:20 2015 +0200
+++ b/mod_storage_gdbm/mod_storage_gdbm.lua	Tue May 19 18:34:08 2015 +0200
@@ -73,7 +73,11 @@
 archive.get = keyval.get;
 archive.set = keyval.set;
 
-function archive:append(username, key, when, with, value)
+function archive:append(username, key, value, when, with)
+	if type(when) ~= "number" then
+		value, when, with = when, with, value;
+	end
+
 	key = key or uuid();
 	local meta = self:get(username);
 	if not meta then
--- a/mod_storage_memory/mod_storage_memory.lua	Tue May 19 16:46:20 2015 +0200
+++ b/mod_storage_memory/mod_storage_memory.lua	Tue May 19 18:34:08 2015 +0200
@@ -42,7 +42,10 @@
 local archive_store = {};
 archive_store.__index = archive_store;
 
-function archive_store:append(username, key, when, with, value)
+function archive_store:append(username, key, value, when, with)
+	if type(when) ~= "number" then
+		value, when, with = when, with, value;
+	end
 	local a = self.store[username];
 	if not a then
 		a = {};
@@ -116,7 +119,7 @@
 		i = old[i];
 		t = i.when;
 		if not(qstart >= t and qend <= t and (not qwith or i.with == qwith)) then
-			self:append(username, i.key, t, i.with, i.value);
+			self:append(username, i.key, i.value, t, i.with);
 		end
 	end
 	if #new == 0 then
--- a/mod_storage_muc_log/mod_storage_muc_log.lua	Tue May 19 16:46:20 2015 +0200
+++ b/mod_storage_muc_log/mod_storage_muc_log.lua	Tue May 19 18:34:08 2015 +0200
@@ -48,7 +48,10 @@
 	return with and tag.name .. "<" .. with or tag.name;
 end
 
-function driver:append(node, key, when, with, stanza)
+function driver:append(node, key, stanza, when, with)
+	if type(when) ~= "number" then
+		value, when, with = when, with, value;
+	end
 	local today = os_date(datef, when);
 	local now = os_date(timef, when);
 	local data = data_load(node, host, datastore .. "/" .. today) or {};
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue May 19 16:46:20 2015 +0200
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue May 19 18:34:08 2015 +0200
@@ -23,7 +23,10 @@
 local archive = {};
 local archive_mt = { __index = archive };
 
-function archive:append(username, _, when, with, data)
+function archive:append(username, _, data, when, with)
+	if type(when) ~= "number" then
+		value, when, with = when, with, value;
+	end
 	if getmetatable(data) ~= st.stanza_mt then
 		module:log("error", "Attempt to store non-stanza object, traceback: %s", debug.traceback());
 		return nil, "unsupported-datatype";