Annotate

mod_captcha_registration/util/dataforms.lua @ 6301:fa45ae704b79

mod_cloud_notify: Update Readme diff --git a/mod_cloud_notify/README.md b/mod_cloud_notify/README.md --- a/mod_cloud_notify/README.md +++ b/mod_cloud_notify/README.md @@ -1,109 +1,106 @@ ---- -labels: -- 'Stage-Beta' -summary: 'XEP-0357: Cloud push notifications' ---- +# Introduction -Introduction -============ +This module enables support for sending "push notifications" to clients +that need it, typically those running on certain mobile devices. -This module enables support for sending "push notifications" to clients that -need it, typically those running on certain mobile devices. +As well as this module, your client must support push notifications (the +apps that need it generally do, of course) and the app developer's push +gateway must be reachable from your Prosody server (this happens over a +normal XMPP server-to-server 's2s' connection). -As well as this module, your client must support push notifications (the apps -that need it generally do, of course) and the app developer's push gateway -must be reachable from your Prosody server (this happens over a normal XMPP -server-to-server 's2s' connection). - -Details -======= +# Details Some platforms, notably Apple's iOS and many versions of Android, impose -limits that prevent applications from running or accessing the network in the -background. This makes it difficult or impossible for an XMPP application to -remain reliably connected to a server to receive messages. - -In order for messaging and other apps to receive notifications, the OS vendors -run proprietary servers that their OS maintains a permanent connection to in -the background. Then they provide APIs to application developers that allow -sending notifications to specific devices via those servers. +limits that prevent applications from running or accessing the network +in the background. This makes it difficult or impossible for an XMPP +application to remain reliably connected to a server to receive +messages. -When you connect to your server with an app that requires push notifications, -it will use this module to set up a "push registration". When you receive -a message but your device is not connected to the server, this module will -generate a notification and send it to the push gateway operated by your -application's developers). Their gateway will then connect to your device's -OS vendor and ask them to forward the notification to your device. When your -device receives the notification, it will display it or wake up the app so it -can connect to XMPP and receive any pending messages. +In order for messaging and other apps to receive notifications, the OS +vendors run proprietary servers that their OS maintains a permanent +connection to in the background. Then they provide APIs to application +developers that allow sending notifications to specific devices via +those servers. -This protocol is described for developers in [XEP-0357: Push Notifications]. +When you connect to your server with an app that requires push +notifications, it will use this module to set up a "push registration". +When you receive a message but your device is not connected to the +server, this module will generate a notification and send it to the push +gateway operated by your application's developers). Their gateway will +then connect to your device's OS vendor and ask them to forward the +notification to your device. When your device receives the notification, +it will display it or wake up the app so it can connect to XMPP and +receive any pending messages. -For this module to work reliably, you must have [mod_smacks], [mod_mam] and -[mod_carbons] also enabled on your server. +This protocol is described for developers in \[XEP-0357: Push +Notifications\]. + +For this module to work reliably, you must have \[mod_smacks\], +\[mod_mam\] and \[mod_carbons\] also enabled on your server. -Some clients, notably Siskin and Snikket iOS need some additional extensions -that are not currently defined in a standard XEP. To support these clients, -see [mod_cloud_notify_extensions]. +Some clients, notably Siskin and Snikket iOS need some additional +extensions that are not currently defined in a standard XEP. To support +these clients, see \[mod_cloud_notify_extensions\]. -Configuration -============= +# Configuration - Option Default Description - ------------------------------------ ----------------- ------------------------------------------------------------------------------------------------------------------- - `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty - `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled - `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) - `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) - `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. - `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. + Option Default Description + -------------------------------------- ---------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty + `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled + `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) + `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) + `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. + `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. -(\*) There are privacy implications for enabling these options. +(\*) There are privacy implications for enabling these options.[^1] -Internal design notes -===================== +# Internal design notes -App servers are notified about offline messages, messages stored by [mod_mam] -or messages waiting in the smacks queue. -The business rules outlined [here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) are all honored[^2]. +App servers are notified about offline messages, messages stored by +\[mod_mam\] or messages waiting in the smacks queue. The business rules +outlined +[here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) +are all honored[^2]. -To cooperate with [mod_smacks] this module consumes some events: -`smacks-ack-delayed`, `smacks-hibernation-start` and `smacks-hibernation-end`. -These events allow this module to send out notifications for messages received -while the session is hibernated by [mod_smacks] or even when smacks -acknowledgements for messages are delayed by a certain amount of seconds -configurable with the [mod_smacks] setting `smacks_max_ack_delay`. +To cooperate with \[mod_smacks\] this module consumes some events: +`smacks-ack-delayed`, `smacks-hibernation-start` and +`smacks-hibernation-end`. These events allow this module to send out +notifications for messages received while the session is hibernated by +\[mod_smacks\] or even when smacks acknowledgements for messages are +delayed by a certain amount of seconds configurable with the +\[mod_smacks\] setting `smacks_max_ack_delay`. -The `smacks_max_ack_delay` setting allows to send out notifications to clients -which aren't already in smacks hibernation state (because the read timeout or -connection close didn't already happen) but also aren't responding to acknowledgement -request in a timely manner. This setting thus allows conversations to be smoother -under such circumstances. +The `smacks_max_ack_delay` setting allows to send out notifications to +clients which aren't already in smacks hibernation state (because the +read timeout or connection close didn't already happen) but also aren't +responding to acknowledgement request in a timely manner. This setting +thus allows conversations to be smoother under such circumstances. -The new event `cloud-notify-ping` can be used by any module to send out a cloud -notification to either all registered endpoints for the given user or only the endpoints -given in the event data. +The new event `cloud-notify-ping` can be used by any module to send out +a cloud notification to either all registered endpoints for the given +user or only the endpoints given in the event data. -The config setting `push_notification_important_body` can be used to specify an alternative -body text to send to the remote pubsub node if the stanza is encrypted or has a body. -This way the real contents of the message aren't revealed to the push appserver but it -can still see that the push is important. -This is used by Chatsecure on iOS to send out high priority pushes in those cases for example. +The config setting `push_notification_important_body` can be used to +specify an alternative body text to send to the remote pubsub node if +the stanza is encrypted or has a body. This way the real contents of the +message aren't revealed to the push appserver but it can still see that +the push is important. This is used by Chatsecure on iOS to send out +high priority pushes in those cases for example. -Compatibility -============= - -**Note:** This module should be used with Lua 5.2 and higher. Using it with -Lua 5.1 may cause push notifications to not be sent to some clients. +# Compatibility ------- ----------------------------------------------------------------------------- - trunk Works - 0.12 Works - 0.11 Works - 0.10 Works - 0.9 Support dropped, use last supported version [675726ab06d3](//hg.prosody.im/prosody-modules/raw-file/675726ab06d3/mod_cloud_notify/mod_cloud_notify.lua) ------- ----------------------------------------------------------------------------- +**Note:** This module should be used with Lua 5.2 and higher. Using it +with Lua 5.1 may cause push notifications to not be sent to some +clients. + ------- ----------------------------------------------------------------- + trunk Works as of 25-06-13 + 13 Works + 0.12 Works + ------- ----------------------------------------------------------------- -[^1]: The service which is expected to forward notifications to something like Google Cloud Messaging or Apple Notification Service -[^2]: [business_rules.markdown](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.markdown) +[^1]: The service which is expected to forward notifications to + something like Google Cloud Messaging or Apple Notification Service + +[^2]: [business_rules.md](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.md)
author Menel <menel@snikket.de>
date Fri, 13 Jun 2025 10:36:52 +0200
parent 1373:985bfc6e8cad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1373
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
1 -- Prosody IM
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
2 -- Copyright (C) 2008-2010 Matthew Wild
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
3 -- Copyright (C) 2008-2010 Waqas Hussain
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
4 --
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
5 -- This project is MIT/X11 licensed. Please see the
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
6 -- COPYING file in the source package for more information.
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
7 --
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
8
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
9 local setmetatable = setmetatable;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
10 local pairs, ipairs = pairs, ipairs;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
11 local tostring, type, next = tostring, type, next;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
12 local t_concat = table.concat;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
13 local st = require "util.stanza";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
14 local jid_prep = require "util.jid".prep;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
15
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
16 module "dataforms"
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
17
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
18 local xmlns_forms = 'jabber:x:data';
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
19
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
20 local form_t = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
21 local form_mt = { __index = form_t };
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
22
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
23 function new(layout)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
24 return setmetatable(layout, form_mt);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
25 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
26
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
27 function form_t.form(layout, data, formtype)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
28 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype or "form" });
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
29 if layout.title then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
30 form:tag("title"):text(layout.title):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
31 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
32 if layout.instructions then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
33 form:tag("instructions"):text(layout.instructions):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
34 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
35 for n, field in ipairs(layout) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
36 local field_type = field.type or "text-single";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
37 -- Add field tag
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
38 form:tag("field", { type = field_type, var = field.name, label = field.label });
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
39
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
40 local value = (data and data[field.name]) or field.value;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
41
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
42 if value then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
43 -- Add value, depending on type
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
44 if field_type == "hidden" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
45 if type(value) == "table" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
46 -- Assume an XML snippet
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
47 form:tag("value")
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
48 :add_child(value)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
49 :up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
50 else
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
51 form:tag("value"):text(tostring(value)):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
52 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
53 elseif field_type == "boolean" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
54 form:tag("value"):text((value and "1") or "0"):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
55 elseif field_type == "fixed" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
56 form:tag("value"):text(value):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
57 elseif field_type == "jid-multi" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
58 for _, jid in ipairs(value) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
59 form:tag("value"):text(jid):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
60 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
61 elseif field_type == "jid-single" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
62 form:tag("value"):text(value):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
63 elseif field_type == "text-single" or field_type == "text-private" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
64 form:tag("value"):text(value):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
65 elseif field_type == "text-multi" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
66 -- Split into multiple <value> tags, one for each line
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
67 for line in value:gmatch("([^\r\n]+)\r?\n*") do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
68 form:tag("value"):text(line):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
69 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
70 elseif field_type == "list-single" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
71 local has_default = false;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
72 for _, val in ipairs(value) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
73 if type(val) == "table" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
74 form:tag("option", { label = val.label }):tag("value"):text(val.value):up():up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
75 if val.default and (not has_default) then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
76 form:tag("value"):text(val.value):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
77 has_default = true;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
78 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
79 else
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
80 form:tag("option", { label= val }):tag("value"):text(tostring(val)):up():up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
81 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
82 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
83 elseif field_type == "list-multi" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
84 for _, val in ipairs(value) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
85 if type(val) == "table" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
86 form:tag("option", { label = val.label }):tag("value"):text(val.value):up():up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
87 if val.default then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
88 form:tag("value"):text(val.value):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
89 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
90 else
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
91 form:tag("option", { label= val }):tag("value"):text(tostring(val)):up():up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
92 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
93 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
94 elseif field_type == "media" then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
95 form:tag("media", { xmlns = "urn:xmpp:media-element" });
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
96 for _, val in ipairs(value) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
97 form:tag("uri", { type = val.type }):text(val.uri):up()
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
98 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
99 form:up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
100 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
101 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
102
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
103 if field.required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
104 form:tag("required"):up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
105 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
106
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
107 -- Jump back up to list of fields
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
108 form:up();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
109 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
110 return form;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
111 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
112
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
113 local field_readers = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
114
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
115 function form_t.data(layout, stanza)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
116 local data = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
117 local errors = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
118
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
119 for _, field in ipairs(layout) do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
120 local tag;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
121 for field_tag in stanza:childtags() do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
122 if field.name == field_tag.attr.var then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
123 tag = field_tag;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
124 break;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
125 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
126 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
127
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
128 if not tag then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
129 if field.required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
130 errors[field.name] = "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
131 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
132 else
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
133 local reader = field_readers[field.type];
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
134 if reader then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
135 data[field.name], errors[field.name] = reader(tag, field.required);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
136 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
137 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
138 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
139 if next(errors) then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
140 return data, errors;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
141 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
142 return data;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
143 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
144
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
145 field_readers["text-single"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
146 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
147 local data = field_tag:get_child_text("value");
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
148 if data and #data > 0 then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
149 return data
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
150 elseif required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
151 return nil, "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
152 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
153 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
154
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
155 field_readers["text-private"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
156 field_readers["text-single"];
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
157
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
158 field_readers["jid-single"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
159 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
160 local raw_data = field_tag:get_child_text("value")
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
161 local data = jid_prep(raw_data);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
162 if data and #data > 0 then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
163 return data
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
164 elseif raw_data then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
165 return nil, "Invalid JID: " .. raw_data;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
166 elseif required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
167 return nil, "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
168 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
169 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
170
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
171 field_readers["jid-multi"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
172 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
173 local result = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
174 local err = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
175 for value_tag in field_tag:childtags("value") do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
176 local raw_value = value_tag:get_text();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
177 local value = jid_prep(raw_value);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
178 result[#result+1] = value;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
179 if raw_value and not value then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
180 err[#err+1] = ("Invalid JID: " .. raw_value);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
181 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
182 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
183 if #result > 0 then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
184 return result, (#err > 0 and t_concat(err, "\n") or nil);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
185 elseif required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
186 return nil, "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
187 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
188 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
189
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
190 field_readers["list-multi"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
191 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
192 local result = {};
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
193 for value in field_tag:childtags("value") do
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
194 result[#result+1] = value:get_text();
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
195 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
196 if #result > 0 then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
197 return result;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
198 elseif required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
199 return nil, "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
200 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
201 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
202
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
203 field_readers["text-multi"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
204 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
205 local data, err = field_readers["list-multi"](field_tag, required);
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
206 if data then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
207 data = t_concat(data, "\n");
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
208 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
209 return data, err;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
210 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
211
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
212 field_readers["list-single"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
213 field_readers["text-single"];
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
214
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
215 local boolean_values = {
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
216 ["1"] = true, ["true"] = true,
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
217 ["0"] = false, ["false"] = false,
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
218 };
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
219
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
220 field_readers["boolean"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
221 function (field_tag, required)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
222 local raw_value = field_tag:get_child_text("value");
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
223 local value = boolean_values[raw_value ~= nil and raw_value];
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
224 if value ~= nil then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
225 return value;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
226 elseif raw_value then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
227 return nil, "Invalid boolean representation";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
228 elseif required then
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
229 return nil, "Required value missing";
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
230 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
231 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
232
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
233 field_readers["hidden"] =
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
234 function (field_tag)
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
235 return field_tag:get_child_text("value");
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
236 end
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
237
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
238 field_readers["media"] = field_readers["text-single"]
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
239
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
240 return _M;
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
241
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
242
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
243 --[=[
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
244
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
245 Layout:
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
246 {
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
247
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
248 title = "MUC Configuration",
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
249 instructions = [[Use this form to configure options for this MUC room.]],
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
250
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
251 { name = "FORM_TYPE", type = "hidden", required = true };
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
252 { name = "field-name", type = "field-type", required = false };
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
253 }
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
254
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
255
985bfc6e8cad mod_captcha_registration: initial commit
mrDoctorWho <mrdoctorwho@gmail.com>
parents:
diff changeset
256 --]=]