gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 12:57:42 25 4
gpt4 key购买 nike

我正在研究 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com