Contacts appearing offline when they are online

All of my contacts are set to auto accept subscriptions

If I delete a contact from A’s list when both A and B are online

logout of B

add B to A’s list

B will be seen as online

login as B

A does not appear in B’s list

logout as B

B will apear offline in A’s list

login as B

A will apear offline in B’s list

B will apear online in A’s list

If spark allowed multiple versions of itself I may be able to test all parts in spark, but So far A appearing offline in B’s list can be seen in spark. Presence packets are just not received for A, Other contacts such as C work fine.

Do I have to send presence packets manually?

-Mandy

Note: It seems that contacts appearing online after adding was a bug in my code But the whole not showing up in spark thing still has me stumped.

flutterby wrote:

Do I have to send presence packets manually?

You should indeed send an initial presence right after logging in. Either use

public void login(String username,
                  String password)
                throws XMPPException

Logs in to the server using the strongest authentication mode supported by the server, then sets presence to available. If more than five seconds (default timeout) elapses in each step of the authentication process without a response from the server, or if an error occurs, a XMPPException will be thrown.

Parameters:

username - the username.

password - the password.

Throws:

XMPPException - if an error occurs.

and send your own Presence after or

public void login(String username,
                  String password,
                  String resource,
                  boolean sendPresence)
                throws XMPPException

Logs in to the server using the strongest authentication mode supported by the server. If the server supports SASL authentication then the user will be authenticated using SASL if not Non-SASL authentication will be tried. An available presence may optionally be sent. If sendPresence is false, a presence packet must be sent manually later. If more than five seconds (default timeout) elapses in each step of the authentication process without a response from the server, or if an error occurs, a XMPPException will be thrown.

Before logging in (i.e. authenticate) to the server the connection must be connected. For compatibility and easiness of use the connection will automatically connect to the server if not already connected.

Parameters:

username - the username.

password - the password.

resource - the resource.

sendPresence - if true an available presence will be sent automatically after login is completed.

Throws:

XMPPException - if an error occurs.

IllegalStateException - if not connected to the server, or already logged in to the serrver.