summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r--plugins/Db3x_mmap/src/dbcontacts.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp
index c8be49a189..a5971579e5 100644
--- a/plugins/Db3x_mmap/src/dbcontacts.cpp
+++ b/plugins/Db3x_mmap/src/dbcontacts.cpp
@@ -25,18 +25,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int CDb3Base::CheckProto(HANDLE hContact, const char *proto)
{
- char protobuf[MAX_PATH] = {0};
- DBVARIANT dbv;
- DBCONTACTGETSETTING sVal = { "Protocol", "p", &dbv };
-
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = protobuf;
- dbv.cchVal = sizeof(protobuf);
-
- if ( GetContactSettingStatic(hContact, &sVal) != 0 || (dbv.type != DBVT_ASCIIZ))
- return 0;
+ DBCachedContact *cc = m_cache->GetCachedContact(hContact);
+ if (cc == NULL)
+ cc = m_cache->AddContactToCache(hContact);
+
+ if (cc->szProto == NULL) {
+ char protobuf[MAX_PATH] = {0};
+ DBVARIANT dbv;
+ DBCONTACTGETSETTING sVal = { "Protocol", "p", &dbv };
+
+ dbv.type = DBVT_ASCIIZ;
+ dbv.pszVal = protobuf;
+ dbv.cchVal = sizeof(protobuf);
+ if ( GetContactSettingStatic(hContact, &sVal) != 0 || (dbv.type != DBVT_ASCIIZ))
+ return 0;
+
+ cc->szProto = m_cache->GetCachedSetting(NULL, protobuf, 0, (int)strlen(protobuf));
+ }
- return !strcmp(protobuf, proto);
+ return !strcmp(cc->szProto, proto);
}
STDMETHODIMP_(LONG) CDb3Base::GetContactCount(void)
@@ -148,10 +155,6 @@ STDMETHODIMP_(LONG) CDb3Base::DeleteContact(HANDLE hContact)
}
dbcPrev->ofsNext = ofsNext;
DBWrite(ofsThis,dbcPrev,sizeof(DBContact));
-
- DBCachedContact *VL = m_cache->GetCachedContact((HANDLE)ofsThis);
- if (VL)
- VL->hNext = (HANDLE)ofsNext;
}
//delete contact