Kim Alvefur
a83cf53a22
util.stanza: Validate input to clone() (with brief tests)
7 years ago
Kim Alvefur
7aa9b58533
util.stanza: Set preserialize as freeze metamethod
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
Matthew Wild
028db90d4b
util.stanza + tests: Bail out of loop if we are iterating too far, fixes #981
8 years ago
Kim Alvefur
632c7f3d31
util.stanza: Remove redundant check from :text now done in :add_direct_child
8 years ago
Kim Alvefur
22e7fd2be1
util.stanza: Verify that other objects added as children are valid strings
8 years ago
Kim Alvefur
1836db9162
util.stanza: Verify that child tags added are really stanzas ( closes #1165 )
8 years ago
Kim Alvefur
1158e80471
util.stanza: Add :text_tag(), a shortcut for adding nodes with text
8 years ago
Matthew Wild
9306e1a074
util.stanza: Allow :text(nil) and :text("") as harmless nops
8 years ago
Matthew Wild
7d4e55d567
util.stanza: Switch from asserts to if's, improve performance, errors and tests
8 years ago
Matthew Wild
d0a4392817
util.stanza: Add stricter validation for data passed to stanza builder API
8 years ago
Kim Alvefur
146acdbd33
vairious: Add annotation when an empty environment is set [luacheck]
8 years ago
Kim Alvefur
61fe640435
util.stanza: Change __type to __name as this is used by Lua 5.3 in some error reporting functions
8 years ago
Kim Alvefur
11b0084551
util: Various minor changes to please [luacheck]
8 years ago
Kim Alvefur
06124bad4d
util.stanza: Add an is_stanza() function to check if an object is a stanza
9 years ago
Matthew Wild
b7c295a5de
util.stanza: Some code cleanup [luacheck]
10 years ago
Matthew Wild
60a27e3781
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
e1d1102f5e
util.stanza: Export xml_escape (missed during removal of module() calls)
11 years ago
Kim Alvefur
3015aac8bc
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
69ac9ffd7a
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
4258277687
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
4b618a8727
Remove all trailing whitespace
13 years ago
Matthew Wild
13dc956bd9
util.stanza: Use correct index when replacing the tag in .tags (thanks daurnimator)
13 years ago
Kim Alvefur
a575e13e1d
util.stanza: Add stanza:find(), a light weight XPath-like method
13 years ago
Matthew Wild
71e3455f55
util.stanza: :maptags(): Fixes to make loop more robust on item removal
13 years ago
Kim Alvefur
7389c0e4ee
util.stanza: Use ipairs instead of childtags (behavior changed in 92c86e11fd44)
14 years ago
Kim Alvefur
89b96a2c5f
util.stanza: Make stanza:childtags() behave like :get_child()
14 years ago
Matthew Wild
428aa05eb5
util.stanza: Remove unused function imports
14 years ago
Matthew Wild
a60732b666
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
Matthew Wild
4776abee1d
util.stanza: Change get_error() to return nil rather than '' for no text
15 years ago
Matthew Wild
03db98294d
util.stanza: Whitespace fix after merge (complicated)
15 years ago
Matthew Wild
24d55e89f0
util.stanza: Remove childtags and rename matching_tags -> childtags (they are API-compatible)
15 years ago
Matthew Wild
297144b6a7
util.stanza: Remove childtags and rename matching_tags -> childtags (they are API-compatible)
15 years ago
Waqas Hussain
78b3e4e756
util.stanza: Rewrite clone() to be more optimized.
15 years ago
Waqas Hussain
58d70ee4d5
util.stanza: Rewrite clone() to be more optimized.
15 years ago
Waqas Hussain
bbb4eabf46
util.stanza: Make some globals local, so they don't clutter the global checking script's output. It's also a minor optimization ;)
15 years ago
Matthew Wild
22bd191f86
util.stanza: Add get_child_text() method to get the text of the specified child element (get_child() + get_text() rolled into one step)
15 years ago
Matthew Wild
9d5e9921e6
util.stanza: Clean up matching_tags() and replace :childtags() with it
15 years ago
Waqas Hussain
539b221189
util.stanza, util.xmppstream, core.xmlhandlers: Allow stanza.last_add to be nil, and set it nil by default. Saves a table allocation per-element. 20% faster stanza building.
15 years ago
Waqas Hussain
076aadf990
util.stanza: Make the current element <message> instead of <body> when body text is passed to st.message().
16 years ago
Matthew Wild
e3718ed22e
util.stanza: stanza:matched_children() -> stanza:matching_tags()
16 years ago
Matthew Wild
f5fcc46905
util.stanza: Add stanza:maptags() to apply a function over child tags (return nil to remove tag from stanza)
16 years ago
Matthew Wild
a69205c3b9
util.stanza: Optimisation, remove useless if...then in stanza:children() iterator
16 years ago
Matthew Wild
aa509f9fce
util.stanza: Add stanza:matched_children(name, xmlns) [name suggestions welcome]
16 years ago
Waqas Hussain
bc55b5ad8f
util.stanza: Fixed some more nil global accesses.
16 years ago
Waqas Hussain
a015c6a048
util.stanza: Fixed a nil global access.
16 years ago