https://xmpp.org/extensions/xep-0060.html#publisher-publish-success-nodefull says
> If the service or node is configured so that there is a maximum number of items cached at the node and the maximum is reached when an item is published, the service MUST delete one of the existing items or reject the new item.
>
> The behaviour of the service is determined by the "pubsub#publish_node_full" option which may take one of the following values: "retract-oldest", "discard-oldest", or "reject".
But prosody ignores this option. If I try to set it to 'reject' and submit two items
<iq type="set" id="373b24d1cf964089b505628afc9d8d1a">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="test_db">
<item id="a">
<value xmlns="xmppnosqlsuperdb:x" value="1"/>
</item>
</publish>
<publish-options>
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#publish-options</value>
</field>
<field var="pubsub#persist_items">
<value>1</value>
</field>
<field var="pubsub#access_model">
<value>whitelist</value>
</field>
<field var="pubsub#publish_node_full">
<value>reject</value>
</field>
</x>
</publish-options>
</pubsub>
</iq>
<iq type="set" id="4f0931ade66441999fc167cfb027ab03">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="test_db">
<item id="b">
<value xmlns="xmppnosqlsuperdb:x" value="2"/>
</item>
</publish>
<publish-options>
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#publish-options</value>
</field>
<field var="pubsub#persist_items">
<value>1</value>
</field>
<field var="pubsub#access_model">
<value>whitelist</value>
</field>
<field var="pubsub#publish_node_full">
<value>reject</value>
</field>
</x>
</publish-options>
</pubsub>
</iq>
Then I expect to get an error. But I don't. Instead, I can query the node
<iq type="get" id="141efed9e5d4424f8614467684716b30">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="test_db"/>
</pubsub>
</iq>
and I get the 'b' item.
<iq type="result" id="141efed9e5d4424f8614467684716b30" to="test@kousu.ca/IbOyk7pOdM8r">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="test_db">
<item id="b">
<value xmlns="xmppnosqlsuperdb:x" value="2"/>
</item>
</items>
</pubsub>
</iq>
So it's is behaving as if "discard-oldest" is set.
Zash
on
Thanks for the report.
This part of XEP-0060 was added very recently in version 1.25.0 (2023-03-22) and at least I haven't even had time to read this part yet.
Any help would be appreciated, especially in the form of patches.
https://xmpp.org/extensions/xep-0060.html#publisher-publish-success-nodefull says > If the service or node is configured so that there is a maximum number of items cached at the node and the maximum is reached when an item is published, the service MUST delete one of the existing items or reject the new item. > > The behaviour of the service is determined by the "pubsub#publish_node_full" option which may take one of the following values: "retract-oldest", "discard-oldest", or "reject". But prosody ignores this option. If I try to set it to 'reject' and submit two items <iq type="set" id="373b24d1cf964089b505628afc9d8d1a"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <publish node="test_db"> <item id="a"> <value xmlns="xmppnosqlsuperdb:x" value="1"/> </item> </publish> <publish-options> <x xmlns="jabber:x:data" type="submit"> <field var="FORM_TYPE" type="hidden"> <value>http://jabber.org/protocol/pubsub#publish-options</value> </field> <field var="pubsub#persist_items"> <value>1</value> </field> <field var="pubsub#access_model"> <value>whitelist</value> </field> <field var="pubsub#publish_node_full"> <value>reject</value> </field> </x> </publish-options> </pubsub> </iq> <iq type="set" id="4f0931ade66441999fc167cfb027ab03"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <publish node="test_db"> <item id="b"> <value xmlns="xmppnosqlsuperdb:x" value="2"/> </item> </publish> <publish-options> <x xmlns="jabber:x:data" type="submit"> <field var="FORM_TYPE" type="hidden"> <value>http://jabber.org/protocol/pubsub#publish-options</value> </field> <field var="pubsub#persist_items"> <value>1</value> </field> <field var="pubsub#access_model"> <value>whitelist</value> </field> <field var="pubsub#publish_node_full"> <value>reject</value> </field> </x> </publish-options> </pubsub> </iq> Then I expect to get an error. But I don't. Instead, I can query the node <iq type="get" id="141efed9e5d4424f8614467684716b30"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <items node="test_db"/> </pubsub> </iq> and I get the 'b' item. <iq type="result" id="141efed9e5d4424f8614467684716b30" to="test@kousu.ca/IbOyk7pOdM8r"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <items node="test_db"> <item id="b"> <value xmlns="xmppnosqlsuperdb:x" value="2"/> </item> </items> </pubsub> </iq> So it's is behaving as if "discard-oldest" is set.
Thanks for the report. This part of XEP-0060 was added very recently in version 1.25.0 (2023-03-22) and at least I haven't even had time to read this part yet. Any help would be appreciated, especially in the form of patches.
Changes