comparison mod_conformance_restricted/mod_conformance_restricted.lua @ 603:efc9d88b70ab

merged.
author Marco Cirillo <maranda@lightwitch.org>
date Thu, 09 Feb 2012 00:54:39 +0000
parents 072b05999b4b
children 7c88e09a07e7
comparison
equal deleted inserted replaced
601:00590d492a5b 603:efc9d88b70ab
1 -- Prosody IM
2 -- Copyright (C) 2012 Florian Zeitz
3 --
4 -- This project is MIT/X11 licensed. Please see the
5 -- COPYING file in the source package for more information.
6 --
7
8 local st = require "util.stanza";
9
10 module:hook("message/host", function (event)
11 local origin, stanza = event.origin, event.stanza;
12 local node, host, resource = jid.split(stanza.attr.to);
13 local body = stanza:get_child_text("body");
14
15 if resource ~= "conformance" then
16 return; -- Not interop testing
17 end
18
19 if body == "PI" then
20 origin.send("<?testing this='out'?>");
21 elseif body == "comment" then
22 origin.send("<!-- no comment -->");
23 elseif body == "DTD" then
24 origin.send("<!DOCTYPE greeting [\n<!ENTITY test 'You should not see this'>\n]>");
25 elseif body == "entity" then
26 origin.send("<message type='chat' to='"..stanza.attr.from.."'><body>&test;</body></message>");
27 else
28 local reply = st.reply(stanza);
29 reply:body("Send me one of: PI, comment, DTD, or entity");
30 origin.send(reply);
31 end
32
33 return true;
34 end);