Setting current registration status when an event is fired

cusax-fix
Damian Minkov 20 years ago
parent 85b8014f1e
commit 90b090dfc8

@ -36,6 +36,7 @@ public class OperationSetBasicInstantMessagingJabberImpl
* KeepAlive interval for sending packets
*/
private static long KEEPALIVE_INTERVAL = 180000l; // 3 minutes
/**
* The interval after which a packet is considered to be lost
*/
@ -463,7 +464,7 @@ boolean checkFirstPacket()
void fireUnregisterd()
{
jabberProvider.fireRegistrationStateChanged(
RegistrationState.UNREGISTERED,
jabberProvider.getRegistrationState(),
RegistrationState.CONNECTION_FAILED,
RegistrationStateChangeEvent.REASON_INTERNAL_ERROR, null);
}

@ -141,8 +141,6 @@ public void register(final SecurityAuthority authority)
if(connection.isAuthenticated())
{
currentConnectionState = RegistrationState.REGISTERED;
connection.getRoster().
setSubscriptionMode(Roster.SUBSCRIPTION_ACCEPT_ALL);
@ -383,6 +381,9 @@ void fireRegistrationStateChanged( RegistrationState oldState,
int reasonCode,
String reason)
{
// sets the new state
currentConnectionState = newState;
RegistrationStateChangeEvent event =
new RegistrationStateChangeEvent(
this, oldState, newState, reasonCode, reason);
@ -414,10 +415,9 @@ public void connectionClosed()
{
RegistrationState oldConnectionState = currentConnectionState;
currentConnectionState = RegistrationState.UNREGISTERED;
fireRegistrationStateChanged(
oldConnectionState,
currentConnectionState,
RegistrationState.UNREGISTERED,
RegistrationStateChangeEvent.REASON_USER_REQUEST, null);
}
@ -425,10 +425,9 @@ public void connectionClosedOnError(Exception exception)
{
RegistrationState oldConnectionState = currentConnectionState;
currentConnectionState = RegistrationState.UNREGISTERED;
fireRegistrationStateChanged(
oldConnectionState,
currentConnectionState,
RegistrationState.UNREGISTERED,
RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,
exception.getLocalizedMessage());
}

Loading…
Cancel
Save