你如何改变你的存在以显示 dnd/away 等等?

XMPPPresence *presence = [XMPPPresence presenceWithType:status];
[[[self appDelegate] xmppStream] sendElement:presence];
status 是一个 NSString,我设置为 online/unavailable/away/busy/invisible。

它仅在我上线和/或不可用时有效。

这是在我的 xmppStream 中发送状态后的样子:
<presence type="away"><x xmlns="vcard-temp:x:update"><photo/></x></presence>

最佳答案

要更改客户端的状态,您需要使用以下简单代码:

XMPPPresence *presence = [XMPPPresence presence];
NSXMLElement *status = [NSXMLElement elementWithName:@"status"];
[status setStringValue:@"online/unavailable/away/busy/invisible"];
[presence addChild:status];
[[self xmppStream] sendElement:presence];

这只是意味着改变客户状态的关键是在你的状态中添加一个状态元素。请注意,当您将鼠标悬停在管理面板中的用户图标上时,openfire 服务器只会显示“可用/离线”状态。不过,这不应该让您感到困惑。您可以简单地检查由您的客户端发送并由其他人接收的状态消息,这些消息将显示您设置的状态(“在线/不可用/离开/忙碌/不可见”)。

关于ios - 将 XMPPPresence 更改为离开/忙碌/不可见,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8047221/

10-11 14:50