Kim Alvefur
50f360a506
util.pubsub: Clarify comment about return value
7 years ago
Matthew Wild
7335fe3488
util.pubsub: Allow publishing with a config that should be used as defaults only
7 years ago
Kim Alvefur
418bf0b73f
util.pubsub: Expand comment on return type from get_items
7 years ago
Kim Alvefur
59b9a3eb3f
util.pubsub: Explicitly add all capabilities to the 'outcast' affiliation for completeness
7 years ago
Kim Alvefur
752ae5a693
util.pubsub: Comments describing the return values of methods
8 years ago
Matthew Wild
15d8f1c004
util.pubsub: Add 'service' field to all events
8 years ago
Kim Alvefur
d11fa0d993
util.pubsub: Remove unused argument
...
I think this was probably a copy-paste mistake.
8 years ago
Matthew Wild
a1cc1b4065
util.pubsub: Fire item-published/<node> to allow for easier handling of per-node items
8 years ago
Matthew Wild
7fdb4cf5e4
util.pubsub, pubsub.lib: Improve error on attempt to publish invalid item
8 years ago
Matthew Wild
84a825533f
Pubsub: Add tests for :get_last_item() and fix for non-persistent nodes
8 years ago
Matthew Wild
38c448b460
util.pubsub: Fix whitespace [luacheck]
8 years ago
Matthew Wild
a1c779a3eb
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
2282b01839
util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
8 years ago
Matthew Wild
678f4c2c78
util.pubsub: get_last_item(): Return error if node does not exist
8 years ago
Matthew Wild
e3daae729d
pubsub.lib, util.pubsub: Move precondition checks to util.pubsub
8 years ago
Matthew Wild
619798a8d9
util.pubsub: Add comment to clarify return values
8 years ago
Kim Alvefur
d4dd6144b0
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
Matthew Wild
f8dc8b6aa8
util.pubsub: Allow outcasts to get their subscription status
8 years ago
Matthew Wild
5b87c4bb4b
util.pubsub: For open nodes, default affiliation is "member"
...
This allows entities without an explicit affiliation to retrieve items,
which is specified by the XEP. Table 6: "Node Access Models" states that
for 'open' nodes, "any entity may retrieve items from the node".
See also discussion at:
https://mail.jabber.org/pipermail/standards/2018-August/035320.html
8 years ago
Matthew Wild
a657fb3dc9
mod_pep, util.pubsub: Rename restricted->outcast, none->member and add new 'none' affiliation to better match XEP-0060
8 years ago
Matthew Wild
c5a1a67f45
mod_pubsub, mod_pep, util.pubsub: Move capability definitions into util.pubsub to avoid duplication
8 years ago
Kim Alvefur
85d9a2d09c
util.pubsub: Include node defaults from current service object
8 years ago
Kim Alvefur
ae8176a49c
util.pubsub: Re-check all subscriptions on access_model change, unsubscribing those no longer allowed
8 years ago
Matthew Wild
33a2c85401
util.pubsub: Add support for publish_model config option
8 years ago
Kim Alvefur
54ad499479
util.pubsub: Apply defaults metatable before config check (thanks pep.)
...
Makes it so that the callback sees the default if it?s not in the form,
which makes it easier to validate.
8 years ago
Matthew Wild
dad630943d
util.pubsub: Add method to retrieve node configuration
8 years ago
Matthew Wild
4fc4e76c83
util.pubsub: Use service.node_defaults in case config.node_defaults was not provided (thanks jonasw)
8 years ago
Matthew Wild
671694c5e7
util.pubsub: Tweak default affiliation of access models (fixes failing test)
...
11:56:59 MattJ> Someone who has the ability to subscribe does not have the "subscriber"
affiliation until they actually subscribe, they just have the normal "none" affiliation
(which has permission to subscribe)
11:58:05 MattJ> However if the access model is whitelist, then anyone not on the whitelist
has an implicit negative affiliation, which we don't currently have, so I just named "restricted"
11:58:16 MattJ> Since it doesn't exist in any code yet, it has no permissions
8 years ago
Kim Alvefur
e876d5fc91
util.pubsub: Look for a configured callback for more complicated access models
8 years ago
Kim Alvefur
9fb89137a3
util.pubsub: Add initial support for configurable access models
8 years ago
Matthew Wild
3072e92438
util.pubsub: Add support for a config validation function
8 years ago
Kim Alvefur
cde6dca2f7
util.pubsub: Support for returning *all* subscriptions
8 years ago
Kim Alvefur
1de991a04a
util.pubsub: Return error code known by pubsub.lib if persistent creation fails
8 years ago
Kim Alvefur
6d639a75d4
util.pubsub: Store subscription changes
8 years ago
Kim Alvefur
4d6226b9eb
util.pubsub: Persistence on affiliation change
8 years ago
Kim Alvefur
d61f5d7c91
util.pubsub: Remove node from persistent storage on deletion
8 years ago
Kim Alvefur
6e78607820
util.pubsub: Persist nodes on configuration change
8 years ago
Kim Alvefur
994e4de82c
util.pubsub: Fix applying per service node defaults when loading from nodestore
8 years ago
Kim Alvefur
aebde06b1d
util.pubsub: Fix typo
8 years ago
Kim Alvefur
52de579592
util.pubsub: Normalize JID used as affiliation
...
XEP-0060 4.1 Affiliations
> All affiliations MUST be based on a bare JID
8 years ago
Kim Alvefur
bf88bf5c59
util.pubsub: Also check for affiliation set on bare JID
...
This fixes eg publishing from a full JID when the affiliation has been
set on the bare JID, as would be common in XMPP.
8 years ago
Kim Alvefur
994723d886
util.pubsub: Pass node and service objects to broadcaster to allow eg config access
8 years ago
Kim Alvefur
9c4ad79120
util.pubsub: Add a default/fallback JID normalization function
8 years ago
Kim Alvefur
ee9a168e80
util.pubsub: Don't record the superuser as owner on creation
...
No need to be set as owner, it has all privileges anyways. Since it?s a
boolean instead of a string, its presence may cause weirdness in other
code expecting all affiliations to be string JIDs.
8 years ago
Kim Alvefur
3096a0770c
util.pubsub: Allow setting a callback for validating items to be published
8 years ago
Matthew Wild
1cebb3d7ff
util.pubsub: Support a 'nodestore' for persisting nodes (same API as kv stores)
8 years ago
Matthew Wild
c9dcb71c68
util.pubsub: Move service methods object creation (just code reorganisation)
8 years ago
Matthew Wild
2881279d6b
util.pubsub: For clarity, split config tables from their metatables
8 years ago
Kim Alvefur
5bafb3680d
util.pubsub: Recreate itemstore if persist_items changes or resize it if max_items changes
8 years ago
Kim Alvefur
11b0084551
util: Various minor changes to please [luacheck]
8 years ago