aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_offline.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-16 16:52:31 +0100
committerKim Alvefur <zash@zash.se>2019-11-16 16:52:31 +0100
commit908f5b61c55e4cba39e61ac415b0fca384a1095d (patch)
tree6e391ff6608608f181e42c92ee6dfd7c534da255 /plugins/mod_offline.lua
parentc4c38d2f01d5f2711b527c7c2412250ed6c58738 (diff)
parentfd9ccf20d5b652dbad1f37cecd540661f4642ee6 (diff)
downloadprosody-908f5b61c55e4cba39e61ac415b0fca384a1095d.tar.gz
prosody-908f5b61c55e4cba39e61ac415b0fca384a1095d.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins/mod_offline.lua')
-rw-r--r--plugins/mod_offline.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_offline.lua b/plugins/mod_offline.lua
index 487098d1..dffe8357 100644
--- a/plugins/mod_offline.lua
+++ b/plugins/mod_offline.lua
@@ -24,11 +24,16 @@ module:hook("message/offline/handle", function(event)
node = origin.username;
end
- return offline_messages:append(node, nil, stanza, os.time(), "");
+ local ok = offline_messages:append(node, nil, stanza, os.time(), "");
+ if ok then
+ module:log("debug", "Saved to offline storage: %s", stanza:top_tag());
+ end
+ return ok;
end, -1);
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 +43,9 @@ module:hook("message/offline/broadcast", function(event)
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);