From f4f4eccf331d50eaf3c1c29cfd3e74308901137a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 13 Feb 2015 20:15:19 +0000 Subject: incoming file transfer window to be closed on error git-svn-id: http://svn.miranda-ng.org/main/trunk@12102 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdfile/src/file.cpp | 19 +++++++++++++++++++ src/core/stdfile/src/file.h | 2 ++ src/core/stdfile/src/filerecvdlg.cpp | 12 ++++++++++++ src/core/stdfile/src/filexferdlg.cpp | 2 -- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index f61378f3ca..042d1fe44e 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -316,6 +316,24 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) return 0; } +static int SRFileProtoAck(WPARAM, LPARAM lParam) +{ + ACKDATA *ack = (ACKDATA*)lParam; + if (ack->type != ACKTYPE_FILE) return 0; + + int iEvent = 0; + CLISTEVENT *cle = NULL; + while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, ack->hContact, iEvent++)) != NULL) + { + if (cle->lParam == (LPARAM)ack->hProcess) + { + CallService(MS_CLIST_REMOVEEVENT, ack->hContact, cle->hDbEvent); + } + } + + return 0; +} + static int SRFileModulesLoaded(WPARAM, LPARAM) { CLISTMENUITEM mi = { sizeof(mi) }; @@ -420,6 +438,7 @@ int LoadSendRecvFileModule(void) HookEvent(ME_DB_EVENT_ADDED, FileEventAdded); HookEvent(ME_OPT_INITIALISE, FileOptInitialise); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu); + HookEvent(ME_PROTO_ACK, SRFileProtoAck); hDlgSucceeded = CreateHookableEvent(ME_FILEDLG_SUCCEEDED); hDlgCanceled = CreateHookableEvent(ME_FILEDLG_CANCELED); diff --git a/src/core/stdfile/src/file.h b/src/core/stdfile/src/file.h index 1d0c8322b7..04afe0c3cf 100644 --- a/src/core/stdfile/src/file.h +++ b/src/core/stdfile/src/file.h @@ -109,6 +109,8 @@ int FileOptInitialise(WPARAM wParam, LPARAM lParam); #define WM_FT_CLEANUP (WM_USER+705) #define WM_FT_COMPLETED (WM_USER+706) +#define HM_RECVEVENT (WM_USER+10) + HWND FtMgr_Show(bool bForceActivate, bool bFromMenu); void FtMgr_Destroy(); HWND FtMgr_AddTransfer(FileDlgData *dat); diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 725e284c52..95d2512a1c 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -203,6 +203,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact = cle->hContact; dat->hDbEvent = cle->hDbEvent; + dat->hNotifyEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_RECVEVENT); dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN); dat->dwTicks = GetTickCount(); @@ -411,6 +412,17 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } break; + case HM_RECVEVENT: + { + ACKDATA *ack = (ACKDATA*)lParam; + if (ack->hProcess != dat->fs) break; + if (ack->type != ACKTYPE_FILE) break; + if (ack->hContact != dat->hContact) break; + + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), (LPARAM)GetDlgItem(hwndDlg, IDCANCEL)); + } + break; + case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 9109ab5354..e435e2627b 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "file.h" -#define HM_RECVEVENT (WM_USER+10) - static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i) { if (dat->send) return 1; -- cgit v1.2.3