如何使用libstrophe构建一个Jabber客户端 [英] How to build a jabber client using libstrophe

查看:663
本文介绍了如何使用libstrophe构建一个Jabber客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让使用 libstrophe 库一个简单的Jabber客户端。

I'm trying to make a simple Jabber client using the libstrophe library.

这是怎么回事相当不错,到目前为止,除了一件事,我需要一些澄清。

It's going fairly well so far, except for one thing for which I need some clarification.

也就是说,我怎么到(连续)知道联系人的状态(即在线/离线),这样我就可以把它显示我的程序的用户?同样的,我怎么要求用户名册?

Namely, how am I supposed to (continuously) know the status (i.e., Online/Offline) of contacts, so that I can display it to the user of my program? Similarly, how am I supposed to request the roster of the user?

我看了由libstrophe提供的 roster.c 的例子,但只打印出名册一次。在实际应用中,我需要请求/持续更新此,为了表现出任何新联系人的用户添加等,在应用程序中。

I've looked at the roster.c example provided by libstrophe, but that only prints out the roster once. In a real application, I'll need to request/update this continuously, in order to show any new contacts the user added, etc., in the application.

所以基本上,我对如何确保我始终显示人类最目前的阵容和最新的状态在我的用户的联系人列表不清楚。

So basically, I'm unclear on how to make sure that I always display the most current roster and most current statuses of people in my user's contact list.

我是不是应该在某个predefined时间间隔要求名册,例如?

Am I just supposed to request the roster at some predefined time interval, for example?

推荐答案

名册和presence 2个不同的主题。

roster and presence are 2 different topics.

当你登录你通常要求你正在做的已经名册。当您的联系人列表您的会话过程中改变,你收到了名册推与更新的联系人。这是一个节。如果另一个登录客户端操作名册我们的客户也没关系。

When you login you normally request the roster which you are doing already. When your contact lists changes during your session you get a roster push with the updated contact. This is an stanza. It doesn't matter if another logged in client manipulated the roster our your client.

在线状态调用所有订阅的联系人的presence有节的用武之地。

The online state called presence of all your subscribed contact comes in with stanzas.

您必须设置处理器是 xmpp_handler_add


  1. 在线状态,presence节

  2. 名册推,IQ节命名空间叽里咕噜的查询:IQ:名册

这篇关于如何使用libstrophe构建一个Jabber客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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