Kim Alvefur
815ce25d10
util.stanza: Extract Application-Specific Condition from errors
...
API change
5 years ago
Kim Alvefur
1c53f533b0
util.stanza: Support Application-Specific Conditions in util.error
5 years ago
Kim Alvefur
8c0efc9e55
util.stanza: Get 'by' from context instead
...
Zash> <error by=?> should go where? extra.by? context? source?
Zash> In Prosody this would usually be module.host or a bare user/room JID
MattJ> Zash: context
MattJ> context.by, basically the opposite of context.actor
5 years ago
Kim Alvefur
3f9988468d
util.stanza: Support inclusion of <gone> URI from util.error object
5 years ago
Kim Alvefur
2f0b85ce29
util.stanza: Support getting 'by' from util.error object
5 years ago
Kim Alvefur
d9e80064b5
util.stanza: Reorder code to prepare for extracting 'by' from util.error
5 years ago
Kim Alvefur
f0ac29acf0
util.stanza: Add method returning stanza with added indentation
...
Adds indentation and line breaks to stanzas, to make stanzas easier to
read for humans.
6 years ago
Kim Alvefur
4e34c40ece
util.stanza: Accept util.error object to error_reply
...
If we're moving towards util.error as the standard error container then
this makes sense.
This may allow for future extensibility without needing a lot of
optional arguments.
6 years ago
Kim Alvefur
be23b274f6
util.stanza: Support the 'by' attribute on errors
...
This is to be used when the entity generating the error is not the same
as the one the stanza was directed to, e.g. an intermediate server.
6 years ago
Kim Alvefur
54da2ab6f7
util.stanza: Check that argument to error_reply is NOT a stanza of type error
...
Replying to an error is Very Bad
6 years ago
Kim Alvefur
52b7181979
util.stanza: Check that argument to error_reply is a stanza
6 years ago
Kim Alvefur
11095184a5
util.stanza: Remove redundant check for attrs
...
A stanza can't not have attrs if created the correct way
6 years ago
Kim Alvefur
b340e5e462
util.stanza: Check that argument to reply is a stanza
6 years ago
Kim Alvefur
76536dab05
util.stanza: Deserialize stanza without mutating input ( fixes #711 )
7 years ago
Kim Alvefur
50f6335501
util.stanza: Validate input to clone() (with brief tests)
7 years ago
Kim Alvefur
6e624e01c6
util.stanza: Use :text_tag internally everywhere
...
May allow future changes in a single place.
7 years ago
Kim Alvefur
e2321c4d37
util.stanza: Set preserialize as freeze metamethod
7 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.
7 years ago
Matthew Wild
3b0271f560
util.stanza + tests: Bail out of loop if we are iterating too far, fixes #981
7 years ago
Kim Alvefur
6d79aef106
util.stanza: Remove redundant check from :text now done in :add_direct_child
8 years ago
Kim Alvefur
37344a42d8
util.stanza: Verify that other objects added as children are valid strings
8 years ago
Kim Alvefur
beac6ef1ea
util.stanza: Verify that child tags added are really stanzas ( closes #1165 )
8 years ago
Kim Alvefur
2d784f1063
util.stanza: Add :text_tag(), a shortcut for adding nodes with text
8 years ago
Matthew Wild
17500b46fb
util.stanza: Allow :text(nil) and :text("") as harmless nops
8 years ago
Matthew Wild
65f4b853a0
util.stanza: Switch from asserts to if's, improve performance, errors and tests
8 years ago
Matthew Wild
6d7cd57d44
util.stanza: Add stricter validation for data passed to stanza builder API
8 years ago
Kim Alvefur
43b814a83b
vairious: Add annotation when an empty environment is set [luacheck]
8 years ago
Kim Alvefur
6cdc43292e
util.stanza: Change __type to __name as this is used by Lua 5.3 in some error reporting functions
8 years ago
Kim Alvefur
1438a38845
util: Various minor changes to please [luacheck]
8 years ago
Kim Alvefur
2d642bfb76
util.stanza: Add an is_stanza() function to check if an object is a stanza
9 years ago
Matthew Wild
62716e66c8
util.stanza: Some code cleanup [luacheck]
10 years ago
Matthew Wild
dd37beeff9
util.stanza, util.xml, util.xmppstream: Add support for tracking defined namespaces and their prefix (stanza.namespaces), knowing/preserving prefix names is required for some applications (thanks daurnimator)
10 years ago
Kim Alvefur
ee7527ac00
util.stanza: Export xml_escape (missed during removal of module() calls)
10 years ago
Kim Alvefur
eaa823a597
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
11 years ago
Matthew Wild
886aa3c20a
Backout changeset 6e67c73f730c: not a major fix and it breaks interop with at least Isode M-Link, and possibly standards, while it's not clear it actually fixes the original problem either.
11 years ago
Waqas Hussain
6656c56b93
util.stanza: Escape newlines and tabs (\r\n\t) when serializing stanzas. \r\n transforms into \n otherwise, and \r\n\t in attributes transforms into spaces.
11 years ago
Florian Zeitz
1d833bb807
Remove all trailing whitespace
13 years ago
Matthew Wild
552fdd0caf
util.stanza: Use correct index when replacing the tag in .tags (thanks daurnimator)
13 years ago
Kim Alvefur
bd72dc3f88
util.stanza: Add stanza:find(), a light weight XPath-like method
13 years ago
Matthew Wild
3230dc4c0a
util.stanza: :maptags(): Fixes to make loop more robust on item removal
13 years ago
Kim Alvefur
0f7cedcc1a
util.stanza: Use ipairs instead of childtags (behavior changed in 92c86e11fd44)
14 years ago
Matthew Wild
e1b559853f
util.stanza: Fix :top_tag() handling of namespaced attributes
7 years ago
Kim Alvefur
20429527b1
util.stanza: Require a type attribute for iq stanzas
7 years ago
Kim Alvefur
ae0fdd43a4
util.stanza: Make stanza:childtags() behave like :get_child()
14 years ago
Matthew Wild
811e44ec5e
util.stanza: Remove unused function imports
14 years ago
Matthew Wild
d0f4bbd2db
util.stanza: Remove unused __add metamethod
14 years ago
Kim Alvefur
fdc0474f9b
util.stanza: Iterate on childtags instead of all childs.
15 years ago
Kim Alvefur
8f9442b31c
util.stanza: Iterate on childtags instead of all childs.
15 years ago
Matthew Wild
81b877341f
util.stanza: Change get_error() to return nil rather than '' for no text
15 years ago