Changeset

8031:ef838b7f8f53

mod_storage_sql: Sensible defaults for 'when' and 'with' arguments
author Kim Alvefur <zash@zash.se>
date Sat, 01 Apr 2017 19:04:54 +0200
parents 8030:bd3527198308
children 8032:aa9f198cb3c9
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);