Changeset

10242:7e5d2a6c9390

mod_offline: Add some debug logging to reduce confusion Where did these messages come from???
author Kim Alvefur <zash@zash.se>
date Sun, 08 Sep 2019 16:48:53 +0200
parents 10241:48f7cda4174d
children 10243:b36765ab0ae3
files plugins/mod_offline.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_offline.lua	Mon Jul 22 01:58:57 2019 +0200
+++ b/plugins/mod_offline.lua	Sun Sep 08 16:48:53 2019 +0200
@@ -29,6 +29,7 @@
 
 module:hook("message/offline/broadcast", function(event)
 	local origin = event.origin;
+	origin.log("debug", "Broadcasting offline messages");
 
 	local node, host = origin.username, origin.host;
 
@@ -38,6 +39,9 @@
 		stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = datetime.datetime(when)}):up(); -- XEP-0203
 		origin.send(stanza);
 	end
-	offline_messages:delete(node);
+	local ok = offline_messages:delete(node);
+	if type(ok) == "number" and ok > 0 then
+		origin.log("debug", "%d offline messages consumed");
+	end
 	return true;
 end, -1);