Fixed problem with status information

cusax-fix
Damian Minkov 19 years ago
parent 5e1bc79b86
commit 1f2b2526ac

Binary file not shown.

@ -413,8 +413,16 @@ public void publishPresenceStatus(PresenceStatus status,
throw new IllegalArgumentException(
status + " is not a valid Msn status");
msnProvider.getMessenger().getOwner().
setStatus((MsnUserStatus)scToMsnModesMappings.get(status));
// if the contact list is inited set the state
// otherwise just set the init status
//(as if set the status too early the server does not provide
// any status information about the contacts in our list)
if(ssContactList.isInitialized())
msnProvider.getMessenger().getOwner().
setStatus((MsnUserStatus)scToMsnModesMappings.get(status));
else
msnProvider.getMessenger().getOwner().
setInitStatus((MsnUserStatus)scToMsnModesMappings.get(status));
}
/**

@ -66,6 +66,11 @@ public class ServerStoredContactListMsnImpl
private ContactListModListenerImpl contactListModListenerImpl
= new ContactListModListenerImpl();
/**
* indicates whether or not the contactlist is initialized and ready.
*/
private boolean isInitialized = false;
/**
* Creates a ServerStoredContactList wrapper for the specified BuddyList.
*
@ -82,6 +87,24 @@ public class ServerStoredContactListMsnImpl
this.parentOperationSet = parentOperationSet;
this.msnProvider = provider;
// listens for provider registered events to set the isInitialized state
// of the contact list
provider.addRegistrationStateChangeListener(
new RegistrationStateChangeListener()
{
public void registrationStateChanged(
RegistrationStateChangeEvent evt)
{
if (evt.getNewState() == RegistrationState.UNREGISTERED
|| evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED
|| evt.getNewState() == RegistrationState.CONNECTION_FAILED)
{
isInitialized = false;
}
}
}
);
}
/**
@ -678,6 +701,18 @@ void fireContactResolved( ContactGroup parentGroup,
SubscriptionEvent.SUBSCRIPTION_RESOLVED, contact, parentGroup);
}
/**
* Returns true if the contact list is initialized and
* ready for use, and false otherwise.
*
* @return true if the contact list is initialized and ready for use and false
* otherwise
*/
boolean isInitialized()
{
return isInitialized;
}
/**
* Wiats for init in the contact list and populates the contacts and fills or
* resolves our contact list
@ -692,7 +727,8 @@ public void contactListSyncCompleted(MsnMessenger messenger)
public void contactListInitCompleted(MsnMessenger messenger)
{
logger.trace("contactListInitCompleted");
printList();
isInitialized = true;
// printList();
// first init groups
MsnContactList contactList = messenger.getContactList();
MsnGroup[] groups = contactList.getGroups();

@ -82,7 +82,7 @@ public void start(BundleContext context)
{
// addTest(TestOperationSetPersistentPresence.suite());
//
// addTest(TestOperationSetBasicInstantMessaging.suite());
addTest(TestOperationSetBasicInstantMessaging.suite());
//
// addTest(TestOperationSetTypingNotifications.suite());
}

Loading…
Cancel
Save