43 local timestamp_date, timestamp_month, timestamp_year, timestamp_time = |
43 local timestamp_date, timestamp_month, timestamp_year, timestamp_time = |
44 result.created_at:match(" (%d+) (%a+) (%d+) (%d%d:%d%d:%d%d)"); |
44 result.created_at:match(" (%d+) (%a+) (%d+) (%d%d:%d%d:%d%d)"); |
45 |
45 |
46 local timestamp = ("%s-%s-%sT%sZ"):format(timestamp_year, month_number[timestamp_month], timestamp_date, timestamp_time); |
46 local timestamp = ("%s-%s-%sT%sZ"):format(timestamp_year, month_number[timestamp_month], timestamp_date, timestamp_time); |
47 |
47 |
48 local item = st.stanza("entry", { xmlns = xmlns_atom }) |
48 local item = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = id }) |
49 :tag("id"):text(id):up() |
49 :tag("entry", { xmlns = xmlns_atom }) |
50 :tag("author") |
50 :tag("id"):text(id):up() |
51 :tag("name"):text(result.from_user_name.." (@"..result.from_user..")"):up() |
51 :tag("author") |
52 :tag("uri"):text("http://twitter.com/"..result.from_user):up() |
52 :tag("name"):text(result.from_user_name.." (@"..result.from_user..")"):up() |
53 :up() |
53 :tag("uri"):text("http://twitter.com/"..result.from_user):up() |
54 :tag("published"):text(timestamp):up() |
54 :up() |
55 :tag("title"):text(result.text):up() |
55 :tag("published"):text(timestamp):up() |
56 :tag("link", { rel = "alternate" , href = "https://twitter.com/"..result.from_user.."/status/"..id}):up(); |
56 :tag("title"):text(result.text):up() |
|
57 :tag("link", { rel = "alternate" , href = "https://twitter.com/"..result.from_user.."/status/"..id}):up(); |
57 |
58 |
58 module:log("debug", "Publishing Twitter result: %s", tostring(item)); |
59 module:log("debug", "Publishing Twitter result: %s", tostring(item)); |
59 |
60 |
60 local ok, err = pubsub.service:publish(node, true, id, item); |
61 local ok, err = pubsub.service:publish(node, true, id, item); |
61 if not ok then |
62 if not ok then |