ios - xmpp 书签 xep-0048 -- 服务器未添加书签

标签 ios xmpp bookmarks ejabberd xmppframework

我正在研究 MUC,为此我想为已加入的房间添加书签。为此,我使用了 xep-0048 扩展名,并且服务器文档显示我创建了相同的 iq 请求,但书签似乎不起作用。

以下是我的智商要求

 <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>

当我向服务器发送此请求时,我从服务器收到以下响应。

  <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>

当我发送 iq 请求以检索书签时,我也得到了相同的响应。

如果我遗漏了什么,请告诉我。

提前致谢。

最佳答案

使用这个函数发送请求

   [xmppStream sendElement:iq];

并按如下方式创建您的 iqbookmark 对象

   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];

关于ios - xmpp 书签 xep-0048 -- 服务器未添加书签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20629658/

相关文章:

google-chrome - 覆盖 Chrome 中的书签快捷键 (Ctrl+D) 功能

Facebook - 仪表板问题,重新加载页面后计数器重置

ios - 更改未分段控件时不会加载 Tableview 数据

objective-c - UINavigationController 内 UITabBarController 的间隙

ios - 如何在父 TapGestureRecognizer 之前触发 UIButton 目标事件

xmpp - 使用XMPP-PEP/PubSub进行传感器读数

iphone - ejabberd mod_offline iPhone推送通知

iOS 从 safari(或其他应用程序)返回

java - 文件传输xmpp中主机="null"

javascript - 添加一个 "bookmark page"带 Angular 按钮