summaryrefslogtreecommitdiff
path: root/src/modules/database
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-15 18:43:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-15 18:43:55 +0000
commit90b4d09356a49c0f1c9f4ca0dc1cbc27f11fc2ae (patch)
tree70bbc57259c56c0beec76b5e7c23e1fc2789ff62 /src/modules/database
parente311fc5f472c169ec0f25729fa5070fdd4a6c805 (diff)
no more offline contacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@2319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/database')
-rw-r--r--src/modules/database/mdatabasecache.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp
index 91c95ee656..b5b103461b 100644
--- a/src/modules/database/mdatabasecache.cpp
+++ b/src/modules/database/mdatabasecache.cpp
@@ -52,10 +52,16 @@ MDatabaseCache::~MDatabaseCache()
DBCachedContact* MDatabaseCache::AddContactToCache(HANDLE hContact)
{
- DBCachedContact* VL = (DBCachedContact*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContact));
- VL->hContact = hContact;
- m_lContacts.insert(VL);
- return VL;
+ DBCachedContact VLtemp = { hContact };
+ int index = m_lContacts.getIndex(&VLtemp);
+ if (index == -1) {
+ DBCachedContact* VL = (DBCachedContact*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContact));
+ VL->hContact = hContact;
+ m_lContacts.insert(VL);
+ return VL;
+ }
+
+ return m_lContacts[ index ];
}
DBCachedContact* MDatabaseCache::GetCachedContact(HANDLE hContact)