aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
Commit message (Collapse)AuthorAgeFilesLines
* mod_pubsub: Pass metadata directly into formKim Alvefur2024-11-081-12/+11
| | | | | Reduces duplication and need to edit in two places when adding another metadata field.
* mod_pubsub: Use new metadata methodKim Alvefur2024-11-081-16/+9
| | | | | No longer bypasses access control to retrieve this config subset, which is also explicitly named in the service config now.
* mod_pubsub: Move precondition error wrangling out of util.pubsubKim Alvefur2024-10-291-3/+4
| | | | | | | | | Removes dependency on util.error from util.pubsub which was only used for this one special case. Line count reduction! Would be even nicer if templating could be done by util.error itself.
* mod_pubsub: Allow passing additional error contextKim Alvefur2024-10-271-4/+4
| | | | Sometimes it is useful to pass additional information along.
* mod_pubsub: Use error registryKim Alvefur2024-10-271-10/+5
| | | | | | | | | | This is what util.error was made for! This replaces the custom error stanza builder with common code in util.stanza that knows enough about util.error and namespaced errors. Some awkwardness remains in the way util.pubsub returns conflicting form fields.
* mod_pep: Implement 'roster' (group) access_modelKim Alvefur2023-12-031-0/+6
| | | | | | | Allows e.g. restricting your vcard4 to only family or similar. Notes: This does not include roster groups in the configuration form, so the client will have to get them from the actual roster.
* Merge 0.12->trunkKim Alvefur2023-07-101-1/+1
|\
| * mod_pubsub: Send correct jid attribute in disco#itemsKim Alvefur2023-07-081-1/+1
| | | | | | | | Fixes use in PEP where the JID does not equal the bare domain.
* | plugins: Prefix module imports with prosody namespaceKim Alvefur2023-03-241-7/+7
| |
* | mod_pubsub/pubsub.lib: Fix accidental name/var swap (thanks scansion)Matthew Wild2023-03-221-2/+2
| |
* | mod_pubsub, mod_pep: Support per-node configurable inclusion of publisherMatthew Wild2023-03-221-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This matches ejabberd's behaviour, using the 'pubsub#itemreply' config option. Although the current definition of this option in the specification is not as clear as it could be, I think matching what existing deployments do is the best option to resolve the ambiguity and reduce fragmentation. We should update the spec to be clearer about how to use and interpret this option. The 'expose_publisher' option for mod_pubsub is now an override (always expose or never expose). If unset, it will use the per-node config (which defaults to not exposing). Thanks to Link Mauve, edhelas and goffi for sparking this feature.
* | util.stanza: Add method for extracting a single attribute valueKim Alvefur2022-08-171-2/+1
| | | | | | | | | | | | | | | | | | 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.
* | compat: Remove handling of Lua 5.1 location of 'unpack' functionKim Alvefur2022-07-111-1/+1
|/
* mod_pubsub: Allow specifying the JID of the pubsub serviceKim Alvefur2021-12-071-1/+1
| | | | | This allows overriding it in cases where it is not equal to module.host, like say, in mod_pep
* mod_pubsub: Fix traceback in disco of non-existent node (thanks Martin)Kim Alvefur2021-11-131-2/+6
| | | | | | | In this case `ret` is a table not containing the node, which makes pubsub_error_reply() try to get an error template with that `ret` table as index, which returns a `nil` then passed to table.unpack, which in turn throws the error.
* mod_pubsub: Return proper errors for disco queries on nodesKim Alvefur2021-11-011-2/+4
| | | | | Previously this would return item-not-found, even when you could see the node in disco#items.
* mod_pubsub: Prevent max_items from being set to zeroKim Alvefur2021-10-201-0/+1
| | | | | | | Disable persistence instead if no items should be persisted. XEP-0060 is not entirely clear on what either of those option really mean.
* mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436Kim Alvefur2021-10-191-0/+16
| | | | | | | | Default left as 'never' in mod_pubsub to preserve the previous behavior. Unclear if this is desirable, but can always be changed later. In mod_pep this allows turning off the automatic resending of most recent item.
* mod_pubsub: Advertise support for 'max' as value for max_itemsKim Alvefur2021-09-151-0/+4
| | | | Ref #1643
* mod_pubsub/pubsub.lib: Export config forms for use by other modulesMatthew Wild2021-09-111-0/+3
| | | | In this case I need them for 227 import/export.
* mod_pubsub: Move reversal of item order in <items>Kim Alvefur2021-09-051-3/+9
| | | | | | | | | | | | Examples in XEP-0060 suggest that items should be listed in chronological order, but we get them from the archive in reverse order. However when requesting specific items by id the results keep that order and we don't want to flip it again. At some point it would likely be best to use the archive API directly instead of this util.cache-compatible wrapper.
* mod_pubsub: Add support for limiting result size #1608Kim Alvefur2021-09-051-1/+5
|
* util.pubsub: Signal that 'persistent-items' is unsupported when disabledKim Alvefur2021-07-221-0/+1
| | | | | | XEP-0060 says that this the way to indicate that 'persistent-items' is unsupported, but doesn't explicitly say if it being disabled in the node configuration also counts as unsupported.
* mod_pubsub: Respect 'expose publisher' setting in item retrievalKim Alvefur2021-07-251-1/+8
|
* mod_pubsub: Fix inclusion of publisher (fixes #1399)Kim Alvefur2019-05-011-2/+5
|
* mod_pubsub,mod_pep: Support "max" as 'pubsub#max_items'Kim Alvefur2021-06-091-4/+3
| | | | | | Fixes #1643 API change: The argument to archive_itemstore() changes type to integer
* mod_pubsub: Include <pubsub> with unsubscribe replyKim Alvefur2021-03-151-1/+7
| | | | | | | | | XEP-0060 6.2.2 This is a MAY but it makes it nice and symmetric with the subscription response. Reduces the need to remember which node you unsubscribed from. Explicit > implicit etc.
* mod_pubsub: Clarify kind of item store createdKim Alvefur2020-10-251-1/+1
| | | | | Planning to make this configurable, so good to distinguish it from future backends.
* mod_pubsub: Don't set store as metatableKim Alvefur2020-10-251-1/+1
| | | | | 'archive' is not a metatable here, so this has no effect. Remove since apparently nothing depends on this.
* mod_pubsub: Ignore an unused variable [luacheck]Kim Alvefur2019-12-231-0/+1
|
* util.pubsub, pubsub.lib and tests: Add text to precondition-not-met error ↵Matthew Wild2019-10-271-0/+4
| | | | (fixes #1455)
* mod_pubsub: Remove the unwanted check for @notify on <purge/>.Emmanuel Gil Peyrot2019-09-281-3/+2
| | | | | | This most likely was copied from the handling of <retract/>, where it actually is required by the spec (XEP-0060 §7.2.2.1), but this attribute doesn’t exist for purge.
* mod_pubsub: Eliminate dead codeKim Alvefur2019-07-251-8/+3
| | | | `data` is a stanza and always truthy
* mod_pubsub: Expose pubsub#access_model and pubsub#publish_model (fixes #1387)Kim Alvefur2019-07-061-0/+10
|
* mod_pubsub: Support requests for multiple items (fixes #1305)Kim Alvefur2019-01-281-3/+9
|
* mod_pubsub: Exclude value of FORM_TYPE from stored dataKim Alvefur2018-09-071-3/+3
|
* mod_pubsub: Fix dataforms error handlingKim Alvefur2018-09-011-8/+27
| | | | | The :data method returns the table holding parsed values always. The second return value is a table in case some fields had problems.
* mod_pubsub: Use dataforms validation to specify that max_items is an integerKim Alvefur2018-09-011-0/+1
|
* mod_pubsub: Use field mapping in util.dataformsKim Alvefur2018-09-011-75/+30
|
* mod_pubsub: Preserve current subscription options if given a partial formKim Alvefur2018-08-311-1/+2
|
* mod_pubsub: Add missing default value for deliver_payloadsKim Alvefur2018-08-191-0/+1
|
* mod_pubsub: Fix boolean value in formKim Alvefur2018-08-191-1/+1
|
* mod_pubsub: Add a semicolon for consistencyKim Alvefur2018-08-191-1/+1
|
* util.pubsub, pubsub.lib: Improve error on attempt to publish invalid itemMatthew Wild2018-08-181-0/+1
|
* Pubsub: Add tests for :get_last_item() and fix for non-persistent nodesMatthew Wild2018-08-181-2/+2
|
* pubsub.lib, util.pubsub: Move precondition checks to util.pubsubMatthew Wild2018-08-181-31/+3
|
* mod_pubsub: Advertise support for subscription-optionsKim Alvefur2018-08-181-1/+1
| | | | Initial support was added in d614003a82c1
* mod_pubsub: Advertise support for node meta-dataKim Alvefur2018-08-181-1/+1
| | | | Node metadata in disco initially added in b6cb0a8f75b1
* mod_pubsub: Add support for thin notifications (without the full payload)Kim Alvefur2018-08-161-0/+7
|
* mod_pubsub: Use the correct form fieldKim Alvefur2018-08-161-3/+3
|