将XMPPPresence更改为Away / Busy / Invisible [英] Change XMPPPresence to Away/Busy/Invisible

查看:213
本文介绍了将XMPPPresence更改为Away / Busy / Invisible的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do you change your presence to show dnd/away and etc.?

XMPPPresence *presence = [XMPPPresence presenceWithType:status];
[[[self appDelegate] xmppStream] sendElement:presence];

status NSString 我设置为在线/不可用/离开/忙/不可见。

status is an NSString that I set to online/unavailable/away/busy/invisible.

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

It only works when I go online and/or unavailable.

以下是我在 xmppStream中发送状态后的样子

<presence type="away"><x xmlns="vcard-temp:x:update"><photo/></x></presence>


推荐答案

要更改客户的状态,您需要使用这个简单的代码:

To change the status of your client you will need to use this simple code:

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

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

This simply means that the key to change the status of your client is by adding a status element to your presence. Please note that the openfire server will only show the "available/Offline" status when you hover on the user icon in the admin panel. This should not confuse you though. You can simply check the presence message sent by your client and received by the others which will show on of the status you have set ("online/unavailable/away/busy/invisible").

这篇关于将XMPPPresence更改为Away / Busy / Invisible的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆