Have a problem with agsXMPP. What I want to do, is connect to openfire server as "User1" (as example), check which users in my roster are online and return collection of ONLINE usernames. The problem is, that OnPresence event is the last event (based on my research), and it occures for each online user. But how can I know when it has finished checking all the online users, so I could finally return my ONLINE collection? Is there something like OnPresenceEnd event?

Please help!

有帮助吗?

解决方案

no there is nothing like that. The xmpp server sends every presence in its own stanza. And there is nothing in the XMPP protocol which would tell you that all initial presences are received now.

XMPP is an asynchronous protocol. When possible keep your code also asynchronous and update the presence after each OnPresence event.

其他提示

xcc.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(method_name1); xcc.OnRosterEnd += new ObjectHandler( method_name2); <---This is what you need

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top