Make sure that the contact list really gets the images from the network and not only from the local cache.

cusax-fix
Emil Ivov 18 years ago
parent caeb76c051
commit 04d5a4c7e3

@ -518,8 +518,13 @@ public byte[] getAvatar(boolean isLazy)
{
Contact protoContact = iter.next();
String avatarPath = AVATAR_DIR + "/"
+ protoContact.getProtocolProvider().getProtocolName() + "/"
String accountUID = escapeSpecialCharacters(protoContact
.getProtocolProvider().getAccountID().getAccountUniqueID());
String avatarPath = AVATAR_DIR
+ File.separator
+ accountUID
+ File.separator
+ escapeSpecialCharacters(protoContact.getAddress());
cachedAvatar = getLocallyStoredAvatar(avatarPath);
@ -939,12 +944,14 @@ public List getDetails(String name)
public void storeAvatar( Contact protoContact,
byte[] avatarBytes)
{
String protocolName
= protoContact.getProtocolProvider().getProtocolName();
String accountUID = protoContact.getProtocolProvider()
.getAccountID().getAccountUniqueID();
accountUID = escapeSpecialCharacters(accountUID);
String avatarDirPath = AVATAR_DIR
+ File.separator
+ protocolName;
+ accountUID;
String escapedProtocolId
= escapeSpecialCharacters(protoContact.getAddress());

@ -841,7 +841,7 @@ public void changeMetaContactAvatar(MetaContact metaContact,
metaContact + " is not a MetaContactImpl instance.");
}
byte[] oldAvatar = metaContact.getAvatar(true);
byte[] oldAvatar = metaContact.getAvatar();
((MetaContactImpl)metaContact).storeAvatar(protoContact, newAvatar);
fireMetaContactPropertyChangeEvent(new MetaContactAvatarUpdate(

@ -21,7 +21,7 @@
/**
* The <tt>ChatContact</tt> is a wrapping class for the <tt>Contact</tt> and
* <tt>ChatRoomMember</tt> interface.
*
*
* @author Yana Stamcheva
*/
public class ChatContact
@ -49,7 +49,7 @@ public class ChatContact
/**
* Creates an instance of <tt>ChatContact</tt> by passing to it the
* <tt>Contact</tt> for which it is created.
*
*
* @param contact the <tt>Contact</tt> for which this <tt>ChatContact</tt>
* is created
*/
@ -57,11 +57,11 @@ public ChatContact(Contact contact)
{
this(null, contact);
}
/**
* Creates an instance of <tt>ChatContact</tt> by passing to it the
* corresponding <tt>MetaContact</tt> and <tt>Contact</tt>.
*
*
* @param metaContact the <tt>MetaContact</tt> encapsulating the given
* <tt>Contact</tt>
* @param contact the <tt>Contact</tt> for which this <tt>ChatContact</tt>
@ -82,11 +82,11 @@ public ChatContact(MetaContact metaContact, Contact contact)
if (name == null || name.length() < 1)
name = Messages.getI18NString("unknown").getText();
}
/**
* Creates an instance of <tt>ChatContact</tt> by passing to it the
* <tt>ChatRoomMember</tt> for which it is created.
*
*
* @param chatRoomMember the <tt>ChatRoomMember</tt> for which this
* <tt>ChatContact</tt> is created.
*/
@ -104,7 +104,7 @@ public ChatContact(ChatRoomMember chatRoomMember)
/**
* Returns the contact identifier.
*
*
* @return the contact identifier
*/
public String getAddress()
@ -114,18 +114,18 @@ public String getAddress()
/**
* Returns the contact name.
*
*
* @return the contact name
*/
*/
public String getName()
{
return name;
}
/**
* Returns the current presence status for single user chat contacts and
* null for multi user chat contacts.
*
*
* @return the current presence status for single user chat contacts and
* null for multi user chat contacts
*/
@ -145,29 +145,29 @@ public ImageIcon getStatusIcon()
/**
* Returns the <tt>ProtocolProviderService</tt> of the contact.
*
*
* @return the <tt>ProtocolProviderService</tt> of the contact
*/
public ProtocolProviderService getProtocolProvider()
{
return protocolProvider;
}
/**
* Returns the source contact. It could be an instance of <tt>Contact</tt>
* or <tt>ChatRoomMember</tt> interface.
*
*
* @return the source contact
*/
public Object getSourceContact()
{
return sourceContact;
}
/**
* Returns the avatar image corresponding to the source contact. In the case
* of multi user chat contact returns null.
*
*
* @return the avatar image corresponding to the source contact. In the case
* of multi user chat contact returns null
*/
@ -202,6 +202,9 @@ else if(contact != null)
if(contactImage != null)
{
Image image = ImageLoader.getBytesInImage(contactImage);
if(image == null)
return null;
return ImageUtils.scaleIconWithinBounds(
new ImageIcon(image),
AVATAR_ICON_WIDTH,
@ -211,7 +214,7 @@ else if(contact != null)
else
return null;
}
/**
* Returns <code>true</code> if this is the currently selected contact in
* the list of contacts for the chat, otherwise returns <code>false</code>.
@ -225,7 +228,7 @@ public boolean isSelected()
/**
* Sets this isSelected property of this chat contact.
*
*
* @param isSelected <code>true</code> to indicate that this contact would
* be the selected contact in the list of chat window contacts, otherwise -
* <code>false</code>

@ -277,4 +277,4 @@ public void checkServerTrusted(
{
}
}
}
}
Loading…
Cancel
Save