From e521cf5548352e7a443241e10614f97bc9630a2c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Jun 2015 19:06:07 +0000 Subject: - more transparent ProtoServiceExists implementation; - ProtoServiceExists moved from mir_core into miranda32.exe; - miranda32.def is used again to define the order of functions precisely; - libraries updated git-svn-id: http://svn.miranda-ng.org/main/trunk@14118 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/miranda.h | 4 ++++ src/core/stdplug.h | 2 +- src/mir_core/src/protos.cpp | 13 ------------- src/miranda32.def | 1 + src/miranda32_10.vcxproj | 2 ++ src/miranda32_12.vcxproj | 2 ++ src/modules/protocols/protocols.cpp | 21 +++++++++++++++++++-- 7 files changed, 29 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/miranda.h b/src/core/miranda.h index 5d31e64aed..ba8516baf1 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -183,4 +183,8 @@ extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db); MIR_CORE_DLL(PROTOCOLDESCRIPTOR*) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd); + + int ProtoServiceExists(LPCSTR szModule, const char *szService); + INT_PTR CallContactService(MCONTACT, const char *, WPARAM, LPARAM); + INT_PTR CallProtoService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam); }; diff --git a/src/core/stdplug.h b/src/core/stdplug.h index ef65298258..9a6f751829 100644 --- a/src/core/stdplug.h +++ b/src/core/stdplug.h @@ -1,6 +1,6 @@ #ifdef _STATIC - #define MIRANDA_EXE_FUNC(T) extern "C" T __declspec(dllexport) + #define MIRANDA_EXE_FUNC(T) extern "C" T #else #define MIRANDA_EXE_FUNC(T) extern "C" T __declspec(dllimport) #endif diff --git a/src/mir_core/src/protos.cpp b/src/mir_core/src/protos.cpp index 154ff2ad26..051e5a9792 100644 --- a/src/mir_core/src/protos.cpp +++ b/src/mir_core/src/protos.cpp @@ -99,19 +99,6 @@ MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, MCONTACT hContact, ///////////////////////////////////////////////////////////////////////////////////////// -MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService) -{ - if (szModule == NULL || szService == NULL) - return false; - - char str[MAXMODULELABELLENGTH * 2]; - strncpy_s(str, szModule, _TRUNCATE); - strncat_s(str, szService, _TRUNCATE); - return ServiceExists(str); -} - -///////////////////////////////////////////////////////////////////////////////////////// - MIR_CORE_DLL(void) ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, LPCTSTR ptszUserName) { pThis->m_iVersion = 2; diff --git a/src/miranda32.def b/src/miranda32.def index c36a1b6fc4..207032d84a 100644 --- a/src/miranda32.def +++ b/src/miranda32.def @@ -16,3 +16,4 @@ IcoLib_ReleaseIcon @13 Window_FreeIcon_IcoLib @14 Window_SetIcon_IcoLib @15 Window_SetProtoIcon_IcoLib @16 +ProtoServiceExists @17 diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj index 157ff16114..0b94c03baa 100644 --- a/src/miranda32_10.vcxproj +++ b/src/miranda32_10.vcxproj @@ -142,6 +142,7 @@ $(ProfileDir)..\bin10\lib /PDBALTPATH:%_PDB% 0x400000 + miranda32.def miranda32.exe.manifest @@ -208,6 +209,7 @@ $(SolutionDir)\lib $(ProfileDir)..\bin10\lib 0x400000 + miranda32.def miranda32.exe.manifest diff --git a/src/miranda32_12.vcxproj b/src/miranda32_12.vcxproj index 7d514d96d8..2bbabfb35d 100644 --- a/src/miranda32_12.vcxproj +++ b/src/miranda32_12.vcxproj @@ -145,6 +145,7 @@ $(SolutionDir)\lib $(ProfileDir)..\bin12\lib 0x400000 + miranda32.def miranda32.exe.manifest @@ -212,6 +213,7 @@ $(SolutionDir)\lib $(ProfileDir)..\bin12\lib 0x400000 + miranda32.def miranda32.exe.manifest diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index c1eff7848e..273fb85dd9 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -100,9 +100,9 @@ INT_PTR srvProto_IsLoaded(WPARAM, LPARAM lParam) return (INT_PTR)Proto_IsProtocolLoaded((char*)lParam); } -static PROTO_INTERFACE* defInitProto(const char* szModuleName, const TCHAR*) +static PROTO_INTERFACE* defInitProto(const char* szModule, const TCHAR*) { - return AddDefaultAccount(szModuleName); + return AddDefaultAccount(szModule); } static INT_PTR srvProto_RegisterModule(WPARAM, LPARAM lParam) @@ -366,6 +366,23 @@ static INT_PTR Proto_BroadcastAck(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// +int ProtoServiceExists(const char *szModule, const char *szService) +{ + if (szModule == NULL || szService == NULL) + return false; + + TServiceListItem *item = (TServiceListItem*)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems); + if (item != NULL) + return true; + + char str[MAXMODULELABELLENGTH * 2]; + strncpy_s(str, szModule, _TRUNCATE); + strncat_s(str, szService, _TRUNCATE); + return ServiceExists(str); +} + +///////////////////////////////////////////////////////////////////////////////////////// + INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam) { return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam); -- cgit v1.2.3