summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-05-03 22:01:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-05-03 22:01:57 +0000
commitdd9c282092856c0a577b9136e7463a3d9a3aa0d0 (patch)
tree758071fe05635271ca2b183bd9d7cbc9a282b00f
parent9120195e3db798389e49baa371c35e9085a49485 (diff)
more accurate check for variable lookup
git-svn-id: http://svn.miranda-ng.org/main/trunk@9121 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/src/commonheaders.h1
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp23
2 files changed, 20 insertions, 4 deletions
diff --git a/plugins/Db3x_mmap/src/commonheaders.h b/plugins/Db3x_mmap/src/commonheaders.h
index 4ddc34de68..01d0ce2eca 100644
--- a/plugins/Db3x_mmap/src/commonheaders.h
+++ b/plugins/Db3x_mmap/src/commonheaders.h
@@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_options.h>
#include <m_crypto.h>
#include <m_metacontacts.h>
+#include <m_protocols.h>
#include "database.h"
#include "dbintf.h"
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index 643e190521..a73e89d640 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -45,6 +45,17 @@ BOOL CDb3Mmap::IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting)
/////////////////////////////////////////////////////////////////////////////////////////
+static bool ValidLookupName(LPCSTR szModule, LPCSTR szSetting)
+{
+ if (!strcmp(szModule, META_PROTO))
+ return strcmp(szSetting, "IsSubcontact") && strcmp(szSetting, "ParentMetaID");
+
+ if (!strcmp(szModule, "Ignore"))
+ return false;
+
+ return true;
+}
+
int CDb3Mmap::GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic)
{
if (szSetting == NULL || szModule == NULL)
@@ -68,10 +79,10 @@ int CDb3Mmap::GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCST
mir_cslock lck(m_csDbAccess);
+LBL_Seek:
char *szCachedSettingName = m_cache->GetCachedSetting(szModule, szSetting, moduleNameLen, settingNameLen);
log3("get [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName);
-LBL_Seek:
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 0);
if (pCachedValue != NULL) {
if (pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8) {
@@ -223,9 +234,13 @@ LBL_Seek:
}
// try to get the missing mc setting from the active sub
- if (cc && cc->IsMeta() && !(!strcmp(szModule, META_PROTO) || !strcmp(szModule, "Ignore"))) {
- contactID = db_mc_getDefault(contactID);
- goto LBL_Seek;
+ if (cc && cc->IsMeta() && ValidLookupName(szModule, szSetting)) {
+ if (contactID = db_mc_getDefault(contactID)) {
+ if (szModule = GetContactProto(contactID)) {
+ moduleNameLen = (int)strlen(szModule);
+ goto LBL_Seek;
+ }
+ }
}
logg();