Question

I am working on the MUC and for that i want to bookmark the room user have joined. for that I have used xep-0048 extension and as server document shows I have create same iq request but seems like bookmark is not working.

Folloing is my iq request

 <iq type="set" id="pip1" from="jid@server.local">
 <pubsub xmlns="http://jabber.org/protocol/pubsub">
 <publish node="storage:bookmarks">
  <item id="current">
  <storage xmlns="storage:bookmarks">
  <conference name="roomExample1" autojoin="true" jid="roomExample1@conference.server.local">               
  <nick>satish</nick>
  </conference>
   </storage>
  </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>true</value>
  </field>
<field var="pubsub#access_model">
 <value>whitelist</value>
 </field>
 </x>
 </publish-options>
 </pubsub>
</iq>

When I send this request to server i get the following response from server.

  <iq xmlns="jabber:client" from="jid@server.local" to="jid@server.local/14748802401387269663600179" id="pip1" type="result">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
  <publish node="storage:bookmarks">
   <item id="current"/>
  </publish>
  </pubsub>
   </iq>

I am also getting the same response when i send iq request to retrieve the bookmark.

If I am missing anything please let me know.

Thanks in advance.

Était-ce utile?

La solution

send request using this function

   [xmppStream sendElement:iq];

and create your iqbookmark object as follows

   NSString* server = @"test@pc"; //or whatever the server address for muc is
   XMPPJID *servrJID = [XMPPJID jidWithString:server];
   XMPPIQ *iq = [XMPPIQ iqWithType:@"set" to:servrJID];
//  [iq addAttributeWithName:@"from" stringValue:[xmppStream myJID].full];
[iq addAttributeWithName:@"id" stringValue:@"123"];
NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
[query addAttributeWithName:@"xmlns" stringValue:@"jabber:iq:private"];
NSXMLElement *storage_q = [NSXMLElement elementWithName:@"storage"];
[storage_q addAttributeWithName:@"xmlns" stringValue:@"storage:bookmarks"];

NSXMLElement *conference_s = [NSXMLElement elementWithName:@"conference"];
[conference_s addAttributeWithName:@"name" stringValue:@"roomExample1_satish"];
[conference_s addAttributeWithName:@"autojoin" stringValue:@"true"];
[conference_s addAttributeWithName:@"jid" stringValue:@"roomExample1@conference.test@pc"];
[conference_s addAttributeWithName:@"nick" stringValue:@"satish"];
[storage_q addChild:conference_s];
[query addChild:storage_q];
[iq addChild:query];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top