Mercurial > prosody-modules
annotate mod_conformance_restricted/mod_conformance_restricted.lua @ 630:ab2a1564da9b
mod_compat_muc_admin: adding last missing local (getUsingPath).
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Tue, 27 Mar 2012 16:57:00 +0000 |
parents | 072b05999b4b |
children | 7c88e09a07e7 |
rev | line source |
---|---|
602
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
1 -- Prosody IM |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
2 -- Copyright (C) 2012 Florian Zeitz |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
3 -- |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
4 -- This project is MIT/X11 licensed. Please see the |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
5 -- COPYING file in the source package for more information. |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
6 -- |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
7 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
8 local st = require "util.stanza"; |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
9 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
10 module:hook("message/host", function (event) |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
11 local origin, stanza = event.origin, event.stanza; |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
12 local node, host, resource = jid.split(stanza.attr.to); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
13 local body = stanza:get_child_text("body"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
14 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
15 if resource ~= "conformance" then |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
16 return; -- Not interop testing |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
17 end |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
18 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
19 if body == "PI" then |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
20 origin.send("<?testing this='out'?>"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
21 elseif body == "comment" then |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
22 origin.send("<!-- no comment -->"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
23 elseif body == "DTD" then |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
24 origin.send("<!DOCTYPE greeting [\n<!ENTITY test 'You should not see this'>\n]>"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
25 elseif body == "entity" then |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
26 origin.send("<message type='chat' to='"..stanza.attr.from.."'><body>&test;</body></message>"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
27 else |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
28 local reply = st.reply(stanza); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
29 reply:body("Send me one of: PI, comment, DTD, or entity"); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
30 origin.send(reply); |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
31 end |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
32 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
33 return true; |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
34 end); |