From 338b214ae6675a565abc546f3f31c253d78b1dd2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 13 Apr 2023 14:40:09 +0300 Subject: code cleaning --- src/core/stdfile/src/file.cpp | 45 ++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'src/core/stdfile') diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 90fe7b112e..4d007ec3ed 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -93,29 +93,6 @@ static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) return 0; } -static void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) -{ - CLISTEVENT cle = {}; - cle.hContact = hContact; - cle.hDbEvent = hdbe; - cle.lParam = lParam; - if (g_plugin.bAutoAccept && Contact::OnList(hContact)) { - LaunchRecvDialog(&cle); - } - else { - Skin_PlaySound("RecvFile"); - - wchar_t szTooltip[256]; - mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(hContact)); - cle.szTooltip.w = szTooltip; - - cle.flags |= CLEF_UNICODE; - cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); - cle.pszService = "SRFile/RecvFile"; - g_clistApi.pfnAddEvent(&cle); - } -} - int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *szValue, wchar_t *szOutput, int cbOutput) { HKEY hKey; @@ -375,7 +352,27 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) } MEVENT hdbe = db_event_add(ccs->hContact, &dbei); - PushFileEvent(ccs->hContact, hdbe, pre->lParam); + + CLISTEVENT cle = {}; + cle.hContact = ccs->hContact; + cle.hDbEvent = hdbe; + cle.lParam = pre->lParam; + + if (g_plugin.bAutoAccept && Contact::OnList(ccs->hContact)) + LaunchRecvDialog(&cle); + else { + Skin_PlaySound("RecvFile"); + + wchar_t szTooltip[256]; + mir_snwprintf(szTooltip, TranslateT("File from %s"), Clist_GetContactDisplayName(ccs->hContact)); + cle.szTooltip.w = szTooltip; + + cle.flags |= CLEF_UNICODE; + cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); + cle.pszService = "SRFile/RecvFile"; + g_clistApi.pfnAddEvent(&cle); + } + return hdbe; } -- cgit v1.2.3