33 end); |
33 end); |
34 |
34 |
35 module:hook("message/offline/broadcast", function(event) |
35 module:hook("message/offline/broadcast", function(event) |
36 local origin = event.origin; |
36 local origin = event.origin; |
37 |
37 |
38 if origin.priority >= 0 then |
38 if origin.priority >= 0 then |
39 local node, host = origin.username, origin.host; |
39 local node, host = origin.username, origin.host; |
40 |
40 |
41 local data = datamanager.list_load(node, host, "offline"); |
41 local data = datamanager.list_load(node, host, "offline"); |
42 if not data then return true; end |
42 if not data then return true; end |
43 for _, stanza in ipairs(data) do |
43 for _, stanza in ipairs(data) do |
44 stanza = st.deserialize(stanza); |
44 stanza = st.deserialize(stanza); |
45 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 |
45 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 |
46 stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) |
46 stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) |
47 stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; |
47 stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; |
48 origin.send(stanza); |
48 origin.send(stanza); |
49 end |
49 end |
50 return true; |
50 return true; |
51 end |
51 end |
52 end); |
52 end); |
53 |
53 |
54 module:hook("message/offline/delete", function(event) |
54 module:hook("message/offline/delete", function(event) |
55 local origin = event.origin; |
55 local origin = event.origin; |
56 local node, host = origin.username, origin.host; |
56 local node, host = origin.username, origin.host; |