ProtoXEP: PubSub Node Filtering

Signed-off-by: Maxime “pep” Buquet <>
This commit is contained in:
Maxime “pep” Buquet 2022-02-01 23:06:18 +01:00
parent 1a58249bab
commit da38ae50c5
No known key found for this signature in database
1 changed files with 147 additions and 0 deletions

inbox/pubsub-filter.xml Normal file
View File

@ -0,0 +1,147 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<title>PubSub Type Filtering</title>
<abstract>This specification provides a way to filter PubSub nodes in a disco query.</abstract>
<type>Standards Track</type>
<initials>edhelas, pep</initials>
<remark><p>First draft.</p></remark>
<section1 anchor="intro" topic="Introduction">
<p>Implementations have been able to declare a <tt>pubsub#type</tt> attribute on PubSub nodes for about as long as &xep0060; has existed. This attribute doesnt seem to be widely used in the community though, maybe due to the vagueness of its description, that has recently changed, or the lack of features associated with it.</p>
<p>This specification provides a way for implementations to allow filtering on this attribute when discovering items on a PubSub service.</p>
<p>Filtering is particularly useful for example combined with &xep0277; and comment nodes that are created on the same service. When listing content nodes of a service, one may want to filter out comment nodes.</p>
<section1 anchor="reqs" topic="Requirements">
<li>Allow querying only a subset of nodes in a disco items request, in the form of allow/block</li>
<section1 anchor="usecases" topic="Use Cases">
<section2 anchor="support" topic="Discovering support">
<p>A service implementing this specification MUST advertize through &xep0030; a <tt>urn:xmpp:pubsub-filter:0</tt> feature.</p>
<section2 anchor="sending-a-disco-request" topic="Sending a disco request">
<p>While requesting disco#items on a PubSub service, an entity might want to only get nodes of certain <tt>pubsub#type</tt>. To do so, it may add a filter child of namespace <tt>urn:xmpp:pubsub-filter:0</tt> to the query element, containing a &xep0004; form with FORM_TYPE set to <tt>urn:xmpp:pubsub-filter:0</tt> and an <tt>allowed-types</tt> or <tt>blocked-types</tt> list-multi type field containing the various types it wants to filter.</p>
<p>When <tt>allowed-types</tt> is specified, a PubSub service MUST return nodes of matching <tt>pubsub#type</tt> in its response.</p>
<p>When <tt>blocked-types</tt> is specified, a PubSub service MUST return every node but those of matching <tt>pubsub#types</tt> in its response.</p>
<p>Both allowed and blocked fields MAY contain an empty value to designate nodes with an empty <tt>pubsub#type</tt>.</p>
<example caption='Requesting disco#items with only nodes of the following types, including empty ones'><![CDATA[<iq type='get'
<query xmlns='>
<filter xmlns='urn:xmpp:pubsub-filter:0'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<field type='list-multi' var='allowed-types'>
<p>If both the allowed and blocked fields are specified, a service MUST return an error of type <tt>modify</tt> containing a <tt>bad-request</tt> element in the <tt>urn:ietf:params:xml:ns:xmpp-stanzas</tt> namespace.</p>
<example caption='Error returned when a requesting entity includes both fields'><![CDATA[<iq type='error'
<error type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<section1 anchor="iana" topic="IANA Considerations">
<section1 anchor="registrar" topic="XMPP Registrar Considerations">
<section1 anchor="schema" topic="XML Schema">
<section2 anchor="urnxmpppubsub-filter0" topic="urn:xmpp:pubsub-filter:0">
The protocol documented by this schema is defined in
<xs:element name='filter'>
<xs:choice xmlns:xdata='jabber:x:data'>
<xs:element ref='xdata:x'/>