On line Users

Is there a way to find the users that are online using smack? Thanks for your help.

Nick

We don’‘t currently support this, and I’'m not sure if there is a JEP for it. You might want to look at:

http://www.jabber.org/jeps/jep-0030.html

http://www.jabber.org/jeps/jep-0020.html

If anyone knows what specific JEP’'s would be used for this feature, that would be great.

Thanks,

Matt

I was just looking at this as well. According to the “Admin Guide” there are 2 ways to retrieve the list of online users (though both are admin-only functions and will probably stay that way for privacy concerns):

or:

<iq type=’‘get’’ to=’‘yourhostname/admin’’>

<query xmlns=’‘jabber:iq:browse’’/>

When I look at the Jabber Registrar (http://www.jabber.org/registrar/namespaces.html) I don’‘t see the jabber:iq:admin namespace in the list so my guess is that the jabber:iq:browse namespace is the way to go. However, if one looks at the documentation for “browse”, JEP-11, (http://www.jabber.org/jeps/jep-0011.html) there is no mention of the /admin resource. Which leads me to believe it’'s server specific.

I could be wrong, though…

John

The admin stuff is pretty jabberd specific. Jive Messenger doesn’‘t support the protocol because we’'ve found it much better to provide a web interface to server administration functions.

As Matt said earlier in the thread, the mainstream protocol to watch is disco (service discovery) JEP-0030. Browse (and agents) is still supported but is being (or will be) deprecated in favor of disco going forward.

As you’'ve guessed, getting online user status has the potential for security/privacy concerns. Anything that has the rights to access that information should probably be done in a server component.

From a pure client approach, you’‘d need to subscribe to a user’‘s roster in order to know their presence. This would require knowing the user names on a server… So it boils down to a similar model to email. As a pure client you can’‘t and shouldn’'t be able to know or guess users on the system. But you can search for them and subscribe to them (in the same way you create email mailing lists).

And of course, it would help to subscribe users if you’'re offering a ‘‘service’’ that would encourage them to sign up (and grant permission for the subscription)… like ‘‘joke of the day bot’’ or something.

-iain

And to follow-up on Iain’‘s message – I only roll things into Smack that Jive Messenger supports since that’'s what I use for testing and development. For now, your best bet will be to use the new 1.1 Smack daily builds so you can plug in your own IQ handling. There is more information about this in some recent threads.

Regards,

Matt

I have another question. If I know a user name, can i use smack to see if he is online? My guess is yes, but i want to be sure.

Thanks.

I have another question. If I know a user name, can i

use smack to see if he is online? My guess is yes,

but i want to be sure.

An XMPP server will only send presence information about users that you have a presence subscription to (generally, those people in your roster). The only other way to get presence information is if the other person sends their presence to you directly. If you do have a presence subscription, you can get the presence info from the roster class.

Regards,

Matt

I know it is a silly question but how do i send this info to jabber?

<iq type=’‘get’’ to=’‘yourhostname/admin’’>

<query xmlns=’‘jabber:iq:browse’’/>

And then how will i see the response? You mention that I must be the admin to see all the users. How do i become an admin or see the username and passwd?

Silly question but please help …

Nick.

Nick,

You’'ll want to use the new IQ providers functionality that is in the Smack 1.1 daily builds:

http://www.jivesoftware.com/xmpp/smack/dailybuilds.jsp

It will let you register a class to handle all incoming IQ packets of a certain type. There are a few threads in this forum that discuss this functionality, such as:

As for how to become an administrator – I’‘m not sure. You’'ll need to read the appropriate JEP to figure out the protocol.

Regards,

Matt

Sorry to bother you but I have more questions. Your instructions say to put the file smack.providers.xml to the WEB-INF dir of jar. You mean smack.jar? There isn’'t such a dir there. How can I use smack to send :

<iq type=’‘get’’ to=’‘yourhostname/admin’’>

<query xmlns=’‘jabber:iq:browse’’/>

to jabber server and then take the response?

Hope you can help me.

Nick

Nick,

You’'ll be creating some custom classes to send and receive the special IQ packets. Those classes should be put in a JAR, and in that JAR should go the providers file.

Regards,

Matt