summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/m_database.h18
-rw-r--r--include/m_db_int.h13
2 files changed, 20 insertions, 11 deletions
diff --git a/include/m_database.h b/include/m_database.h
index cb6d0e55bf..fb9d84c53c 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -128,14 +128,16 @@ EXTERN_C MIR_CORE_DLL(int) db_enum_settings(MCONTACT hContact, DBSETTINGENUMPROC
/////////////////////////////////////////////////////////////////////////////////////////
// DBVARIANT: used by db/contact/getsetting and db/contact/writesetting
-#define DBVT_DELETED 0 // this setting just got deleted, no other values are valid
-#define DBVT_BYTE 1 // bVal and cVal are valid
-#define DBVT_WORD 2 // wVal and sVal are valid
-#define DBVT_DWORD 4 // dVal and lVal are valid
-#define DBVT_ASCIIZ 255 // pszVal is valid
-#define DBVT_BLOB 254 // cpbVal and pbVal are valid
-#define DBVT_UTF8 253 // pszVal is valid
-#define DBVT_WCHAR 252 // pwszVal is valid
+#define DBVT_DELETED 0 // this setting just got deleted, no other values are valid
+#define DBVT_BYTE 1 // bVal and cVal are valid
+#define DBVT_WORD 2 // wVal and sVal are valid
+#define DBVT_DWORD 4 // dVal and lVal are valid
+#define DBVT_ASCIIZ 255 // pszVal is valid
+#define DBVT_BLOB 254 // cpbVal and pbVal are valid
+#define DBVT_UTF8 253 // pszVal is valid
+#define DBVT_WCHAR 252 // pwszVal is valid
+#define DBVT_ENCRYPTED 250 // blob of encrypted bytesw
+
#define DBVTF_VARIABLELENGTH 0x80
diff --git a/include/m_db_int.h b/include/m_db_int.h
index a2b53fb279..a393b23bbe 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -167,16 +167,20 @@ interface MIR_APP_EXPORT MIDatabase
#pragma warning(push)
#pragma warning(disable:4275)
+struct MICryptoEngine;
+
class MIR_APP_EXPORT MDatabaseCommon : public MIDatabase, public MNonCopyable
{
HANDLE m_hLock = nullptr;
protected:
+ bool m_bEncrypted = false;
int m_codePage;
mir_cs m_csDbAccess;
LIST<char> m_lResidentSettings;
MIDatabaseCache* m_cache;
+ MICryptoEngine *m_crypto;
protected:
void FillContactSettings();
@@ -184,12 +188,14 @@ protected:
int CheckProto(DBCachedContact *cc, const char *proto);
void UnlockName();
- STDMETHOD_(BOOL, GetContactSettingWorker)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic) PURE;
+ STDMETHOD_(BOOL, GetContactSettingWorker)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic);
+ STDMETHOD_(BOOL, WriteContactSettingWorker)(MCONTACT contactID, DBCONTACTWRITESETTING &dbcws) PURE;
public:
MDatabaseCommon();
virtual ~MDatabaseCommon();
+ __forceinline MICryptoEngine* getCrypt() const { return m_crypto; }
__forceinline MIDatabaseCache* getCache() const { return m_cache; }
STDMETHODIMP_(BOOL) DeleteModule(MCONTACT contactID, LPCSTR szModule) override;
@@ -206,7 +212,8 @@ public:
STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) override;
STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) override;
STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv);
-
+ STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws) override;
+
STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam) override;
STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName) override;
@@ -252,7 +259,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP_(BOOL) GetContactSettingWorker(MCONTACT, LPCSTR, LPCSTR, DBVARIANT*, int) override;
- STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT, DBCONTACTWRITESETTING*) override;
+ STDMETHODIMP_(BOOL) WriteContactSettingWorker(MCONTACT, DBCONTACTWRITESETTING&) override;
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT, LPCSTR, LPCSTR) override;
STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT, DBSETTINGENUMPROC, const char*, void*) override;