summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-09 13:22:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-09 13:22:35 +0300
commitb95dc7e61ba02fdd12b1c11142db6c7aebfffd53 (patch)
tree2b2efc2027037c8da18e13f41d05971a8158876a /src/mir_core
parentcb68e7ffd8d79f36797cbe4704d554d9bf01ac28 (diff)
db_get_usm / getMStringU - helpers to read UTF8 strings as CMStringA
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/db.cpp12
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
3 files changed, 14 insertions, 0 deletions
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