comparison mod_pubsub_pivotaltracker/mod_pubsub_pivotaltracker.lua @ 1343:7dbde05b48a9

all the things: Remove trailing whitespace
author Florian Zeitz <florob@babelmonkeys.de>
date Tue, 11 Mar 2014 18:44:01 +0100
parents 9922e8cdf4a4
children
comparison
equal deleted inserted replaced
1342:0ae065453dc9 1343:7dbde05b48a9
30 end 30 end
31 end 31 end
32 32
33 function handle_POST(event) 33 function handle_POST(event)
34 local data = lom.parse(event.request.body); 34 local data = lom.parse(event.request.body);
35 35
36 if not data then 36 if not data then
37 return "Invalid XML. From you of all people..."; 37 return "Invalid XML. From you of all people...";
38 end 38 end
39 39
40 data = stanza_from_lom(data); 40 data = stanza_from_lom(data);
41 41
42 if data.name ~= "activity" then 42 if data.name ~= "activity" then
43 return "Unrecognised XML element: "..data.name; 43 return "Unrecognised XML element: "..data.name;
44 end 44 end
45 45
46 local activity_id = data:get_child("id"):get_text(); 46 local activity_id = data:get_child("id"):get_text();
47 local description = data:get_child("description"):get_text(); 47 local description = data:get_child("description"):get_text();
48 local author_name = data:get_child("author"):get_text(); 48 local author_name = data:get_child("author"):get_text();
49 local story = data:get_child("stories"):get_child("story"); 49 local story = data:get_child("stories"):get_child("story");
50 local story_link = story:get_child("url"):get_text(); 50 local story_link = story:get_child("url"):get_text();
51 51
52 local ok, err = pubsub_service:publish(node, true, "activity", st.stanza("item", { id = "activity", xmlns = "http://jabber.org/protocol/pubsub" }) 52 local ok, err = pubsub_service:publish(node, true, "activity", st.stanza("item", { id = "activity", xmlns = "http://jabber.org/protocol/pubsub" })
53 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) 53 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" })
54 :tag("id"):text(activity_id):up() 54 :tag("id"):text(activity_id):up()
55 :tag("title"):text(description):up() 55 :tag("title"):text(description):up()
56 :tag("link", { rel = "alternate", href = story_link }):up() 56 :tag("link", { rel = "alternate", href = story_link }):up()
57 :tag("published"):text(datetime()):up() 57 :tag("published"):text(datetime()):up()
58 :tag("author") 58 :tag("author")
59 :tag("name"):text(author_name):up() 59 :tag("name"):text(author_name):up()
60 :up() 60 :up()
61 ); 61 );
62 62
63 module:log("debug", "Handled POST: \n%s\n", tostring(event.request.body)); 63 module:log("debug", "Handled POST: \n%s\n", tostring(event.request.body));
64 return "Thank you Pivotal!"; 64 return "Thank you Pivotal!";
65 end 65 end
66 66
67 module:provides("http", { 67 module:provides("http", {