Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | util.stanza: Add method for extracting a single attribute value | Kim Alvefur | 2022-08-17 | 1 | -0/+8 |
| | | | | | | | | | Sometimes you only care about a single attribute, but the child tag itself may be optional, leading to needing `tag and tag.attr.foo` or `stanza:find("tag@foo")`. The `:find()` method is fairly complex, so avoiding it for this kind of simpler use case is a win. | ||||
* | util.stanza: Create tables with correct size to avoid reallocations | Kim Alvefur | 2022-03-18 | 1 | -2/+15 |
| | | | | | Potential performance gain since the tables don't need to be resized as they grow to the final size. | ||||
* | util.stanza: Use table.move in clone | Kim Alvefur | 2022-03-18 | 1 | -9/+6 |
| | | | | Code reduction, potentially a performance gain. | ||||
* | util.stanza: Remove dead code | Kim Alvefur | 2021-12-31 | 1 | -5/+0 |
| | | | | | These cases are caught by `check_text(v, ..)` above. Those errors do not contain the attribute however, which would have been nice. | ||||
* | util.stanza: Make type error message consistent with others | Kim Alvefur | 2021-12-31 | 1 | -1/+1 |
| | |||||
* | util.stanza: Adjust pretty printing for symmetry | Kim Alvefur | 2021-11-29 | 1 | -1/+1 |
| | | | | | Self-closing <tags/> and <?processing instructions?> had some asymmetries in applied colors. | ||||
* | util.stanza: Add :get_child_with_attr() + tests | Matthew Wild | 2021-09-12 | 1 | -0/+8 |
| | |||||
* | util.stanza: Export pretty printing function | Kim Alvefur | 2021-06-29 | 1 | -1/+3 |
| | |||||
* | util.stanza: Simplify and make pretty-printing look nicer | Kim Alvefur | 2020-11-07 | 1 | -29/+37 |
| | | | | | | | | | | | | | | I've had this color theme in a local debug module for some time and I quite like it. The colors are from the XMPP logo. Removes extra XML serialization implementation in favor of the standard one. Also removes recursive str=str..more string building. The new two-level gsub has the accumulator in C space so shouldn't be too bad. The inner gsub calls use no callback, so should be fast and not create all that much garbage. No serious benchmarking has been done, but who cares if it looks nice? | ||||
* | util.stanza: Remove Windows "support" (disabling ANSI color pretty printing) | Kim Alvefur | 2020-11-07 | 1 | -11/+2 |
| | | | | | | Always enable pretty printing if util.termcolours is available util.termcolours can be nooped out to disable pretty printing. | ||||
* | util.stanza: add at_top helper | Jonas Schäfer | 2021-05-08 | 1 | -0/+4 |
| | | | | | | This allows the user to detect whether the cursor is currently at the top of the stanza. This will be used by util.xmppstream to be able to port it over. | ||||
* | Merge 0.11->trunk | Kim Alvefur | 2021-01-08 | 1 | -2/+2 |
|\ | |||||
| * | util.stanza: Move misplaced argument to correct place | Kim Alvefur | 2020-12-24 | 1 | -2/+2 |
| | | | | | | | | | | valid_utf8() takes only one argument, so the false was probably meant to be valid_xml_cdata(text, attribute=false) | ||||
* | | Merge 0.11->trunk | Kim Alvefur | 2020-11-11 | 1 | -1/+9 |
|\| | |||||
| * | util.stanza: Reject ASCII control characters (fixes #1606) | Kim Alvefur | 2020-11-11 | 1 | -1/+9 |
| | | |||||
* | | util.stanza: Extract Application-Specific Condition from errors | Kim Alvefur | 2020-09-26 | 1 | -6/+8 |
| | | | | | | | | API change | ||||
* | | util.stanza: Support Application-Specific Conditions in util.error | Kim Alvefur | 2020-09-26 | 1 | -0/+5 |
| | | |||||
* | | util.stanza: Get 'by' from context instead | Kim Alvefur | 2020-09-26 | 1 | -1/+1 |
| | | | | | | | | | | | | | | 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 | ||||
* | | util.stanza: Support inclusion of <gone> URI from util.error object | Kim Alvefur | 2020-09-26 | 1 | -2/+8 |
| | | |||||
* | | util.stanza: Support getting 'by' from util.error object | Kim Alvefur | 2020-09-26 | 1 | -0/+3 |
| | | |||||
* | | util.stanza: Reorder code to prepare for extracting 'by' from util.error | Kim Alvefur | 2020-09-26 | 1 | -3/+3 |
| | | |||||
* | | util.stanza: Add method returning stanza with added indentation | Kim Alvefur | 2020-04-12 | 1 | -0/+30 |
| | | | | | | | | | | Adds indentation and line breaks to stanzas, to make stanzas easier to read for humans. | ||||
* | | util.stanza: Accept util.error object to error_reply | Kim Alvefur | 2019-12-14 | 1 | -0/+3 |
| | | | | | | | | | | | | | | | | 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. | ||||
* | | util.stanza: Support the 'by' attribute on errors | Kim Alvefur | 2019-11-25 | 1 | -2/+5 |
| | | | | | | | | | | 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. | ||||
* | | util.stanza: Check that argument to error_reply is NOT a stanza of type error | Kim Alvefur | 2019-11-25 | 1 | -0/+2 |
| | | | | | | | | Replying to an error is Very Bad | ||||
* | | util.stanza: Check that argument to error_reply is a stanza | Kim Alvefur | 2019-11-25 | 1 | -0/+3 |
| | | |||||
* | | util.stanza: Remove redundant check for attrs | Kim Alvefur | 2019-11-25 | 1 | -1/+1 |
| | | | | | | | | A stanza can't not have attrs if created the correct way | ||||
* | | util.stanza: Check that argument to reply is a stanza | Kim Alvefur | 2019-11-25 | 1 | -0/+3 |
| | | |||||
* | | util.stanza: Use :text_tag internally everywhere | Kim Alvefur | 2019-08-02 | 1 | -3/+3 |
| | | | | | | | | May allow future changes in a single place. | ||||
* | | util.stanza: Fix :top_tag() handling of namespaced attributes | Matthew Wild | 2019-03-25 | 1 | -32/+30 |
| | | |||||
* | | util.stanza: Require a type attribute for iq stanzas | Kim Alvefur | 2018-12-28 | 1 | -1/+7 |
|/ | |||||
* | util.stanza: Deserialize stanza without mutating input (fixes #711) | Kim Alvefur | 2018-12-01 | 1 | -27/+17 |
| | |||||
* | util.stanza: Validate input to clone() (with brief tests) | Kim Alvefur | 2018-11-17 | 1 | -2/+9 |
| | |||||
* | util.stanza: Set preserialize as freeze metamethod | Kim Alvefur | 2018-10-12 | 1 | -0/+2 |
| | |||||
* | util.stanza: Don't automatically generate ids for iq stanzas | Matthew Wild | 2018-09-13 | 1 | -9/+4 |
| | | | | | | | | | | 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. | ||||
* | util.stanza + tests: Bail out of loop if we are iterating too far, fixes #981 | Matthew Wild | 2018-08-19 | 1 | -0/+6 |
| | |||||
* | Merge 0.10->trunk | Kim Alvefur | 2018-07-08 | 1 | -0/+10 |
|\ | |||||
| * | util.stanza: Add method for removing all children with a specific name, xmlns | Kim Alvefur | 2018-07-08 | 1 | -0/+10 |
| | | |||||
* | | util.stanza: Remove redundant check from :text now done in :add_direct_child | Kim Alvefur | 2018-06-08 | 1 | -1/+0 |
| | | |||||
* | | util.stanza: Verify that other objects added as children are valid strings | Kim Alvefur | 2018-06-08 | 1 | -1/+4 |
| | | |||||
* | | util.stanza: Verify that child tags added are really stanzas (closes #1165) | Kim Alvefur | 2018-06-08 | 1 | -1/+1 |
| | | |||||
* | | util.stanza: Add :text_tag(), a shortcut for adding nodes with text | Kim Alvefur | 2018-03-21 | 1 | -0/+4 |
| | | |||||
* | | util.stanza: Allow :text(nil) and :text("") as harmless nops | Matthew Wild | 2018-03-21 | 1 | -3/+5 |
| | | |||||
* | | util.stanza: Switch from asserts to if's, improve performance, errors and tests | Matthew Wild | 2018-03-18 | 1 | -18/+32 |
| | | |||||
* | | util.stanza: Add stricter validation for data passed to stanza builder API | Matthew Wild | 2018-03-16 | 1 | -0/+29 |
| | | |||||
* | | vairious: Add annotation when an empty environment is set [luacheck] | Kim Alvefur | 2018-02-28 | 1 | -0/+1 |
| | | |||||
* | | util.stanza: Change __type to __name as this is used by Lua 5.3 in some ↵ | Kim Alvefur | 2018-02-16 | 1 | -1/+1 |
| | | | | | | | | error reporting functions | ||||
* | | util: Various minor changes to please [luacheck] | Kim Alvefur | 2017-11-10 | 1 | -1/+7 |
| | | |||||
* | | Merge 0.10->trunk | Kim Alvefur | 2016-12-02 | 1 | -0/+6 |
|\| | |||||
| * | util.stanza: Add an is_stanza() function to check if an object is a stanza | Kim Alvefur | 2016-11-28 | 1 | -0/+6 |
| | |