diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-17 22:37:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-17 22:37:15 +0000 |
commit | 070ae988a2704d6bea4733e12f644f3d02e71b7f (patch) | |
tree | 056758c3fe8adb386ee7fa40f94e1d0ae04dea5b | |
parent | 6c4d35fca373a55252f4bce0bd0102f78eb67037 (diff) |
ProtoBroadcastAck macro converted into a function
git-svn-id: http://svn.miranda-ng.org/main/trunk@5007 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 36494 -> 36730 bytes | |||
-rw-r--r-- | bin10/lib/mir_core64.lib | bin | 33314 -> 33526 bytes | |||
-rw-r--r-- | bin11/lib/mir_core.lib | bin | 36494 -> 36730 bytes | |||
-rw-r--r-- | bin11/lib/mir_core64.lib | bin | 33314 -> 33526 bytes | |||
-rw-r--r-- | include/delphi/m_core.inc | 4 | ||||
-rw-r--r-- | include/delphi/m_helpers.inc | 16 | ||||
-rw-r--r-- | include/m_core.h | 3 | ||||
-rw-r--r-- | include/m_protomod.h | 8 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/miranda.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/miranda.h | 3 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 29 |
12 files changed, 18 insertions, 48 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex e6ca0d6dce..c91ae88aa6 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex ab438211dc..d0d80964d2 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib Binary files differindex 464d66c965..b1a0f8e48c 100644 --- a/bin11/lib/mir_core.lib +++ b/bin11/lib/mir_core.lib diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib Binary files differindex a333157872..583d63393c 100644 --- a/bin11/lib/mir_core64.lib +++ b/bin11/lib/mir_core64.lib diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 04801f8702..2ab7632acc 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -521,10 +521,12 @@ function mir_vsntprintf(buffer:pWideChar;count:size_t;fmt:pWideChar;va:va_list): ///////////////////////////////////////////////////////////////////////////////
// protocol functions
+function ProtoBroadcastAck(const szModule: PAnsiChar; hContact: THandle; type_: int; result_: int; hProcess: THandle; lParam: LPARAM): int_ptr; stdcall;
+ external CoreDLL name 'ProtoBroadcastAck';
+
function ProtoServiceExists(const szModule, szName:PAnsiChar):int; stdcall;
external CoreDLL name 'ProtoServiceExists';
-
///////////////////////////////////////////////////////////////////////////////
// sha1 functions
type
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 9c3881fe31..f14fab1727 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -38,7 +38,6 @@ procedure TranslateDialogDefault(hwndDlg: THandle); procedure TranslateMenu(hMenu: HMENU);
function Langpack_Register:int_ptr;
-function ProtoBroadcastAck(const szModule: PAnsiChar; hContact: THandle; type_: int; result_: int; hProcess: THandle; lParam: LPARAM): int_ptr;
function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr;
function Srmm_AddIcon (sid: PStatusIconData):int_ptr;
@@ -330,21 +329,6 @@ begin result:=CallService(MS_LANGPACK_REGISTER,WPARAM(@hLangpack),LPARAM(@PluginInfo));
end;
-
-function ProtoBroadcastAck(const szModule: PAnsiChar; hContact: THandle; type_: int; result_: int; hProcess: THandle; lParam: LPARAM): int_ptr;
-var
- ack: TACKDATA;
-begin
- ack.cbSize := sizeof(TACKDATA);
- ack.szModule := szModule;
- ack.hContact := hContact;
- ack._type := type_;
- ack._result := result_;
- ack.hProcess := hProcess;
- ack.lParam := lParam;
- Result := CallService(MS_PROTO_BROADCASTACK, 0, tlParam(@ack));
-end;
-
function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr;
var
szStr: array[0..MAXMODULELABELLENGTH*2] of AnsiChar;
diff --git a/include/m_core.h b/include/m_core.h index 9c315e76d4..7e3c4ea99f 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -433,7 +433,8 @@ MIR_CORE_DLL(int) mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fm ///////////////////////////////////////////////////////////////////////////////
// protocol functions
-MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService);
+MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService);
+MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
///////////////////////////////////////////////////////////////////////////////
// sha1 functions
diff --git a/include/m_protomod.h b/include/m_protomod.h index 4b7bcf2de1..3e28b55591 100644 --- a/include/m_protomod.h +++ b/include/m_protomod.h @@ -123,12 +123,4 @@ __forceinline INT_PTR ProtoChainRecvFile(HANDLE hContact, PROTORECVFILET *pre) //See the notes in core/modules.h under NotifyEventHooks()
#define MS_PROTO_BROADCASTACK "Proto/BroadcastAck"
-__forceinline INT_PTR ProtoBroadcastAck(const char *szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
-{
- ACKDATA ack = { sizeof(ACKDATA), szModule, hContact, type, result, hProcess, lParam };
- return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
-}
-
#endif // M_PROTOMOD_H__
-
-
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 52a16fc917..5631c9c335 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -162,3 +162,4 @@ wildcmpiw @159 mir_base64_encode @160
mir_base64_decode @161
ProtoServiceExists @162
+ProtoBroadcastAck @163
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 640f2d89db..6fcd531f87 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -74,6 +74,7 @@ static void LoadCoreModule(void) InitPathUtils();
InitialiseModularEngine();
+ InitProtocols();
}
MIR_CORE_DLL(void) UnloadCoreModule(void)
@@ -83,6 +84,7 @@ MIR_CORE_DLL(void) UnloadCoreModule(void) CloseHandle(hThreadQueueEmpty);
TlsFree(mir_tls);
+ UninitProtocols();
DestroyModularEngine();
UnloadLangPackModule();
}
diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h index 3619cc9b56..1bfebf35c7 100644 --- a/src/mir_core/miranda.h +++ b/src/mir_core/miranda.h @@ -35,6 +35,9 @@ void DestroyModularEngine(void); int InitPathUtils(void);
+void InitProtocols();
+void UninitProtocols();
+
extern HINSTANCE hInst;
extern HWND hAPCWindow;
extern HANDLE hStackMutex, hThreadQueueEmpty;
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index ef2a4b7eac..c89f4734ae 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -27,7 +27,7 @@ int LoadProtoChains(void); int LoadProtoOptions(void);
HANDLE hAccListChanged;
-static HANDLE hAckEvent, hTypeEvent;
+static HANDLE hTypeEvent;
static BOOL bModuleInitialized = FALSE;
typedef struct
@@ -65,22 +65,6 @@ LIST<PROTOCOLDESCRIPTOR> filters(10, CompareProtos2); //------------------------------------------------------------------------------------
-static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam)
-{
- ACKDATA *ack = (ACKDATA*)lParam;
- if (ack && ack->type == ACKTYPE_AVATAR && ack->hProcess) {
- PROTO_AVATAR_INFORMATION* ai = (PROTO_AVATAR_INFORMATION*)ack->hProcess;
- if (ai->cbSize == sizeof(PROTO_AVATAR_INFORMATION)) {
- PROTO_AVATAR_INFORMATIONW aiw = { sizeof(aiw), ai->hContact, ai->format };
- MultiByteToWideChar(CP_ACP, 0, ai->filename, -1, aiw.filename, SIZEOF(aiw.filename));
-
- ack->hProcess = &aiw;
- }
- }
-
- return NotifyEventHooks(hAckEvent, wParam, lParam);
-}
-
INT_PTR __fastcall MyCallProtoService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
void FreeFilesMatrix(TCHAR ***files);
@@ -367,6 +351,12 @@ static INT_PTR srvProto_IsAccountLocked(WPARAM, LPARAM lParam) return (INT_PTR)Proto_IsAccountLocked(Proto_GetAccount((char*)lParam));
}
+static INT_PTR Proto_BroadcastAck(WPARAM, LPARAM lParam)
+{
+ ACKDATA *ack = (ACKDATA*)lParam;
+ return ProtoBroadcastAck(ack->szModule, ack->hProcess, ack->type, ack->result, ack->hProcess, ack->lParam);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
@@ -718,7 +708,6 @@ int LoadProtocolsModule(void) InsertServiceListItem(109, PS_SEARCHBYNAMEW);
InsertServiceListItem(110, PS_SEARCHBYEMAILW);
- hAckEvent = CreateHookableEvent(ME_PROTO_ACK);
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
hAccListChanged = CreateHookableEvent(ME_PROTO_ACCLISTCHANGED);
@@ -749,10 +738,6 @@ void UnloadProtocolsModule() {
if ( !bModuleInitialized) return;
- if (hAckEvent) {
- DestroyHookableEvent(hAckEvent);
- hAckEvent = NULL;
- }
if (hAccListChanged) {
DestroyHookableEvent(hAccListChanged);
hAccListChanged = NULL;
|