Software /
code /
prosody
Comparison
plugins/mod_offline.lua @ 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 |
parent | 8030:bd3527198308 |
child | 10296:7072569044d4 |
comparison
equal
deleted
inserted
replaced
10241:48f7cda4174d | 10242:7e5d2a6c9390 |
---|---|
27 return offline_messages:append(node, nil, stanza, os.time(), ""); | 27 return offline_messages:append(node, nil, stanza, os.time(), ""); |
28 end, -1); | 28 end, -1); |
29 | 29 |
30 module:hook("message/offline/broadcast", function(event) | 30 module:hook("message/offline/broadcast", function(event) |
31 local origin = event.origin; | 31 local origin = event.origin; |
32 origin.log("debug", "Broadcasting offline messages"); | |
32 | 33 |
33 local node, host = origin.username, origin.host; | 34 local node, host = origin.username, origin.host; |
34 | 35 |
35 local data = offline_messages:find(node); | 36 local data = offline_messages:find(node); |
36 if not data then return true; end | 37 if not data then return true; end |
37 for _, stanza, when in data do | 38 for _, stanza, when in data do |
38 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = datetime.datetime(when)}):up(); -- XEP-0203 | 39 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = datetime.datetime(when)}):up(); -- XEP-0203 |
39 origin.send(stanza); | 40 origin.send(stanza); |
40 end | 41 end |
41 offline_messages:delete(node); | 42 local ok = offline_messages:delete(node); |
43 if type(ok) == "number" and ok > 0 then | |
44 origin.log("debug", "%d offline messages consumed"); | |
45 end | |
42 return true; | 46 return true; |
43 end, -1); | 47 end, -1); |