powered by Jive Software

Presence

Hi

I’'ve written this code which does not work, it keeps giving me a null presence. When the other user says Available it keeps saying null!

PacketFilter filter = new PacketTypeFilter (Presence.class);

JabberClient listener = new JabberClient ();

listener.start ();

connection.addPacketListener (listener, filter);

}

public void processPacket (Packet packet)

{

Presence presence = (Presence) packet;

String from = presence.getStatus ();

System.out.println ("From: " + from);

}

Any Ideas?

Thanks

Dilip

Dilip,

Please read the Javadocs. The getStatus method will often return null:

“Returns the status message of the presence update, or null if there is not a status. The status is free-form text describing a user’'s presence (i.e., “gone to lunch”).”

What you want to check instead is the presence mode and type.

Regards,

Matt