Kim Alvefur
a83cf53a22
util.stanza: Validate input to clone() (with brief tests)
7 years ago
Kim Alvefur
e5cb282f6c
util.sql: Switch from hacky multi-arg xpcall implementation to util.xpcall
7 years ago
Kim Alvefur
0002b7b62f
util.sslconfig: Recognise TLS 1.3 as a protocol version
...
This enables it to understand protocol = "tlsv1_3+"
7 years ago
Kim Alvefur
52551bb262
util.serialization: Encode non-fatal error in way that can be restored
...
It could previously encode to eg `{ [nil] = ... }` which doesn't get decoded
7 years ago
Kim Alvefur
f52dc4985c
util.serialization: Rename non-fatal fallback handler for clarity
7 years ago
Kim Alvefur
108f6557fd
util.serialization: Disable use of unquoted table keys by default
...
For safety against future new keywords
7 years ago
Kim Alvefur
669ab61ecd
util.serialization: Add option for allowing multiple references to the same table (but not cycles)
7 years ago
Kim Alvefur
fe4440f497
util.serialization: Separate errors for multiple table references and max depth
7 years ago
Kim Alvefur
956b687a20
util.serialization: Make maximum table depth configurable
7 years ago
Matthew Wild
9b5c6c4d9d
Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall
7 years ago
Matthew Wild
3bc2c02797
util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1
7 years ago
Matthew Wild
5e7e48d99b
util.dependencies: Remove ztact compatability warning
7 years ago
Matthew Wild
387c3e9cef
util.promise: Switch from pcall to xpcall to get tracebacks on exceptions
7 years ago
Matthew Wild
97ae9b843d
util.promise: Remove the non-standard ability to pass a promise to reject()
7 years ago
Matthew Wild
dd74a38b22
util.promise: Fix missing parameters
7 years ago
Matthew Wild
e7a26ebc24
util.promise: Ensure chained promises always receive a value/rejection even if an intermediate promise has no handlers
7 years ago
Matthew Wild
ef2ab23700
util.promise: Export is_promise()
7 years ago
Matthew Wild
fbe4c45052
util.promise: Remove debug print and assert
7 years ago
Kim Alvefur
50f360a506
util.pubsub: Clarify comment about return value
7 years ago
Matthew Wild
fd61b755c9
util.array: Add __div for parity with util.set
7 years ago
Matthew Wild
cfa8975a8a
util.array: Break long line
7 years ago
Matthew Wild
d18c2d6c65
util.promise: Add promise.try()
7 years ago
Matthew Wild
7335fe3488
util.pubsub: Allow publishing with a config that should be used as defaults only
7 years ago
Kim Alvefur
6f0d589813
util.promise: Add a string representation
7 years ago
Matthew Wild
cdd7a0fbf8
util.promise: Add promise:finally()
7 years ago
Matthew Wild
a66d4a2f82
util.promise: Some code relocation
7 years ago
Matthew Wild
767997a53a
util.promise: Also support automatic resolution by returning a promise from an on_reject handler
...
Originally unimplemented because it wasn't clear to me what the correct behaviour was, but the A+
spec is clear that both onFulfilled and onRejected may return a promise.
7 years ago
Matthew Wild
90b256a19d
util.promise: Fix promise.reject() to return a rejected promise, and fix buggy test for it
7 years ago
Kim Alvefur
41abd787ba
mod_http: Move normalize_path to util.http
7 years ago
Kim Alvefur
4cc41d35f2
util.dependencies: Add compat code for normalization of socket constructors
...
Old LuaSocket had only tcp() which was IPv4-only. LuaSocket ~3.0 adds a
tcp6() that creates a IPv6 socket. Some version moves tcp() to tcp4()
and adds an IP-version-agnostic tcp() constructor.
7 years ago
Kim Alvefur
7aa9b58533
util.stanza: Set preserialize as freeze metamethod
7 years ago
Kim Alvefur
970307dbfb
util.set: Add freeze metamethod
7 years ago
Kim Alvefur
87f166a6be
util.array: Add freeze metamethod
7 years ago
Kim Alvefur
3d1e573b27
util.serialization: Remove encoding of very large or very small numbers in scientific notation
...
Also difficult to describe this option, easier to remove it.
%.18g covers a very large range of numbers
7 years ago
Kim Alvefur
a8b392165a
util.serialization: Simpler metatable pre-processing
...
It was too difficult to describe what it did.
7 years ago
Kim Alvefur
86117bb2a2
util.serialization: Use '=' prefix for chunk source description
...
Like in bd5e4485a245
7 years ago
Kim Alvefur
cd8f883199
util.serialization: Make check of prefix for optional hex encoding stricter
7 years ago
Kim Alvefur
71a12130de
util.serialization: Make errors fatal by default (like the previous implementation)
7 years ago
Matthew Wild
d3496d3be0
util.promise: ES6-like API for promises
7 years ago
Kim Alvefur
05f16b4a2f
util.serialization: Stricter type check
7 years ago
Matthew Wild
d338d4b82c
util.json: Use util.iterators.sorted_pairs() in ordered mode
7 years ago
Matthew Wild
5947c028a9
util.iterators: Add sorted_pairs() method
7 years ago
Kim Alvefur
3fb26b8eea
util.jid: Add missing semicolon
7 years ago
Kim Alvefur
10cf2b24e6
util.stanza: Add method for removing all children with a specific name, xmlns
8 years ago
Matthew Wild
b3cfe2bd75
util.stanza: Don't automatically generate ids for iq stanzas
...
Users of this API should provide their own id attribute that meets their
uniqueness requirements.
The current implementation leaks information (i.e. how many iq stanzas
have been sent by the server to other JIDs). Providing any strong
guarantees of randomness here would need to pull in additional
dependencies that we don't want in this simple library.
7 years ago
Kim Alvefur
f77cf987ce
util.dataforms: Improve default error message for failed datatype validation
8 years ago
Kim Alvefur
080c294fe8
util.dataforms: Add support for XEP-0122: Data Forms Validation
...
Initially only basic validation of xs:integer
8 years ago
Kim Alvefur
367e73a610
util.dataforms: Allow field names to be different from the 'var' attribute
...
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.
8 years ago
Kim Alvefur
418bf0b73f
util.pubsub: Expand comment on return type from get_items
8 years ago
Kim Alvefur
59b9a3eb3f
util.pubsub: Explicitly add all capabilities to the 'outcast' affiliation for completeness
8 years ago