- Fixes issue #780 (Online contact not displayed in the contact list).

- Fixes avatar refresh problem.
cusax-fix
Yana Stamcheva 16 years ago
parent 6460027774
commit bfdc99f475

@ -2056,4 +2056,14 @@ private static StoredProtoContactDescriptor findContactInList(
return null; return null;
} }
} }
/**
* Indicates that a new avatar is available for a <tt>MetaContact</tt>.
* @param evt the <tt>MetaContactAvatarUpdateEvent</tt> containing details
* of this event
*/
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
{
// TODO: Store meta contact avatar.
}
} }

@ -619,6 +619,9 @@ void addProtoContact(Contact contact)
this.protoContacts.add(contact); this.protoContacts.add(contact);
// Re-init the default contact.
defaultContact = null;
// if this is our firt contact and we don't already have a display // if this is our firt contact and we don't already have a display
// name, use theirs. // name, use theirs.
if (this.protoContacts.size() == 1 if (this.protoContacts.size() == 1

@ -817,10 +817,10 @@ public void changeMetaContactAvatar(MetaContact metaContact,
} }
byte[] oldAvatar = metaContact.getAvatar(true); byte[] oldAvatar = metaContact.getAvatar(true);
((MetaContactImpl)metaContact).cacheAvatar(protoContact, newAvatar); ((MetaContactImpl) metaContact).cacheAvatar(protoContact, newAvatar);
fireMetaContactEvent( fireMetaContactEvent(
new MetaContactAvatarUpdate(metaContact, oldAvatar, newAvatar)); new MetaContactAvatarUpdateEvent(metaContact, oldAvatar, newAvatar));
} }
/** /**
@ -2565,6 +2565,11 @@ else if (event instanceof MetaContactModifiedEvent)
{ {
listener.metaContactModified( (MetaContactModifiedEvent) event); listener.metaContactModified( (MetaContactModifiedEvent) event);
} }
else if (event instanceof MetaContactAvatarUpdateEvent)
{
listener.metaContactAvatarUpdated(
(MetaContactAvatarUpdateEvent) event);
}
} }
} }

@ -398,6 +398,8 @@ public void metaContactMoved(MetaContactMovedEvent evt)
public void metaContactRemoved(MetaContactEvent evt) public void metaContactRemoved(MetaContactEvent evt)
{} {}
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt) {}
/** /**
* Implements <tt>MetaContactListListener.metaContactRenamed</tt> method. * Implements <tt>MetaContactListListener.metaContactRenamed</tt> method.
* When a meta contact is renamed, updates all related labels in this * When a meta contact is renamed, updates all related labels in this

@ -217,6 +217,8 @@ public void metaContactMoved(MetaContactMovedEvent evt)
this.modifyGroup(evt.getOldParent()); this.modifyGroup(evt.getOldParent());
} }
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt) {}
/** /**
* Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model
* when a new meta contact group has been added. * when a new meta contact group has been added.

@ -328,6 +328,31 @@ public void run()
}); });
} }
/**
* Notifies the tree model, when the <tt>MetaContact</tt> avatar has been
* modified in the <tt>MetaContactListService</tt>.
* @param evt the <tt>MetaContactEvent</tt> that notified us
*/
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
{
final MetaContact metaContact = evt.getSourceMetaContact();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
if (currentFilter.isMatching(metaContact))
{
ContactNode contactNode
= treeModel.findContactNodeByMetaContact(metaContact);
if (contactNode != null)
treeModel.nodeChanged(contactNode);
}
}
});
}
/** /**
* Adds a contact node corresponding to the parent <tt>MetaContact</tt> if * Adds a contact node corresponding to the parent <tt>MetaContact</tt> if
* this last is matching the current filter and wasn't previously contained * this last is matching the current filter and wasn't previously contained

@ -13,7 +13,7 @@
* *
* @author Emil Ivov * @author Emil Ivov
*/ */
public class MetaContactAvatarUpdate public class MetaContactAvatarUpdateEvent
extends MetaContactPropertyChangeEvent extends MetaContactPropertyChangeEvent
{ {
/** /**
@ -23,11 +23,11 @@ public class MetaContactAvatarUpdate
* @param oldAvatar the new avatar just of this meta contact. * @param oldAvatar the new avatar just of this meta contact.
* @param newAvatar the old avatar that just got replaced or <tt>null</tt>. * @param newAvatar the old avatar that just got replaced or <tt>null</tt>.
*/ */
public MetaContactAvatarUpdate(MetaContact source, public MetaContactAvatarUpdateEvent(MetaContact source,
byte[] oldAvatar, byte[] oldAvatar,
byte[] newAvatar) byte[] newAvatar)
{ {
super(source, PROTO_CONTACT_AVATAR_UPDATE, oldAvatar, newAvatar); super(source, META_CONTACT_AVATAR_UPDATE, oldAvatar, newAvatar);
} }
/** /**

@ -119,4 +119,10 @@ public interface MetaContactListListener
*/ */
public void metaContactModified(MetaContactModifiedEvent evt); public void metaContactModified(MetaContactModifiedEvent evt);
/**
* Indicates that a new avatar is available for a <tt>MetaContact</tt>.
* @param evt the <tt>MetaContactAvatarUpdateEvent</tt> containing details
* of this event
*/
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt);
} }

@ -54,8 +54,8 @@ public abstract class MetaContactPropertyChangeEvent
* Indicates that the MetaContactEvent instance was triggered by the update * Indicates that the MetaContactEvent instance was triggered by the update
* of an Avatar for one of its encapsulated contacts. * of an Avatar for one of its encapsulated contacts.
*/ */
public static final String PROTO_CONTACT_AVATAR_UPDATE public static final String META_CONTACT_AVATAR_UPDATE
= "ProtoContactAvatarUpdate"; = "MetaContactAvatarUpdate";
/** /**
* Indicates that the meta contact has been modified. The old and new value * Indicates that the meta contact has been modified. The old and new value

@ -1235,5 +1235,15 @@ public void childContactsReordered(MetaContactGroupEvent evt)
{ {
collectedMetaContactGroupEvents.add(evt); collectedMetaContactGroupEvents.add(evt);
} }
/**
* Indicates that the avatar of a <tt>MetaContact</tt> has been updated.
* @param evt the <tt>MetaContactAvatarUpdateEvent</tt> containing
* details of this event
*/
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
{
collectedMetaContactGroupEvents.add(evt);
}
} }
} }

Loading…
Cancel
Save