Comparison

plugins/mod_offline.lua @ 3973:f5416372350d

Don't check priority in mod_offline
author Robert Hoelz <rob@hoelz.ro>
date Thu, 09 Dec 2010 23:25:16 -0600
parent 3972:a05cf5d9c7ab
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
3972:a05cf5d9c7ab 3973:f5416372350d
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 local node, host = origin.username, origin.host;
39 local node, host = origin.username, origin.host;
40 39
41 local data = datamanager.list_load(node, host, "offline"); 40 local data = datamanager.list_load(node, host, "offline");
42 if not data then return true; end 41 if not data then return true; end
43 for _, stanza in ipairs(data) do 42 for _, stanza in ipairs(data) do
44 stanza = st.deserialize(stanza); 43 stanza = st.deserialize(stanza);
45 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 44 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) 45 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; 46 stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil;
48 origin.send(stanza); 47 origin.send(stanza);
49 end
50 datamanager.list_store(node, host, "offline", nil);
51 return true;
52 end 48 end
49 datamanager.list_store(node, host, "offline", nil);
50 return true;
53 end); 51 end);