I receive periodic requests from implementors of XEP-0060 for an atomic action for subscribing to a node and retrieving the items published to the node. I see two ways to do this:
1. Include an items request along with the subscription request.
<iq type='set'
from='[EMAIL PROTECTED]/barracks'
to='pubsub.shakespeare.lit'
id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe
node='princely_musings'
jid='[EMAIL PROTECTED]'/>
<items/>
</pubsub>
</iq>
2. Include a subscription option of "retrieve-items" when subscribing
with configuration options:
<iq type='set'
from='[EMAIL PROTECTED]/barracks'
to='pubsub.shakespeare.lit'
id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe
node='princely_musings'
jid='[EMAIL PROTECTED]'/>
<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#retrieve-items'><value>1</value></field>
</x>
</options>
</pubsub>
</iq>
(I don't know if this is really a subscription option, since it applies
only to the initial subscription request, not anything about the
subscription in the long term.)
No matter how we structure the request, if the service supports this
functionality it would inform the client of successful subscription...
<iq type='result'
from='pubsub.shakespeare.lit'
to='[EMAIL PROTECTED]/barracks'
id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscription
node='princely_musings'
jid='[EMAIL PROTECTED]'
subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3'
subscription='subscribed'/>
<options>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>
http://jabber.org/protocol/pubsub#subscribe_options
</value>
</field>
<field var='pubsub#retrieve-options'><value>1</value></field>
</x>
</options>
</pubsub>
</iq>
The service would then also send the existing items...
<message from='pubsub.shakespeare.lit' to='[EMAIL PROTECTED]' id='foo'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='princely_musings'>
<item id='368866411b877c30064a5f62b917cffe'>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>The Uses of This World</title>
<summary>
O, that this too too solid flesh would melt
Thaw and resolve itself into a dew!
</summary>
<link rel='alternate' type='text/html'
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32396</id>
<published>2003-12-12T17:47:23Z</published>
<updated>2003-12-12T17:47:23Z</updated>
</entry>
</item>
</items>
</event>
</message>
<message from='pubsub.shakespeare.lit' to='[EMAIL PROTECTED]' id='bar'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='princely_musings'>
<item id='3300659945416e274474e469a1f0154c'>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Ghostly Encounters</title>
<summary>
O all you host of heaven! O earth! what else?
And shall I couple hell? O, fie! Hold, hold, my heart;
And you, my sinews, grow not instant old,
But bear me stiffly up. Remember thee!
</summary>
<link rel='alternate' type='text/html'
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32396</id>
<published>2003-12-12T23:21:34Z</published>
<updated>2003-12-12T23:21:34Z</updated>
</entry>
</item>
</items>
</event>
</message>
<message from='pubsub.shakespeare.lit' to='[EMAIL PROTECTED]' id='baz'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='princely_musings'>
<item id='4e30f35051b7b8b42abe083742187228'>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Alone</title>
<summary>
Now I am alone.
O, what a rogue and peasant slave am I!
</summary>
<link rel='alternate' type='text/html'
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32396</id>
<published>2003-12-13T11:09:53Z</published>
<updated>2003-12-13T11:09:53Z</updated>
</entry>
</item>
</items>
</event>
</message>
<message from='pubsub.shakespeare.lit' to='[EMAIL PROTECTED]' id='qux'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='princely_musings'>
<item id='ae890ac52d0df67ed7cfdf51b644e901'>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Soliloquy</title>
<summary>
To be, or not to be: that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them?
</summary>
<link rel='alternate' type='text/html'
href='http://denmark.lit/2003/12/13/atom03'/>
<id>tag:denmark.lit,2003:entry-32397</id>
<published>2003-12-13T18:30:02Z</published>
<updated>2003-12-13T18:30:02Z</updated>
</entry>
</item>
</items>
</event>
</message>
(The events could be sent in one message or in multiple messages.)
Thoughts?
Peter
smime.p7s
Description: S/MIME Cryptographic Signature
