From 05ccb4dcd0b507fb000426667ed3f25c0b93db2b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Jun 2013 11:37:58 +0000 Subject: db_set_resident - helper for MIDataBase::SetSettingResident git-svn-id: http://svn.miranda-ng.org/main/trunk@5093 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 36960 -> 37186 bytes bin10/lib/mir_core64.lib | Bin 33732 -> 33934 bytes bin11/lib/mir_core.lib | Bin 36960 -> 37186 bytes bin11/lib/mir_core64.lib | Bin 33732 -> 33934 bytes include/delphi/m_core.inc | 2 ++ include/m_core.h | 22 ++++++++++++++-------- src/mir_core/db.cpp | 11 +++++++++++ src/mir_core/mir_core.def | 1 + 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index 8997fe9dd9..613db9ff55 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index 8a267f612e..7d7061392f 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib index 14d30e8010..5cdf3a6d0e 100644 Binary files a/bin11/lib/mir_core.lib and b/bin11/lib/mir_core.lib differ diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib index 8a267f612e..f8fe2f5e2e 100644 Binary files a/bin11/lib/mir_core64.lib and b/bin11/lib/mir_core64.lib differ diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index c7f7dc6428..82acc44c5a 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -126,6 +126,8 @@ function db_event_prev(hDbEvent:THANDLE):THANDLE; stdcall; function db_free(dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_free'; +function db_set_resident(const szModule:pAnsiChar; const szSetting:pAnsiChar; bEnable:int):int; stdcall; + external CoreDLL name 'db_set_resident'; function db_unset(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_unset'; diff --git a/include/m_core.h b/include/m_core.h index 1cb48af582..2b81f6e9bd 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -110,11 +110,11 @@ MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv); MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting); #if defined(__cplusplus) -MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto = NULL); -MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL); + MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto = NULL); + MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL); #else -MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto); -MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto); + MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto); + MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto); #endif MIR_CORE_DLL(HANDLE) db_event_add(HANDLE hContact, DBEVENTINFO *dbei); @@ -138,9 +138,9 @@ MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const cha MIR_CORE_DLL(WCHAR*) db_get_wsa(HANDLE hContact, const char *szModule, const char *szSetting); #if defined(__cplusplus) -MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ); + MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ); #else -MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType); + MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType); #endif MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val); @@ -151,6 +151,12 @@ MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, const char *szModule, const cha MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, const char *szModule, const char *szSetting, const char *val); MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const char *szSetting, void *val, unsigned len); +#if defined(__cplusplus) + MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable=TRUE); +#else + MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable); +#endif + #define db_get_ws(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR) #define db_get_utf(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8) @@ -581,9 +587,9 @@ typedef unsigned (__stdcall *pThreadFuncEx)(void*); typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param); #if defined( __cplusplus ) -MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner=NULL); + MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner=NULL); #else -MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner); + MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner); #endif MIR_CORE_DLL(INT_PTR) Thread_Pop(void); MIR_CORE_DLL(void) Thread_Wait(void); diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 82013cc3f3..7b04b6eab4 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -311,3 +311,14 @@ extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db) { currDb = _db; } + +MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable) +{ + if (currDb == NULL || szModule == NULL || szService == NULL) + return FALSE; + + char str[MAXMODULELABELLENGTH * 2]; + strncpy_s(str,szModule,strlen(szModule)); + strncat_s(str,szService,strlen(szService)); + return currDb->SetSettingResident(bEnable, str); +} diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 4a57e3a945..d72f8e0087 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -164,3 +164,4 @@ mir_base64_decode @161 ProtoServiceExists @162 ProtoBroadcastAck @163 ProtoCallService @164 +db_set_resident @165 -- cgit v1.2.3