XMPPFramework:我可以确定用户的在线/离线状态吗? [英] XMPPFramework : can I determine the online/offline status of a user at all?

查看:667
本文介绍了XMPPFramework:我可以确定用户的在线/离线状态吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用XMPPFramework for iPhone确定用户是否在线/离线?



我有他们的JID等等。有没有办法请求存在或



谢谢。

解决方案

XMPPFramework示例项目的源代码?



如果我没记错,应该是相关的代码片段:

  //订阅好友的存在
//
//< presence to =bareJIDtype =subscribe/>

NSXMLElement * presence = [NSXMLElement elementWithName:@presence];
[presence addAttributeWithName:@tostringValue:[jid bare]];
[presence addAttributeWithName:@typestringValue:@subscribe];

[xmppStream sendElement:presence];

您的流委托获得的回调应为

   - (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence; 

我假设你已经有xmmpframework源代码,如果没有, p>

  hg clone https://xmppframework.googlecode.com/hg/ xmppframework 
pre>

示例项目位于Xcode文件夹中。


How would I determine if a user is online/offline using XMPPFramework for iPhone?

I have their JID etc etc. Is there a way of requesting a presence or something?

Thank you.

解决方案

Have you checked out the source code of the XMPPFramework sample project?

If I remember correctly, this should be the relevant code snippet:

// Subscribe to the buddy's presence
// 
// <presence to="bareJID" type="subscribe"/>

NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];
[presence addAttributeWithName:@"to" stringValue:[jid bare]];
[presence addAttributeWithName:@"type" stringValue:@"subscribe"];

[xmppStream sendElement:presence];

And the callback your stream delegate gets should be

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence;

I assume that you already have the xmmpframework source, if not, you can clone the repository here

hg clone https://xmppframework.googlecode.com/hg/ xmppframework

The sample projects are in the "Xcode" folder.

这篇关于XMPPFramework:我可以确定用户的在线/离线状态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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