Uploaded image for project: 'ejabberd development'
  1. ejabberd development
  2. EJAB-673

Support of collection node subscription options

    Details

      Description

      Currently one can subscribe to collection node, but not with options. There exists 2 options specific to collection nodes: pubsub#subscription_type and pubsub#subscription_depth.

      The XEP-0060 writes about this [1]:

      A service that implements collection nodes SHOULD allow entities to subscribe to collection nodes (subject to access models and local security policies).

      In addition to the subscription configuration options already defined, there are two subscription configuration options specific to collection nodes:

      So let's say this is not a bug, nor a new feature, but an improvement (else change issue type).
      Currently if I try to subscribe to a collection node with these options, it is rejected:

      <iq type='set'
          from='test@localhost.net/Gajim'
          to='pubsub.localhost.net'
          id='collsub2'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <subscribe jid='test@localhost.net'
      	       node='home/localhost.net/supertest/somenode/superblog2/comments'/>
          <options>
            <x xmlns='jabber:x:data' type='submit'>
      	<field var='FORM_TYPE' type='hidden'>
      	  <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
      	</field>
      	<field var='pubsub#subscription_type'>
      	  <value>items</value>
      	</field>
      	<field var='pubsub#subscription_depth'>
      	  <value>all</value>
      	</field>
            </x>
          </options>
        </pubsub>
      </iq>
      
      <iq from='pubsub.localhost.net'
          to='test@localhost.net/Gajim'
          type='error' xml:lang='fr'
          id='collsub2'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <subscribe jid='test@localhost.net'
      	       node='home/localhost.net/supertest/somenode/superblog2/comments'/>
          <options>
            <x xmlns='jabber:x:data' type='submit'>
      	<field var='FORM_TYPE' type='hidden'>
      	  <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
      	</field>
      	<field var='pubsub#subscription_type'>
      	  <value>items</value>
      	</field>
      	<field var='pubsub#subscription_depth'>
      	  <value>all</value>
      	</field>
            </x>
          </options>
        </pubsub>
        <error code='400' type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
      

      If I do the same, without the options, it works.

      <iq type='set'
          from='test@localhost.net/Gajim'
          to='pubsub.localhost.net'
          id='collsub2'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <subscribe jid='test@localhost.net'
      	       node='home/localhost.net/supertest/somenode/superblog2/comments'/>
        </pubsub>
      </iq>
      
      <iq from='pubsub.localhost.net'
          to='test@localhost.net/Gajim'
          id='collsub2'
          type='result'>
        <subscription node='/home/localhost.net/supertest/somenode/superblog2/comments'
      		jid='test@localhost.net'
      		subscription='subscribed'
      		subid='4BE65CA677F5'/>
      </iq>
      
      <message from='pubsub.localhost.net' to='test2@localhost.net'>
        <event xmlns='http://jabber.org/protocol/pubsub#event'>
          <items node='/home/localhost.net/supertest/somenode/superblog2/comments'/>
        </event>
      </message>
      

      But then I don't receive the items published in /home/localhost.net/supertest/somenode/superblog2/comments and I am so sad about this.

      [1] http://www.xmpp.org/extensions/xep-0060.html#collections-subscribe

        Issue Links

          Activity

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development