From c1b2166e6abf0d89217c684358b9d5b815e0df19 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Feb 2019 16:11:48 +0300 Subject: db_get_utfa -> new function to allocate utf strings dynamically --- src/mir_core/src/db.cpp | 11 +++++++++++ src/mir_core/src/mir_core.def | 1 + src/mir_core/src/mir_core64.def | 1 + 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 56500eaff2..aee2097ade 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -174,6 +174,17 @@ MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, const char *szModule, const cha return (szValue == nullptr) ? nullptr : mir_strdup(szValue); } +MIR_CORE_DLL(char*) db_get_utfa(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szValue) +{ + if (currDb) { + DBVARIANT dbv = { DBVT_UTF8 }; + if (!currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv)) + return dbv.pszVal; + } + + return (szValue == nullptr) ? nullptr : mir_strdup(szValue); +} + MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szValue) { if (currDb) { diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 112500b679..a70c6493e0 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1415,3 +1415,4 @@ db_event_edit @1268 ?SetAttribute@XMLElement@tinyxml2@@QAEXPBDPB_W@Z @1628 NONAME ??AXMLConstHandle@tinyxml2@@QBE?BV01@PBD@Z @1629 NONAME ??AXMLHandle@tinyxml2@@QAE?AV01@PBD@Z @1630 NONAME +db_get_utfa @1631 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index eac6cc4c13..d4dced17cf 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1415,3 +1415,4 @@ db_event_edit @1268 ?SetAttribute@XMLElement@tinyxml2@@QEAAXPEBDPEB_W@Z @1628 NONAME ??AXMLConstHandle@tinyxml2@@QEBA?BV01@PEBD@Z @1629 NONAME ??AXMLHandle@tinyxml2@@QEAA?AV01@PEBD@Z @1630 NONAME +db_get_utfa @1631 -- cgit v1.2.3