From a289263bd2d74f89c4ea119149bf31c96d29a6a8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 5 Oct 2022 19:21:28 +0300 Subject: getBlob went to the core --- include/m_protoint.h | 3 +++ libs/win32/mir_app.lib | Bin 230744 -> 231490 bytes libs/win64/mir_app.lib | Bin 227002 -> 227768 bytes src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ src/mir_app/src/proto_utils.cpp | 24 ++++++++++++++++++++++++ 6 files changed, 31 insertions(+) diff --git a/include/m_protoint.h b/include/m_protoint.h index 5fc087e6e8..1eea83eaa8 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -107,6 +107,9 @@ public: __forceinline bool getBool(MCONTACT hContact, const char *name, bool defaultValue = false) { return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; } + MBinBuffer getBlob(const char *pSetting); + MBinBuffer getBlob(MCONTACT hContact, const char *pSetting); + __forceinline bool isChatRoom(MCONTACT hContact) { return getBool(hContact, "ChatRoom", false); } __forceinline int getByte(const char *name, uint8_t defaultValue = 0) { diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 863f6f6705..2b562bc3b5 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index cd39df943f..4f2ee2f598 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 39e0e08b34..a7a3b3312b 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -807,3 +807,5 @@ Srmm_CreateHotkey @886 NONAME ?bStripFormat@Chat@@3V?$CMOption@_N@@A @908 NONAME ?bTimeStampEventColour@Chat@@3V?$CMOption@_N@@A @909 NONAME ?bTopicOnClist@Chat@@3V?$CMOption@_N@@A @910 NONAME +?getBlob@PROTO_INTERFACE@@QAE?AVMBinBuffer@@IPBD@Z @911 NONAME +?getBlob@PROTO_INTERFACE@@QAE?AVMBinBuffer@@PBD@Z @912 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 2a03307191..7cfbe15e28 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -807,3 +807,5 @@ Srmm_CreateHotkey @886 NONAME ?bStripFormat@Chat@@3V?$CMOption@_N@@A @908 NONAME ?bTimeStampEventColour@Chat@@3V?$CMOption@_N@@A @909 NONAME ?bTopicOnClist@Chat@@3V?$CMOption@_N@@A @910 NONAME +?getBlob@PROTO_INTERFACE@@QEAA?AVMBinBuffer@@IPEBD@Z @911 NONAME +?getBlob@PROTO_INTERFACE@@QEAA?AVMBinBuffer@@PEBD@Z @912 NONAME diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 1c2944120e..79bd7012fa 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -119,6 +119,30 @@ void PROTO_INTERFACE::setAllContactStatuses(int iStatus, bool bSkipChats) } } +///////////////////////////////////////////////////////////////////////////////////////// + +MBinBuffer PROTO_INTERFACE::getBlob(const char *pszSetting) +{ + MBinBuffer buf; + DBVARIANT dbv = {DBVT_BLOB}; + if (!db_get(0, m_szModuleName, pszSetting, &dbv)) { + buf.assign(dbv.pbVal, dbv.cpbVal); + db_free(&dbv); + } + return buf; +} + +MBinBuffer PROTO_INTERFACE::getBlob(MCONTACT hContact, const char *pszSetting) +{ + MBinBuffer buf; + DBVARIANT dbv = {DBVT_BLOB}; + if (!db_get(hContact, m_szModuleName, pszSetting, &dbv)) { + buf.assign(dbv.pbVal, dbv.cpbVal); + db_free(&dbv); + } + return buf; +} + ///////////////////////////////////////////////////////////////////////////////////////// // protocol services -- cgit v1.2.3