From f2b74c28b0e0a6399c0487d93a39e42c849f17fa Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 22 Nov 2016 18:19:55 +0100
Subject: mod_mam: If archive:delete() gives a number, this should be the
 number of deleted items

---
 plugins/mod_mam/mod_mam.lua | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'plugins')

diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 2bdf85dc..9d7aabde 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -326,11 +326,8 @@ if cleanup_after ~= "never" then
 			local ok, err = archive:delete(user, { ["end"] = os.time() - cleanup_after; })
 			if not ok then
 				module:log("warn", "Could not expire archives for user %s: %s", user, err);
-			else
-				-- :affected() is a recent addition for eg SQLite3 in LuaDBI
-				pcall(function(stmt)
-					module:log("debug", "Removed %d messages", stmt:affected());
-				end, err);
+			elseif type(ok) == "number" then
+				module:log("debug", "Removed %d messages", ok);
 			end
 			cleanup[user] = nil;
 		end
-- 
cgit v1.2.3