Mercurial > prosody-modules
comparison mod_atom/mod_atom.lua @ 3272:119e22ccd64a
mod_atom: Add some basic metadata to feed
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 24 Aug 2018 22:58:48 +0200 |
| parents | 4b52cafd5811 |
| children | 78888f4ec7e3 |
comparison
equal
deleted
inserted
replaced
| 3271:7504f765e767 | 3272:119e22ccd64a |
|---|---|
| 17 | 17 |
| 18 local pubsub_service = mod_pep.get_pep_service(user); | 18 local pubsub_service = mod_pep.get_pep_service(user); |
| 19 local ok, items = pubsub_service:get_items("urn:xmpp:microblog:0", actor); | 19 local ok, items = pubsub_service:get_items("urn:xmpp:microblog:0", actor); |
| 20 if ok then | 20 if ok then |
| 21 event.response.headers.content_type = "application/atom+xml"; | 21 event.response.headers.content_type = "application/atom+xml"; |
| 22 local feed = st.stanza("feed", { xmlns = "http://www.w3.org/2005/Atom" }); | 22 local feed = st.stanza("feed", { xmlns = "http://www.w3.org/2005/Atom" }) |
| 23 :text_tag("generator", "Prosody", { uri = "xmpp:prosody.im", version = prosody.version }) | |
| 24 :tag("author") | |
| 25 :text_tag("name", user) | |
| 26 | |
| 27 feed:reset(); | |
| 28 | |
| 23 for i = #items, 1, -1 do | 29 for i = #items, 1, -1 do |
| 24 feed:add_direct_child(items[items[i]].tags[1]); | 30 feed:add_direct_child(items[items[i]].tags[1]); |
| 25 end | 31 end |
| 26 return tostring(feed); | 32 return tostring(feed); |
| 27 elseif items == "forbidden" then | 33 elseif items == "forbidden" then |
