From b95dc7e61ba02fdd12b1c11142db6c7aebfffd53 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Mar 2023 13:22:35 +0300 Subject: db_get_usm / getMStringU - helpers to read UTF8 strings as CMStringA --- src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ src/mir_core/src/db.cpp | 12 ++++++++++++ src/mir_core/src/mir_core.def | 1 + src/mir_core/src/mir_core64.def | 1 + 5 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index fa21d3f9bb..765a1f46b0 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -820,3 +820,5 @@ Srmm_CreateHotkey @886 NONAME ?UpdateChatLog@CSrmmBaseDialog@@IAEXXZ @935 NONAME ?OnMarkRead@PROTO_INTERFACE@@UAEXII@Z @936 NONAME ?OnCreateAccMgrUI@PROTO_INTERFACE@@UAEPAUHWND__@@PAU2@@Z @937 NONAME +?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @938 NONAME +?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PBD0@Z @939 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 4aeacf9c19..1431875262 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -820,3 +820,5 @@ Srmm_CreateHotkey @886 NONAME ?UpdateChatLog@CSrmmBaseDialog@@IEAAXXZ @935 NONAME ?OnMarkRead@PROTO_INTERFACE@@UEAAXII@Z @936 NONAME ?OnCreateAccMgrUI@PROTO_INTERFACE@@UEAAPEAUHWND__@@PEAU2@@Z @937 NONAME +?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @938 NONAME +?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEBD0@Z @939 NONAME diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 737fdd84b9..5f77f45774 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -255,6 +255,18 @@ MIR_CORE_DLL(CMStringA) db_get_sm(MCONTACT hContact, LPCSTR szModule, LPCSTR szS return CMStringA(ptrA(dbv.pszVal).get()); } +MIR_CORE_DLL(CMStringA) db_get_usm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, const char *szValue) +{ + if (g_pCurrDb == nullptr) + return (szValue == nullptr) ? CMStringA() : CMStringA(szValue); + + DBVARIANT dbv = { DBVT_UTF8 }; + if (g_pCurrDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv)) + return (szValue == nullptr) ? CMStringA() : CMStringA(szValue); + + return CMStringA(ptrA(dbv.pszVal).get()); +} + MIR_CORE_DLL(CMStringW) db_get_wsm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, const wchar_t *szValue) { if (g_pCurrDb == nullptr) diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index a2b489708e..677bf03c83 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1549,3 +1549,4 @@ _Utils_CorrectFontSize@4 @1762 NONAME ?appendBefore@MBinBuffer@@QAEXABV1@@Z @1770 NONAME db_event_replace @1771 db_event_updateId @1772 +?db_get_usm@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD00@Z @1773 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 07b98136f8..4aace13f6e 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1549,3 +1549,4 @@ Utils_CorrectFontSize @1762 NONAME ?appendBefore@MBinBuffer@@QEAAXAEBV1@@Z @1770 NONAME db_event_replace @1771 db_event_updateId @1772 +?db_get_usm@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD00@Z @1773 NONAME -- cgit v1.2.3