From f07cb8ea8e0f6bf4586700d2f5d6ab1d908992ca Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 Dec 2022 13:00:51 +0300 Subject: useless service removed --- protocols/YAMN/src/browser/badconnect.cpp | 18 ++++++------------ protocols/YAMN/src/browser/browser.h | 5 ++--- protocols/YAMN/src/proto/pop3/pop3comm.cpp | 8 +++----- protocols/YAMN/src/services.cpp | 3 --- protocols/YAMN/src/stdafx.h | 2 +- 5 files changed, 12 insertions(+), 24 deletions(-) (limited to 'protocols') diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp index fe060e20bf..5f9118eb18 100644 --- a/protocols/YAMN/src/browser/badconnect.cpp +++ b/protocols/YAMN/src/browser/badconnect.cpp @@ -201,7 +201,7 @@ void __cdecl BadConnection(void *Param) Window_SetIcon_IcoLib(hBadConnect, g_plugin.getIconHandle(IDI_BADCONNECT)); if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO)) - return; + __leave; if (ActualAccount->BadConnectN.Flags & YAMN_ACC_SND) Skin_PlaySound(YAMN_CONNECTFAILSOUND); @@ -237,21 +237,15 @@ void __cdecl BadConnection(void *Param) } } -INT_PTR RunBadConnectionSvc(WPARAM wParam, LPARAM lParam) +int RunBadConnection(CAccount *acc, UINT_PTR iErrorCode, void *pUserInfo) { - // an event for successfull copy parameters to which point a pointer in stack for new thread - PYAMN_BADCONNECTIONPARAM Param = (PYAMN_BADCONNECTIONPARAM)wParam; - if ((uint32_t)lParam != YAMN_BADCONNECTIONVERSION) - return 0; - - HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); - Param->ThreadRunningEV = ThreadRunningEV; + BadConnectionParam param = {CreateEvent(nullptr, FALSE, FALSE, nullptr), acc, iErrorCode, pUserInfo}; - HANDLE NewThread = mir_forkthread(BadConnection, Param); + HANDLE NewThread = mir_forkthread(BadConnection, ¶m); if (nullptr == NewThread) return 0; - WaitForSingleObject(ThreadRunningEV, INFINITE); - CloseHandle(ThreadRunningEV); + WaitForSingleObject(param.ThreadRunningEV, INFINITE); + CloseHandle(param.ThreadRunningEV); return 1; } diff --git a/protocols/YAMN/src/browser/browser.h b/protocols/YAMN/src/browser/browser.h index c825651dc0..6707d50621 100644 --- a/protocols/YAMN/src/browser/browser.h +++ b/protocols/YAMN/src/browser/browser.h @@ -27,13 +27,12 @@ typedef struct NoNewMailParam void *Param; } YAMN_NONEWMAILPARAM,*PYAMN_NONEWMAILPARAM; -typedef struct BadConnectionParam +struct BadConnectionParam { -#define YAMN_BADCONNECTIONVERSION 1 HANDLE ThreadRunningEV; CAccount *account; UINT_PTR errcode; void *Param; -} YAMN_BADCONNECTIONPARAM,*PYAMN_BADCONNECTIONPARAM; +}; #endif diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index 39bd4063fd..946b93ea54 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -439,15 +439,13 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection return; } } - else //else it was called from POP3 plugin, probably error when deleting old mail (POP3 synchro calls POP3 delete) + else // else it was called from POP3 plugin, probably error when deleting old mail (POP3 synchro calls POP3 delete) if (ErrorCode == nullptr) return; - if ((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP)) { - YAMN_BADCONNECTIONPARAM cp = {(HANDLE)nullptr, ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection}; + if ((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP)) + RunBadConnection(ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection); - CallService(MS_YAMN_BADCONNECTION, (WPARAM)&cp, (LPARAM)YAMN_BADCONNECTIONVERSION); - } if (POP3PluginParam == (uint32_t)NULL) //if it was normal YAMN call SetEvent(ActualAccount->UseInternetFree); } diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp index 8265676b02..822f5d9f31 100644 --- a/protocols/YAMN/src/services.cpp +++ b/protocols/YAMN/src/services.cpp @@ -330,9 +330,6 @@ void CreateServiceFunctions(void) // Runs YAMN's mail browser CreateServiceFunction(MS_YAMN_MAILBROWSER, RunMailBrowserSvc); - // Runs YAMN's bad conenction window - CreateServiceFunction(MS_YAMN_BADCONNECTION, RunBadConnectionSvc); - // Function creates new mail for plugin CreateServiceFunction(MS_YAMN_CREATEACCOUNTMAIL, CreateAccountMailSvc); diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h index f822946aeb..05681d467b 100644 --- a/protocols/YAMN/src/stdafx.h +++ b/protocols/YAMN/src/stdafx.h @@ -158,7 +158,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM); INT_PTR RunMailBrowserSvc(WPARAM, LPARAM); //From badconnect.cpp -INT_PTR RunBadConnectionSvc(WPARAM, LPARAM); +int RunBadConnection(CAccount *acc, UINT_PTR iErrorCode, void *pUserInfo); //From YAMNopts.cpp int YAMNOptInitSvc(WPARAM, LPARAM); -- cgit v1.2.3