summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-09-23 18:31:42 +0300
committeraunsane <aunsane@gmail.com>2018-09-23 18:31:58 +0300
commit3bbcf20aa8db080ef1da99e21ef554e8069bff7a (patch)
tree30e7b63e14b80d5c58974860533f05ef0f84f906 /plugins
parentdd5cf95777c2c58cf366d6a201eb6e9aa2795435 (diff)
dbx_sqlite: mc support in settings
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_sqlite/src/dbsettings.cpp21
-rw-r--r--plugins/Dbx_sqlite/src/stdafx.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp
index 121f2c73fc..f238d3fb08 100644
--- a/plugins/Dbx_sqlite/src/dbsettings.cpp
+++ b/plugins/Dbx_sqlite/src/dbsettings.cpp
@@ -88,19 +88,32 @@ BOOL CDbxSQLite::EnumModuleNames(DBMODULEENUMPROC pFunc, void *param)
return result;
}
+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;
+}
+
BOOL CDbxSQLite::GetContactSettingWorker(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic)
{
if (szSetting == nullptr || szModule == nullptr)
return 1;
+ DBCachedContact *cc = nullptr;
if (hContact) {
- DBCachedContact *cc = m_cache->GetCachedContact(hContact);
+ cc = m_cache->GetCachedContact(hContact);
if (cc == nullptr)
return 1;
}
mir_cslock lock(m_csDbAccess);
+LBL_Seek:
char *cachedSettingName = m_cache->GetCachedSetting(szModule, szSetting, mir_strlen(szModule), mir_strlen(szSetting));
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(hContact, cachedSettingName, 0);
if (pCachedValue != nullptr) {
@@ -142,6 +155,12 @@ BOOL CDbxSQLite::GetContactSettingWorker(MCONTACT hContact, LPCSTR szModule, LPC
int rc = sqlite3_step(stmt);
if (rc != SQLITE_ROW) {
sqlite3_reset(stmt);
+ if (rc == SQLITE_DONE && cc && cc->IsMeta() && ValidLookupName(szModule, szSetting)) {
+ if (hContact = db_mc_getDefault(hContact)) {
+ if (szModule = GetContactProto(hContact))
+ goto LBL_Seek;
+ }
+ }
return 1;
}
dbv->type = (int)sqlite3_column_int(stmt, 0);
diff --git a/plugins/Dbx_sqlite/src/stdafx.h b/plugins/Dbx_sqlite/src/stdafx.h
index 4113213c7c..bcf4e9811f 100644
--- a/plugins/Dbx_sqlite/src/stdafx.h
+++ b/plugins/Dbx_sqlite/src/stdafx.h
@@ -12,6 +12,7 @@
#include <m_system.h>
#include <m_database.h>
#include <m_db_int.h>
+#include <m_protocols.h>
#include <m_metacontacts.h>
#include "dbintf.h"