[JDEV] "who is online?" with Net::Jabber

Ralph Siemsen ralphs at blueairnetworks.com
Thu Jan 30 09:40:58 CST 2003


Stefan Strigler wrote:

> How do I do this with Net::Jabber? How do I get the results of this query
> in a convenient way? (I "just" want to know who is online)

It's just a matter of logging in and sending the XML you posted.  I have 
a script that does this using Jabber::Connection (not Net::Jabber) if 
you are interested in that.

As for output, you'll have to figure out what format you want.  The 
jabber server will hand you back an XML packet like so:

<iq id='3' type='result' to='admin at jabber.org/test' 
from='jabber.org'><query xmlns='jabber:iq:admin'><who><presence 
from='ralphs at jabber.org/Exodus'><show>xa</show><priority/><x 
xmlns='jabber:x:delay' stamp='20030129T22:42:48' 
from='graeme at blueairnetworks.com/Exodus'/>
<presence [... from other users ...] />
</who></query></iq>

You can display this any way you want - just the usernames, or more 
complicated - depends on what you want.

-R




More information about the JDev mailing list