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