Matthew Wild
e12a6cdb99
util.array: Add __div for parity with util.set
8 years ago
Matthew Wild
fbb11b868f
util.array: Break long line
8 years ago
Matthew Wild
05b4064188
util.promise: Add promise.try()
8 years ago
Matthew Wild
44b3954d56
util.pubsub: Allow publishing with a config that should be used as defaults only
8 years ago
Kim Alvefur
dd2f749996
util.promise: Add a string representation
8 years ago
Matthew Wild
681b25e427
util.promise: Add promise:finally()
8 years ago
Matthew Wild
894fe1b808
util.promise: Some code relocation
8 years ago
Matthew Wild
7bcf751702
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.
8 years ago
Matthew Wild
ef7d6ba99e
util.promise: Fix promise.reject() to return a rejected promise, and fix buggy test for it
8 years ago
Kim Alvefur
0247a0e904
mod_http: Move normalize_path to util.http
8 years ago
Kim Alvefur
284152ba25
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.
8 years ago
Kim Alvefur
e2321c4d37
util.stanza: Set preserialize as freeze metamethod
8 years ago
Kim Alvefur
1ab9729aac
util.set: Add freeze metamethod
8 years ago
Kim Alvefur
15ba5f41b1
util.array: Add freeze metamethod
8 years ago
Kim Alvefur
1789a7adf8
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
8 years ago
Kim Alvefur
e0a16c75dc
util.serialization: Simpler metatable pre-processing
...
It was too difficult to describe what it did.
8 years ago
Kim Alvefur
8d941e5d0f
util.serialization: Use '=' prefix for chunk source description
...
Like in bd5e4485a245
8 years ago
Kim Alvefur
09c19925cc
util.serialization: Make check of prefix for optional hex encoding stricter
8 years ago
Kim Alvefur
e99c680a14
util.serialization: Make errors fatal by default (like the previous implementation)
8 years ago
Matthew Wild
e557cfb012
util.promise: ES6-like API for promises
8 years ago
Kim Alvefur
ed7c24bd0d
util.serialization: Stricter type check
8 years ago
Matthew Wild
809db57f68
util.json: Use util.iterators.sorted_pairs() in ordered mode
8 years ago
Matthew Wild
c65893de6e
util.iterators: Add sorted_pairs() method
8 years ago
Kim Alvefur
dae66b0b3f
util.jid: Add missing semicolon
8 years ago
Kim Alvefur
759fe72f49
util.stanza: Add method for removing all children with a specific name, xmlns
8 years ago
Matthew Wild
27d8902b8e
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.
8 years ago
Kim Alvefur
715b488722
util.dataforms: Improve default error message for failed datatype validation
8 years ago
Kim Alvefur
9c1528bf2e
util.dataforms: Add support for XEP-0122: Data Forms Validation
...
Initially only basic validation of xs:integer
8 years ago
Kim Alvefur
3da47d7dde
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
fb2fdc660b
util.pubsub: Expand comment on return type from get_items
8 years ago
Kim Alvefur
a60bb9bb13
util.pubsub: Explicitly add all capabilities to the 'outcast' affiliation for completeness
8 years ago
Kim Alvefur
df5360e6a3
util.pubsub: Comments describing the return values of methods
8 years ago
Matthew Wild
11c4cee97a
util.pubsub: Add 'service' field to all events
8 years ago
Kim Alvefur
dedea4fb31
util.pubsub: Remove unused argument
...
I think this was probably a copy-paste mistake.
8 years ago
Matthew Wild
99b85eda32
util.pubsub: Fire item-published/<node> to allow for easier handling of per-node items
8 years ago
Matthew Wild
3b0271f560
util.stanza + tests: Bail out of loop if we are iterating too far, fixes #981
8 years ago
Matthew Wild
cbaa78ecca
util.startup: Set flag when config fully loaded
8 years ago
Matthew Wild
512d844d91
util.pubsub, pubsub.lib: Improve error on attempt to publish invalid item
8 years ago
Matthew Wild
23cfd1b4d0
Pubsub: Add tests for :get_last_item() and fix for non-persistent nodes
8 years ago
Matthew Wild
0a0695d96b
util.pubsub: Fix whitespace [luacheck]
8 years ago
Matthew Wild
6e48cd5ece
Backed out changeset 27d800ddc3b0 (see below)
...
It's uncertain whether item not existing should be success and
nil, or fail with an error.
XEP-0060's "fetch most recent item" actually fetches a list of up
to N items. N here is a maximum, not a minimum. The feeling is that
no items is simply an empty list, not a failure of the operation.
8 years ago
Matthew Wild
6ff958994e
util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
8 years ago
Matthew Wild
6643aeb7e6
util.pubsub: get_last_item(): Return error if node does not exist
8 years ago
Matthew Wild
716c68f983
pubsub.lib, util.pubsub: Move precondition checks to util.pubsub
8 years ago
Matthew Wild
fe83df56a9
util.pubsub: Add comment to clarify return values
8 years ago
Kim Alvefur
98c9778cc7
util.pubsub: Pass "retract" as the type of such broadcasts
...
This moves some XEP-0060 awkwardness out of util.pubsub and into mod_pubsub
A retraction is broadcast in an <items> container, whereas most other
kinds of broadcasts are in a container with a name matching the 'kind'
attribute.
8 years ago
Kim Alvefur
18157ec5f8
util.async: Remove sleep function
...
Dependency on util.timer indirectly caused net.server to be initialized
before the config was read, so server_select was always chosen.
8 years ago
Matthew Wild
a86ca3faa1
util.pubsub: Allow outcasts to get their subscription status
8 years ago
Kim Alvefur
9437d97a37
util.dependencies: Add comment about LuaSec compat
9 years ago
Kim Alvefur
255073d6c9
util.dependencies: Add compatibility code for LuaSocket no longer exporting as a global
9 years ago