summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-27 14:11:18 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-04-27 14:11:18 +0200
commit6b91af6235cbd8643c7c63e07ceb23f1b13e8a8f (patch)
treea3d219c1412c164751029c8fbc1e024f5cef7c1e
parent1a6f765baa14c490594bcf255e265e5add1aeec9 (diff)
implementation of #1308
-rw-r--r--include/m_database.h4
-rw-r--r--include/m_protoint.h10
-rw-r--r--include/newpluginapi.h18
-rw-r--r--libs/win32/mir_app.libbin158370 -> 162334 bytes
-rw-r--r--libs/win32/mir_core.libbin321758 -> 322596 bytes
-rw-r--r--libs/win64/mir_app.libbin153396 -> 157440 bytes
-rw-r--r--libs/win64/mir_core.libbin322762 -> 323610 bytes
-rw-r--r--src/mir_app/src/mir_app.def8
-rw-r--r--src/mir_app/src/mir_app64.def8
-rw-r--r--src/mir_core/src/db.cpp24
-rw-r--r--src/mir_core/src/mir_core.def2
-rw-r--r--src/mir_core/src/mir_core64.def2
12 files changed, 76 insertions, 0 deletions
diff --git a/include/m_database.h b/include/m_database.h
index c7e68e0d50..651a0a3b0a 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -400,9 +400,13 @@ EXTERN_C MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, LPCSTR szModule, LPCST
EXTERN_C MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue = 0);
EXTERN_C MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue = 0);
EXTERN_C MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue = 0);
+
EXTERN_C MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
EXTERN_C MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
+MIR_CORE_DLL(CMStringA) db_get_sm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
+MIR_CORE_DLL(CMStringW) db_get_wsm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
+
EXTERN_C MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
EXTERN_C MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
EXTERN_C MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, wchar_t *pDest, int cbDest);
diff --git a/include/m_protoint.h b/include/m_protoint.h
index f7d9d15968..f32b07983b 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -137,6 +137,16 @@ public:
__forceinline wchar_t* getWStringA(MCONTACT hContact, const char *name) {
return db_get_wsa(hContact, m_szModuleName, name); }
+ __forceinline CMStringA getMStringA(const char *name) {
+ return db_get_sm(NULL, m_szModuleName, name); }
+ __forceinline CMStringA getMStringA(MCONTACT hContact, const char *name) {
+ return db_get_sm(hContact, m_szModuleName, name); }
+
+ __forceinline CMStringW getMStringW(const char *name) {
+ return db_get_wsm(NULL, m_szModuleName, name); }
+ __forceinline CMStringW getMStringW(MCONTACT hContact, const char *name) {
+ return db_get_wsm(hContact, m_szModuleName, name); }
+
__forceinline void setByte(const char *name, BYTE value) { db_set_b(NULL, m_szModuleName, name, value); }
__forceinline void setByte(MCONTACT hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); }
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index 85d0b94007..fc1344030c 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -238,6 +238,15 @@ public:
return db_get_ws(hContact, m_szModuleName, name, result);
}
+ __forceinline CMStringA getMStringA(const char *name)
+ {
+ return db_get_sm(0, m_szModuleName, name);
+ }
+ __forceinline CMStringA getMStringA(MCONTACT hContact, const char *name)
+ {
+ return db_get_sm(hContact, m_szModuleName, name);
+ }
+
__forceinline char* getStringA(const char *name)
{
return db_get_sa(0, m_szModuleName, name);
@@ -256,6 +265,15 @@ public:
return db_get_wsa(hContact, m_szModuleName, name);
}
+ __forceinline CMStringW getMStringW(const char *name)
+ {
+ return db_get_wsm(0, m_szModuleName, name);
+ }
+ __forceinline CMStringW getMStringW(MCONTACT hContact, const char *name)
+ {
+ return db_get_wsm(hContact, m_szModuleName, name);
+ }
+
__forceinline void setByte(const char *name, BYTE value)
{
db_set_b(0, m_szModuleName, name, value);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 1a04380c6f..391561e5d5 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index f0a817b50e..51ee7287ad 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index ee2f776280..3fe09f51ae 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index cba2f307f8..4f7f73f2a2 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index aeaf4a8748..8361e8c9ae 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -586,3 +586,11 @@ Contact_GetStatus @609
?OnContactDeleted@PROTO_INTERFACE@@UAEXI@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UAEXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UAEXXZ @612 NONAME
+?getMStringA@CMPluginBase@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD@Z @613 NONAME
+?getMStringA@CMPluginBase@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PBD@Z @614 NONAME
+?getMStringA@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD@Z @615 NONAME
+?getMStringA@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PBD@Z @616 NONAME
+?getMStringW@CMPluginBase@@QAE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD@Z @617 NONAME
+?getMStringW@CMPluginBase@@QAE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PBD@Z @618 NONAME
+?getMStringW@PROTO_INTERFACE@@QAE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD@Z @619 NONAME
+?getMStringW@PROTO_INTERFACE@@QAE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PBD@Z @620 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e6e57acbb1..e54f50ddcc 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -586,3 +586,11 @@ Contact_GetStatus @609
?OnContactDeleted@PROTO_INTERFACE@@UEAAXI@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UEAAXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UEAAXXZ @612 NONAME
+?getMStringA@CMPluginBase@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD@Z @613 NONAME
+?getMStringA@CMPluginBase@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEBD@Z @614 NONAME
+?getMStringA@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD@Z @615 NONAME
+?getMStringA@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEBD@Z @616 NONAME
+?getMStringW@CMPluginBase@@QEAA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD@Z @617 NONAME
+?getMStringW@CMPluginBase@@QEAA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PEBD@Z @618 NONAME
+?getMStringW@PROTO_INTERFACE@@QEAA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD@Z @619 NONAME
+?getMStringW@PROTO_INTERFACE@@QEAA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PEBD@Z @620 NONAME
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 1f20b42098..04efa68510 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -181,6 +181,30 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const
return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? nullptr : dbv.pwszVal;
}
+MIR_CORE_DLL(CMStringA) db_get_sm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting)
+{
+ if (currDb == nullptr)
+ return CMStringA();
+
+ DBVARIANT dbv = { DBVT_ASCIIZ };
+ if (currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv))
+ return CMStringA();
+
+ return CMStringA(ptrA(dbv.pszVal));
+}
+
+MIR_CORE_DLL(CMStringW) db_get_wsm(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting)
+{
+ if (currDb == nullptr)
+ return CMStringW();
+
+ DBVARIANT dbv = { DBVT_WCHAR };
+ if (currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv))
+ return CMStringW();
+
+ return CMStringW(ptrW(dbv.pwszVal));
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// getting static data
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 2d117035ea..6049e89761 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1067,3 +1067,5 @@ IsTerminalDisconnected @1245
??1CCtrlLabel@@UAE@XZ @1257 NONAME
??_7CCtrlLabel@@6B@ @1258 NONAME
CallObjectEventHook @1259
+?db_get_sm@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @1260 NONAME
+?db_get_wsm@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD0@Z @1261 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 98e8fb7ca2..a56134d62e 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1067,3 +1067,5 @@ IsTerminalDisconnected @1245
??1CCtrlLabel@@UEAA@XZ @1257 NONAME
??_7CCtrlLabel@@6B@ @1258 NONAME
CallObjectEventHook @1259
+?db_get_sm@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @1260 NONAME
+?db_get_wsm@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD0@Z @1261 NONAME