Diff

plugins/mod_storage_sql.lua @ 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
parent 8029:e859f279add4
child 8032:aa9f198cb3c9
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);