Software /
code /
prosody-modules
Comparison
mod_pubsub_github/mod_pubsub_github.lua @ 1343:7dbde05b48a9
all the things: Remove trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 11 Mar 2014 18:44:01 +0100 |
parent | 860:1c886affb375 |
child | 1620:754d97ba333d |
comparison
equal
deleted
inserted
replaced
1342:0ae065453dc9 | 1343:7dbde05b48a9 |
---|---|
10 function handle_POST(event) | 10 function handle_POST(event) |
11 local data = json.decode(formdecode(event.request.body).payload); | 11 local data = json.decode(formdecode(event.request.body).payload); |
12 if not data then | 12 if not data then |
13 return "Invalid JSON. From you of all people..."; | 13 return "Invalid JSON. From you of all people..."; |
14 end | 14 end |
15 | 15 |
16 for _, commit in ipairs(data.commits) do | 16 for _, commit in ipairs(data.commits) do |
17 local ok, err = pubsub_service:publish(node, true, data.repository.name, | 17 local ok, err = pubsub_service:publish(node, true, data.repository.name, |
18 st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) | 18 st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) |
19 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) | 19 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) |
20 :tag("id"):text(commit.id):up() | 20 :tag("id"):text(commit.id):up() |
25 :tag("name"):text(commit.author.name):up() | 25 :tag("name"):text(commit.author.name):up() |
26 :tag("email"):text(commit.author.email):up() | 26 :tag("email"):text(commit.author.email):up() |
27 :up() | 27 :up() |
28 ); | 28 ); |
29 end | 29 end |
30 | 30 |
31 module:log("debug", "Handled POST: \n%s\n", tostring(event.request.body)); | 31 module:log("debug", "Handled POST: \n%s\n", tostring(event.request.body)); |
32 return "Thank you Github!"; | 32 return "Thank you Github!"; |
33 end | 33 end |
34 | 34 |
35 module:provides("http", { | 35 module:provides("http", { |