gpt4 book ai didi

ios - 如何使用 objective-c 拒绝xmpp群聊接收邀请

转载 作者:行者123 更新时间:2023-11-29 00:42:38 24 4
gpt4 key购买 nike

这里附上代码:

NSXMLElement *imessage = [NSXMLElement elementWithName:@"message"];
[imessage addAttributeWithName:@"from" stringValue:[[xmppStream myJID]full]];
[imessage addAttributeWithName:@"to" stringValue:roomName];

NSXMLElement *xelem = [NSXMLElement elementWithName:@"x" xmlns:XMPPMUCUserNamespace];

NSXMLElement *decline = [NSXMLElement elementWithName:@"decline"];
[decline addAttributeWithName:@"to" stringValue:roomName];
NSXMLElement *reason = [NSXMLElement elementWithName:@"reason"];
[reason setStringValue:@"Sorry Dear, I can not join right now."];
[decline addChild:reason];

[xelem addChild:decline];

[imessage addChild:xelem];

任何人都可以解决 [Whats my mistake]。

最佳答案

我终于找到了问题的答案:

这是我的代码:

    NSXMLElement *decline = [NSXMLElement elementWithName:@"decline"];
[decline addAttributeWithName:@"to" stringValue:@"Sender JID"];
if (reason)
{
[decline addChild:reason];
}

NSXMLElement *x = [NSXMLElement elementWithName:@"x" xmlns:XMPPMUCUserNamespace];
[x addChild:decline];

NSXMLElement *message = [XMPPMessage message];
[message addAttributeWithName:@"to" stringValue:Roomname];
[message addChild:x];

[xmppStream sendElement:message];

关于ios - 如何使用 objective-c 拒绝xmpp群聊接收邀请,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39092732/

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