aboutsummaryrefslogtreecommitdiffstats
path: root/util/dataforms.lua
Commit message (Collapse)AuthorAgeFilesLines
* util: Prefix module imports with prosody namespaceKim Alvefur2023-03-171-3/+3
|
* util.dataforms: Encode size attributes as integers in XEP-0221 media elementKim Alvefur2021-10-281-1/+1
| | | | Otherwise very large fields would be serialized in e notation
* util.dataforms: Ensure larger integers are serialized as suchKim Alvefur2021-10-281-1/+3
| | | | | | | Assumes that most number fields are integers, as most numeric types listed in XEP-0122 are, as are all such fields in Prosody as of this. Otherwise %g produces something like 1.1259e+15
* util.dataforms: Turn number values into timestamps for datetime fieldsKim Alvefur2021-10-261-1/+3
| | | | Makes it symmetric with parsing.
* util.dataforms: Coerce number values for boolean fieldsKim Alvefur2021-10-261-2/+5
| | | | | Makes more sense than coercing to a string, which would always be truthy.
* util.dataforms: Add support for datetime field types via XEP-0122Kim Alvefur2021-10-251-0/+8
|
* util.dataforms: Define a integer + "max" datatypeKim Alvefur2020-09-181-0/+9
|
* util.dataforms: Add support for validating (integer) rangesKim Alvefur2019-11-211-1/+13
|
* util.dataforms: Convert media element sizes to avoid error on Lua 5.3Kim Alvefur2020-08-161-1/+1
| | | | | | | | The stanza API does not accept number values and threw an error due to the height and width attributes of the media element (XEP-0221). This part had no test coverage previously, explaining why it was not discovered until now.
* util.dataforms: Improve default error message for failed datatype validationKim Alvefur2018-09-031-1/+1
|
* util.dataforms: Add support for XEP-0122: Data Forms ValidationKim Alvefur2018-09-011-1/+36
| | | | Initially only basic validation of xs:integer
* util.dataforms: Allow field names to be different from the 'var' attributeKim Alvefur2018-09-011-2/+2
| | | | | | This should allow the usage of long prefixes and namespace-like names to be contained to the XML representation of the form, so that the code can use more convenient names.
* util.dataforms: Allow passing the current values to be used in stead of ↵Kim Alvefur2018-08-051-2/+4
| | | | omitted fields
* util.dataforms: Normalize indentationKim Alvefur2018-08-041-3/+3
|
* util.dataforms: Only allow overriding of options when passed via the :form ↵Kim Alvefur2018-08-031-9/+8
| | | | method
* util.dataforms: Allow overriding default options even if the form has suchKim Alvefur2018-08-031-1/+1
|
* util.dataforms: Allow passing dynamically generated options as values (fixes ↵Kim Alvefur2018-08-031-2/+9
| | | | | | | traceback) This is awkward but there’s currently no better way to do this, short of dynamically generating the entire form each time
* util.dataforms: Exclude descriptive text fields from forms of type 'submit'Kim Alvefur2018-08-031-9/+13
| | | | | The receiving end presumably already have the original form, so these potentially long text fields are of little value.
* util.dataforms: Skip all fields for the 'cancel' form typeKim Alvefur2018-08-031-0/+3
| | | | | | | | | | | XEP-0004 says: > a data form of type "cancel" SHOULD NOT contain any <field/> elements. The title and instructions don't seem to be of much value in this case either. I'm not aware of 'cancel' being used anywhere, so this should break nothing. Early return is always nice.
* util.dataforms: Only include options in 'form' type formsKim Alvefur2018-08-031-1/+1
| | | | Options should not be needed in other types of forms.
* util.dataforms: Set default value for form type argumentKim Alvefur2018-08-031-1/+2
|
* util.dataforms: Detach generation of options from values (fixes #1177)Kim Alvefur2018-08-031-30/+21
|
* util.dataforms: Ensure fields have names when collecting data (fixes ↵Kim Alvefur2018-07-151-1/+1
| | | | traceback, thanks Martin)
* util.dataforms: More robust handling of field values, especially booleansMatthew Wild2018-07-071-2/+7
| | | | | Ensure that a non-nil data[field_name] always overrides the field's default, and that values of boolean 'false' are always rendered in the form.
* util.dataforms: Add support for field descriptions in <desc>Kim Alvefur2018-06-271-0/+4
|
* util.dataforms: Add a simple function for identifying form typesKim Alvefur2018-06-021-0/+16
| | | | | This is meant to allow identifying forms without parsing them completely.
* util.dataforms: Remove string conversion to let util.stanza validate typesKim Alvefur2018-06-021-4/+4
|
* vairious: Add annotation when an empty environment is set [luacheck]Kim Alvefur2018-02-281-0/+1
|
* util.dataforms: Don't include list options in result forms (fixes #983)Matthew Wild2017-09-231-18/+22
|
* util.dataforms: Fix including default value for list-single when given as ↵Kim Alvefur2016-05-291-1/+1
| | | | field.value[].default
* util.dataforms: Allow separation of options from values in list fieldsKim Alvefur2016-05-271-4/+12
|
* util.dataforms: Track which fields are included in a formKim Alvefur2015-12-081-2/+4
|
* util.dataforms: Fix interaction of required fields and empty string values ↵Kim Alvefur2015-09-121-3/+4
| | | | (fixes #521)
* util.dataforms: Refactor parsing to reuse simple text parser instead of ↵Kim Alvefur2015-09-121-26/+21
| | | | duplicate code
* util.*: Remove use of module() function, make all module functions local and ↵Kim Alvefur2015-02-211-3/+5
| | | | return them in a table at the end
* util.dataforms: Rename unused loop counter to '_' [luacheck]Matthew Wild2015-05-061-1/+1
|
* util.dataforms: Remove unused import of pairs() (thanks luacheck)Matthew Wild2015-05-061-1/+1
|
* Merge 0.9->0.10Waqas Hussain2014-10-081-1/+1
|\
| * util/dataforms: Make sure we iterate over field tagsdaurnimator2014-10-071-1/+1
| |
* | Merge 0.9->0.10Kim Alvefur2014-04-231-0/+9
|\|
| * util.dataforms: Add support for XEP-0221: Data Forms Media ElementKim Alvefur2014-04-221-0/+9
| |
* | Remove all trailing whitespaceFlorian Zeitz2013-08-091-4/+4
|/
* util.dataforms: Return nil for empty list-mutli responses, to be consistent ↵Florian Zeitz2013-06-141-1/+5
| | | | with other readers
* util.dataforms: Add support for generating type='fixed' fieldsFlorian Zeitz2013-02-111-1/+1
|
* util.dataforms: Fix parsing of -multi fieldsFlorian Zeitz2012-06-121-5/+5
|
* util.dataforms: Don't return invalid JIDs in jid-single.Kim Alvefur2012-05-171-1/+1
|
* util.dataforms: Fix validation of booleans.Kim Alvefur2012-05-171-1/+1
|
* util.dataforms: Do field validation and normalization in field readers.Kim Alvefur2012-05-171-101/+53
|
* util.dataforms: Fix verfication for booleansFlorian Zeitz2011-12-031-1/+1
|
* util.dataforms: Fix form verificationFlorian Zeitz2011-12-021-7/+13
|