Kim Alvefur
2ae58ee422
mod_admin_shell: Sort timers by time in debug:timers()
...
Easier to see which timers are happening soon vs further in the future
if they are in some sensible order.
5 years ago
Kim Alvefur
f7cfe660cd
mod_c2s: Log a debug message before closing due to c2s_timeout
...
It was confusing that the connection would just close without much
explanation.
Wanted this while investigating https://github.com/conversejs/converse.js/issues/2438
5 years ago
Kim Alvefur
2040145780
util.datamapper: Deal with locally built stanzas missing xmlns
...
So the problem is that xmlns is not inherited when building a stanza,
and then :get_child(n, ns) with an explicit namespace does not find that
such child tags.
E.g.
local t = st.stanza("foo", { xmlns = "urn:example:bar" })
:text_tag("hello", "world");
assert(t:get_child("hello", "urn:example:bar"), "This fails");
Meanwhile, during parsing (util.xmppstream or util.xml) child tags do
get the parents xmlns when not overriding them.
Thus, in the above example, if the stanza is passed trough
`t = util.xml.parse(tostring(t))` then the assert succeeds.
This change makes it so that it leaves out the namespace argument to
:get_child when it is the same as the current/parent namespace, which
behaves the same for both built and parsed stanzas.
5 years ago
Kim Alvefur
e783d99cc2
util.datamapper: Factor out conversion from any value to XML string
...
Since this was the last severely duplicated code left.
5 years ago
Kim Alvefur
f2f1714e47
mod_authz_internal: Ignore unused argument for now [luachec]
5 years ago
Jonas Schäfer
0ca317cd0b
usermanager: expose set_roles through API
5 years ago
Jonas Schäfer
03d38b2a67
mod_authz_internal: add support for setting roles of a local user
5 years ago
Kim Alvefur
6f0532b89f
util.datamapper: Handle nested arrays or objects in arrays
5 years ago
Kim Alvefur
f68d29bafd
util.datamapper: Fix to skip parsing wrapped arrays that aren't there
...
Turns out the unreachable error is reachable :D
5 years ago
Kim Alvefur
110e82bd93
util.datamapper: Clear done TODO (arrays)
...
Relevant commits:
* 6a51749af7f4
* 0e00fa518688
* d1982b7eb00d
* c098d07e6717
* 348b191cd850
5 years ago
Kim Alvefur
4f191a3239
util.datamapper: Complete array building support
5 years ago
Kim Alvefur
366edae239
util.datamapper: Factor out handling of object properties for array reuse
5 years ago
Kim Alvefur
f5962d7193
util.datamapper: Finally implement support for parsing arrays
5 years ago
Kim Alvefur
87474145e5
util.datamapper: Factor out extraction of the XML part to use
...
So extract_value() takes an XML tag and details about which part we're
interested in and returns that.
Factoring this out will help with array implementation since this will
be common behavior.
5 years ago
Kim Alvefur
a51587da48
util.datamapper: Only get element name if there's an element
...
Fixes error due to attempting to index a nil value
5 years ago
Kim Alvefur
f6de136dc4
make: Magic trick for teal-src/*.tl -> ./*.lua
5 years ago
Kim Alvefur
7f04df223a
util.datamapper: Fix arrays nesting one level too deep
5 years ago
Kim Alvefur
3c3cdcd0c7
util.datamapper: Deal with type name changes in util.jsonschema
5 years ago
Kim Alvefur
c1706af956
util.jsonschema: Rename types for improved readability
5 years ago
Kim Alvefur
d18097fb67
teal: Use new integer support in Teal 0.13.0
5 years ago
Kim Alvefur
576b43151c
util.datamapper: Limited support for unparsing simple arrays of strings
5 years ago
Kim Alvefur
c62c5b307e
util.datamapper: Add initial support for parsing arrays
5 years ago
Kim Alvefur
fb7df0067c
util.datamapper: Factor out common schema unpacking
...
This code extracts the bits from the schema that determines how the data
is to be mapped to/from XML.
5 years ago
Kim Alvefur
3a62af2e0e
util.datamapper: Separate extraction of xml from coercion to target type
...
Now it gets the text, attribute or name first, then turns it into
whatever the schema wants. This should be easier to further factor out
into preparation for array support.
5 years ago
Kim Alvefur
a7b010cbc5
util.datamapper: Use enum instead of mutually exclusive booleans
...
Cleaner and rules out invalid combinations.
5 years ago
Kim Alvefur
9d25c9c9ac
util.datamapper: Enumerated elements
...
E.g. error conditions or chat states.
5 years ago
Kim Alvefur
465a8b8b1a
util.datamapper: Some TODOs
5 years ago
Kim Alvefur
a09823e81c
util.datamapper: Add references with notes
5 years ago
Kim Alvefur
832296535f
util.datamapper: Add Copyright header
5 years ago
Kim Alvefur
ee7ffc309a
util.jsonschema: Add copyright-header
5 years ago
Kim Alvefur
6db9456d88
util.jsonschema: Restructure "type" keyword handling
...
More in line with the other tests
5 years ago
Kim Alvefur
44edd47ca8
util.jsonschema: Syntax tweak to not upset syntax highlighting
...
That whole condition stanza was shown as angry red, I think it's
something with 'enum' being a key word in Teal.
5 years ago
Kim Alvefur
1317e78fbb
util.jsonschema: Implement "propertyNames"
...
This is a bit special in Lua as tables are not limited to string keys
5 years ago
Kim Alvefur
d8303be145
util.jsonschema: Restructure handling of "properties" and "additionalProperties"
...
This is a bit cleaner, I think
5 years ago
Kim Alvefur
ae40825925
util.jsonschema: Fix "uniqueItems" prematurely declaring a match
5 years ago
Kim Alvefur
da85d37bcb
util.jsonschema: Implement the "prefixItems" keyword
...
This may have been what got me confused about "items" being an array.
5 years ago
Kim Alvefur
ce4040e109
util.jsonschema: Implement the "contains" keyword
...
And apparently I had mistaken this for an array
5 years ago
Kim Alvefur
5a44c4a32b
util.jsonschema: Allow a boolean as schema
...
Apparently a schema must be either an object or a boolean. Not sure
where I got this string shortcut from, but I think I will keep it as it
is very convenient.
5 years ago
Kim Alvefur
6a7346ac8e
util.jsonschema: Correct "items" keyword
...
Upon re-reading the JSON Schema spec, I found that 'items' wasn't a
union of an array of schemas or a single schema, not sure where I got
that from.
5 years ago
Kim Alvefur
07889f274d
util.datamapper: Add support for mapping of elements where only one attribute matters
...
E.g. <feature var='foo'/> in XEP-0030 and some other simple
specifications.
5 years ago
Kim Alvefur
7cd2803161
util.datamapper: Add logic for "boolean" tags here the presence means true
5 years ago
Kim Alvefur
d20ea9b87e
util.datamapper: Invent extension for using tag name as value
...
Useful for certain enum-like uses where the element name is the relevant
information, e.g. chat states.
5 years ago
Kim Alvefur
d8e9e044f2
util.datamapper: Add 'unparse' for turning tables into XML
5 years ago
Kim Alvefur
081eb23c54
util.datamapper: Library for extracting data from stanzas
...
Based on the XML support in the OpenAPI specification.
5 years ago
Kim Alvefur
02da1378f8
util.jsonschema: Library for JSON Schema validation
5 years ago
Kim Alvefur
8cf1f8a901
make: Add target for building Teal sources
...
Compiled Lua targets included in parallel in order to not add a hard
dependency on Teal, at least not yet.
5 years ago
Kim Alvefur
d7b1df42d3
util: Add Teal interface definition files
...
Enables writing code in Teal that is aware of the interfaces and
function prototypes in these other utils.
Could also be used to do type checks on Lua sources, but this tends to
have a lot of noise.
5 years ago
Kim Alvefur
21dfac68ed
util.gc: Fix check for Lua 5.4
5 years ago
Kim Alvefur
409c611a37
net.resolvers.basic: Fix completion condition when IPv6 is disabled
...
Fixes mistake introduced in 5a71f14ab77c that made it so this ready()
newer got called and thus it would be stuck waiting for it.
Looks like the kind of thing that could have been introduced by a merge
or rebase.
Thanks MattJ
5 years ago
Kim Alvefur
90e4a09661
mod_pubsub: Include <pubsub> with unsubscribe reply
...
XEP-0060 6.2.2
This is a MAY but it makes it nice and symmetric with the subscription
response. Reduces the need to remember which node you unsubscribed from.
Explicit > implicit etc.
5 years ago