KVIrc
4.9.2
DeveloperAPIs
|
Avatar cache handling class. More...
#include <KviAvatarCache.h>
Public Member Functions | |
void | cleanup () |
Deletes the cache. More... | |
void | load (const QString &szFileName) |
Loads the cache. More... | |
const QString & | lookup (const KviIrcMask &mask, const QString &szNetwork) |
Search a user in the cache and returns the id of the avatar. More... | |
void | remove (const KviIrcMask &mask, const QString &szNetwork) |
Remove an avatar from the cache. More... | |
void | replace (const QString &szIdString, const KviIrcMask &mask, const QString &szNetwork) |
Replaces a cached avatar. More... | |
void | save (const QString &szFileName) |
Saves the cache. More... | |
Static Public Member Functions | |
static void | done () |
Destroys the avatar cache. More... | |
static void | init () |
Initializes the avatar cache. More... | |
static KviAvatarCache * | instance () |
Returns the instance of the avatar cache. More... | |
Public Attributes | |
KviPointerHashTable< QString, KviAvatarCacheEntry > * | m_pAvatarDict |
Protected Member Functions | |
KviAvatarCache () | |
Constructs the avatar cache object. More... | |
~KviAvatarCache () | |
Destroys the avatar cache object. More... | |
Static Protected Attributes | |
static KviAvatarCache * | m_pAvatarCacheInstance = nullptr |
Avatar cache handling class.
|
protected |
Constructs the avatar cache object.
References CACHE_DICT_SIZE, and m_pAvatarDict.
Referenced by init().
|
protected |
Destroys the avatar cache object.
References m_pAvatarDict.
void KviAvatarCache::cleanup | ( | ) |
Deletes the cache.
References KviPointerList< T >::append(), CACHE_GUARD_LEVEL, KviPointerList< T >::count(), KviPointerHashTableIterator< Key, T >::current(), KviPointerHashTableIterator< Key, T >::currentKey(), e, KviPointerList< T >::first(), KviPointerList< T >::insert(), kvi_time_t, kvi_unixTime, l, m_pAvatarDict, MAX_UNACCESSED_TIME, KviPointerList< T >::next(), s, KviPointerList< T >::setAutoDelete(), _KviAvatarCacheEntry::szIdString, _KviAvatarCacheEntry::tLastAccess, and KviPointerHashTableIterator< Key, T >::toFirst().
Referenced by replace().
|
static |
Destroys the avatar cache.
References m_pAvatarCacheInstance.
Referenced by KviApplication::~KviApplication().
|
static |
Initializes the avatar cache.
References KviAvatarCache(), and m_pAvatarCacheInstance.
Referenced by KviApplication::setup().
|
inlinestatic |
Returns the instance of the avatar cache.
Referenced by KviConsoleWindow::avatarChanged(), KviConsoleWindow::checkDefaultAvatar(), KviApplication::saveAvatarCache(), and KviApplication::setup().
void KviAvatarCache::load | ( | const QString & | szFileName | ) |
Loads the cache.
szFileName | The cache filename |
References KviPointerHashTableIterator< Key, T >::current(), KviPointerHashTableIterator< Key, T >::currentKey(), KviConfigurationFile::dict(), e, kvi_time_t, kvi_unixTime, m_pAvatarDict, MAX_AVATARS_IN_CACHE, MAX_UNACCESSED_TIME, KviConfigurationFile::Read, KviConfigurationFile::readEntry(), KviConfigurationFile::readUIntEntry(), KviConfigurationFile::setGroup(), _KviAvatarCacheEntry::szIdString, and _KviAvatarCacheEntry::tLastAccess.
Referenced by KviApplication::setup().
const QString & KviAvatarCache::lookup | ( | const KviIrcMask & | mask, |
const QString & | szNetwork | ||
) |
Search a user in the cache and returns the id of the avatar.
mask | The mask of the user |
szNetwork | The network where the user is on |
References e, KviQString::Empty, kvi_unixTime, m_pAvatarDict, KviIrcMask::mask(), KviIrcMask::NickCleanUserSmartNet, _KviAvatarCacheEntry::szIdString, and _KviAvatarCacheEntry::tLastAccess.
Referenced by KviConsoleWindow::checkDefaultAvatar().
void KviAvatarCache::remove | ( | const KviIrcMask & | mask, |
const QString & | szNetwork | ||
) |
Remove an avatar from the cache.
mask | The mask of the user |
szNetwork | The network where the user is on |
References m_pAvatarDict, KviIrcMask::mask(), and KviIrcMask::NickCleanUserSmartNet.
Referenced by KviConsoleWindow::avatarChanged(), and KviConsoleWindow::checkDefaultAvatar().
void KviAvatarCache::replace | ( | const QString & | szIdString, |
const KviIrcMask & | mask, | ||
const QString & | szNetwork | ||
) |
Replaces a cached avatar.
szIdString | The id of the avatar |
mask | The mask of the user |
szNetwork | The network where the user is on |
References cleanup(), e, kvi_unixTime, m_pAvatarDict, KviIrcMask::mask(), MAX_AVATARS_IN_CACHE, KviIrcMask::NickCleanUserSmartNet, _KviAvatarCacheEntry::szIdString, and _KviAvatarCacheEntry::tLastAccess.
Referenced by KviConsoleWindow::avatarChanged().
void KviAvatarCache::save | ( | const QString & | szFileName | ) |
Saves the cache.
szFileName | The cache filename |
References KviPointerHashTableIterator< Key, T >::current(), KviPointerHashTableIterator< Key, T >::currentKey(), e, m_pAvatarDict, KviConfigurationFile::setGroup(), KviConfigurationFile::Write, and KviConfigurationFile::writeEntry().
Referenced by KviApplication::saveAvatarCache().
|
staticprotected |
KviPointerHashTable<QString, KviAvatarCacheEntry>* KviAvatarCache::m_pAvatarDict |
Referenced by cleanup(), KviAvatarCache(), load(), lookup(), remove(), replace(), save(), and ~KviAvatarCache().