mod_storage_memory: Implement 'add_keys' method of map stores (required for rosters in 0.10+)

Sat, 07 May 2016 13:37:03 +0200

author
Kim Alvefur <zash@zash.se>
date
Sat, 07 May 2016 13:37:03 +0200
changeset 2171
85d88ed4f2a2
parent 2170
4652a112a4ba
child 2172
a347b71adb07

mod_storage_memory: Implement 'add_keys' method of map stores (required for rosters in 0.10+)

mod_storage_memory/mod_storage_memory.lua file | annotate | diff | comparison | revisions
--- a/mod_storage_memory/mod_storage_memory.lua	Thu May 05 15:43:01 2016 +0200
+++ b/mod_storage_memory/mod_storage_memory.lua	Sat May 07 13:37:03 2016 +0200
@@ -41,6 +41,20 @@
 	return true;
 end
 
+map_store.remove = {};
+function map_store:set_keys(username, keydatas)
+	local userstore = self.store[username or NULL];
+	if userstore == nil then
+		userstore = {};
+		self.store[username or NULL] = userstore;
+	end
+	for k,v in pairs(keydatas) do
+		if v == self.remove then v = nil; end
+		current[k] = v;
+	end
+	return true;
+end
+
 local archive_store = {};
 archive_store.__index = archive_store;
 

mercurial