Chat-O-Matic/application/Contact.cpp
Jaidyn Ann 6c43311982 Program-wide avatar cache
Add a program-wide avatar cache― whenever a contact or user's avatar has
changed, it gets cached in ~/config/settings/Caya/Cache/$account/People
(for contacts) or $account/Users (for everyone else).

ImageCache is now used, only for caching the kPersonIcon resource image―
it might be useful later for other commonly used images (status
indicators, etc).

Fixes #4
2021-06-13 17:34:30 -05:00

52 lines
953 B
C++

/*
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
* Copyright 2012, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Andrea Anzani, andrea.anzani@gmail.com
* Dario Casalinuovo
*/
#include "Contact.h"
#include "CayaUtils.h"
#include "ProtocolLooper.h"
#include "RosterItem.h"
Contact::Contact(BString id, BMessenger msgn)
:
User::User(id, msgn)
{
fRosterItem = new RosterItem(id.String(), this);
RegisterObserver(fRosterItem);
}
RosterItem*
Contact::GetRosterItem() const
{
return fRosterItem;
}
void
Contact::SetNotifyAvatarBitmap(BBitmap* bitmap)
{
User::SetNotifyAvatarBitmap(bitmap);
// if (fAvatarBitmap != NULL && fChatWindow != NULL)
// fChatWindow->UpdateAvatar();
}
void
Contact::_EnsureCachePath()
{
if (fCachePath.InitCheck() == B_OK)
return;
fCachePath.SetTo(CayaContactCachePath(fLooper->Protocol()->GetName(),
fID.String()));
}