mod_storage_sql: Sensible defaults for 'when' and 'with' arguments
authorKim Alvefur <zash@zash.se>
Sat, 01 Apr 2017 19:04:54 +0200
changeset 8034 ef838b7f8f53
parent 8033 bd3527198308
child 8035 aa9f198cb3c9
mod_storage_sql: Sensible defaults for 'when' and 'with' arguments
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Sat Apr 01 19:04:15 2017 +0200
+++ b/plugins/mod_storage_sql.lua	Sat Apr 01 19:04:54 2017 +0200
@@ -184,6 +184,8 @@
 archive_store.__index = archive_store
 function archive_store:append(username, key, value, when, with)
 	local user,store = username,self.store;
+	when = when or os.time();
+	with = with or "";
 	local ok, key = engine:transaction(function()
 		if key then
 			engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, user or "", store, key);