Mercurial > prosody-modules
comparison mod_pubsub_feed/mod_pubsub_feed.lua @ 299:801066bf5793
mod_pubsub_feed: Fix detection of updated posts
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 26 Dec 2010 18:59:13 +0100 |
parents | aa0df3db4901 |
children | b81e4f86a231 |
comparison
equal
deleted
inserted
replaced
298:451e734045d4 | 299:801066bf5793 |
---|---|
63 e_published = e_published and dt_parse(e_published); | 63 e_published = e_published and dt_parse(e_published); |
64 local e_updated = entry:get_child("updated"); | 64 local e_updated = entry:get_child("updated"); |
65 e_updated = e_updated and e_updated[1]; | 65 e_updated = e_updated and e_updated[1]; |
66 e_updated = e_updated and dt_parse(e_updated); | 66 e_updated = e_updated and dt_parse(e_updated); |
67 | 67 |
68 local timestamp = e_published or e_updated or nil; | 68 local timestamp = e_updated or e_published or nil; |
69 module:log("debug", "timestamp is %s, item.last_update is %s", tostring(timestamp), tostring(item.last_update)); | 69 module:log("debug", "timestamp is %s, item.last_update is %s", tostring(timestamp), tostring(item.last_update)); |
70 if not timestamp or not item.last_update or timestamp > item.last_update then | 70 if not timestamp or not item.last_update or timestamp > item.last_update then |
71 local id = entry:get_child("id"); | 71 local id = entry:get_child("id"); |
72 id = id[1] or item.url.."#"..dt_datetime(timestamp); -- Missing id, so make one up | 72 id = id[1] or item.url.."#"..dt_datetime(timestamp); -- Missing id, so make one up |
73 local item = st.stanza("item", { id = id }):add_child(entry); | 73 local item = st.stanza("item", { id = id }):add_child(entry); |