UNAVAILABLE problem

Hi,

has nobody never encountered this problem?

When I make several status change, no problem with AVAILABLE, AWAY. I can go from one status to another. But when I set UNAVAILABLE, it’'s not possible anymore to get back to AWAY or AVAILABLE…

The status returned is always UNAVAILABLE

I use the following code:


this.presence.setType( Presence.Type.UNAVAILABLE );

this.presence.setStatus( “msg” );

this.connection.sendPacket( this.presence );


Can somedy tell me where is the problem?

thanks

ofupien,

I tried to reproduce the problem without success. I have two clients and I’'m able to switch from AVAILABLE to UNAVAILABLE and back to AVAILABLE with no problem. Every time I change the presence the other client receives the correct update.

Are you getting any error? Is your connection still active?

What do you mean when you say “The status returned is always UNAVAILABLE”? Are you receiving a packet presence with status UNAVAILABLE?

Regards,

– Gato

Well thats weird.

I tought that came from the private server I use, but I tried this on jabber.com.

I have the same problem.

When I say that the status returned is always UNAVAILABLE, I mean that if I have a user A and a user B.

On both, I have a PresenceListener.

when A gets away and back to available, B receives correct notification.

When A gets unavailable, B receives the correct notification.

But when A gets back to AWAY or available, B keeps on receiving an UNAVAILABLE notification.

My code is quite simple.

AMong others, I have the following methods:

public boolean setAWAY(String awayText ){

this.presence.setMode( Presence.Mode.AWAY );

this.presence.setStatus( awayText );

this.connection.sendPacket(this.presence);

return true;

}

public boolean setAVAILABLE ( String msg ){

this.presence.setMode( Presence.Mode.AVAILABLE );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

return true;

}

public boolean setUNAVAILABLE( String msg ){

this.presence.setType( Presence.Type.UNAVAILABLE );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

return true;

}

So I don’'t understand where is the problem.

I also have an invisible mode that has no effect:

this.presence.setMode( Presence.Mode.INVISIBLE );

this.presence.setStatus(msg);

this.connection.sendPacket( this.presence );

The connection is still on.

Ok, I’'ve checked the XML sent:


just connected

I’'ll be awayaway

I’'ll be awayinvisible

I’'m not availableinvisible

I’'m available


On the last presence, The status type is UNAVAILABLE wheareas I sent AVAILABLE using

this.presence.setMode( Presence.Mode.AVAILABLE );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

?!?!?!?

can you help?

For one thing, you can’‘t set a status message when the presence type is unavailable. Perhaps that’'s the cause of the problem.

Regards,

Matt

Sorry, I guess I solved my problem myself:

In fact, I have several methods:

public boolean setAWAY(String awayText ){

this.presence.setMode( Presence.Mode.AWAY );

this.presence.setStatus( awayText );

this.connection.sendPacket(this.presence);

return true;

}

public boolean setAVAILABLE ( String msg ){

this.presence.setMode( Presence.Mode.AVAILABLE );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

return true;

}

public boolean setUNAVAILABLE( String msg ){

this.presence.setType( Presence.Type.UNAVAILABLE );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

return true;

}

public boolean setDoNotDisturb( String msg ){

this.presence.setMode( Presence.Mode.DO_NOT_DISTURB );

this.presence.setStatus( msg );

this.connection.sendPacket( this.presence );

return true;

}

In my setUNAVAILABLE, I set the TYPE whereas in others I do not, I just set the MODE. So the type UNAVAILABLE is kept after.

To solve my problem, I just need to add

this.presence.setType( Presence.Type.AVAILABLE );

This was in fact my fault.

thanks