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 /src | |
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
Diffstat (limited to 'src')
-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 |
4 files changed, 13 insertions, 22 deletions
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;
|