Mercurial > prosody-modules
annotate mod_conformance_restricted/mod_conformance_restricted.lua @ 4260:c539334dd01a
mod_http_oauth2: Rescope oauth client config into users' storage
This produces client_id of the form owner@host/random and prevents
clients from being deleted by registering an account with the same name
and then deleting the account, as well as having the client
automatically be deleted when the owner account is removed.
On one hand, this leaks the bare JID of the creator to users. On the
other hand, it makes it obvious who made the oauth application.
This module is experimental and only for developers, so this can be
changed if a better method comes up.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Nov 2020 23:55:10 +0100 |
parents | 7dbde05b48a9 |
children |
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 |
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
699
diff
changeset
|
3 -- |
602
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"; |
699
7c88e09a07e7
mod_conformance_restricted: Require util.jid
Florian Zeitz <florob@babelmonkeys.de>
parents:
602
diff
changeset
|
9 local jid = require "util.jid"; |
602
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
10 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
11 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
|
12 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
|
13 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
|
14 local body = stanza:get_child_text("body"); |
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
699
diff
changeset
|
15 |
602
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
16 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
|
17 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
|
18 end |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
19 |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
20 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
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 else |
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
29 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
|
30 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
|
31 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
|
32 end |
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
699
diff
changeset
|
33 |
602
072b05999b4b
mod_conformance_restricted: Module to send XML restricted by RFC 6120 (for conformance testing)
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff
changeset
|
34 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
|
35 end); |