[ejabberd] Create PubSub Collection

kael ka-el at laposte.net
Thu Feb 11 15:50:41 MSK 2010


On 02/11/2010 01:00 PM, Guillaume Ludmann wrote:
> Hi,

Hello,

> I'm using ejabberd v2.1.2 and I would create a pubsub tree like this :
> (root) --> toto --> titi --> info (leaf)
>                         |          \-> ticket (leaf)
>                         \-> tutu --> info (leaf)
>                                       \-> ticket (leaf)

Modify ejabberd.cfg with :

> My ejabberd pubsub config is :
>  {mod_pubsub,   [ % requires mod_caps
>           {access_createnode, pubsub_createnode},
>           {ignore_pep_from_offline, true},
>           {last_item_cache, false},
>           {plugins, ["flat", "hometree", "pep"]}
             {plugins, ["dag", "hometree"]}]}, %% To replace
             {nodetree, "dag"},                %% To add
>          ]},
> 
> How can I create a collection node?

1. Create a 'toto' collection node attached to the (implicit) root 
collection node :

<iq type='set' to='pubsub.localhost'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
   <create node='toto'/>
   <configure>
    <x xmlns='jabber:x:data' type='submit'>
     <field var='FORM_TYPE' type='hidden'>
      <value>http://jabber.org/protocol/pubsub#node_config</value>
     </field>
     <field var='pubsub#node_type'><value>collection</value></field>
     <field var='pubsub#collection'><value/></field>
    </x>
   </configure>
  </pubsub>
</iq>

2. Create a 'titi' collection node attached to the 'toto' collection node :

<iq type='set' to='pubsub.localhost'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
   <create node='titi'/>
   <configure>
    <x xmlns='jabber:x:data' type='submit'>
     <field var='FORM_TYPE' type='hidden'>
      <value>http://jabber.org/protocol/pubsub#node_config</value>
     </field>
     <field var='pubsub#node_type'><value>collection</value></field>
     <field var='pubsub#collection'><value>toto</value></field>
    </x>
   </configure>
  </pubsub>
</iq>

3. Create a 'info' leaf node attached to the 'titi' collection node :

<iq type='set' to='pubsub.localhost'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
   <create node='info'/>
   <configure>
    <x xmlns='jabber:x:data' type='submit'>
     <field var='pubsub#collection'><value>titi</value></field>
    </x>
   </configure>
  </pubsub>
</iq>


-- 
kael



More information about the ejabberd mailing list