From 51f216f7e0feb67ad21387219c1b90e42b14658d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 16 May 2018 13:42:19 +0300 Subject: Core plugins => CMPlugin --- src/core/stdfile/src/file.cpp | 12 ++++++------ src/core/stdfile/src/fileexistsdlg.cpp | 2 +- src/core/stdfile/src/fileopts.cpp | 36 +++++++++++++++++----------------- src/core/stdfile/src/filerecvdlg.cpp | 16 +++++++-------- src/core/stdfile/src/filexferdlg.cpp | 14 ++++++------- src/core/stdfile/src/ftmanager.cpp | 20 +++++++++---------- src/core/stdfile/src/main.cpp | 9 ++------- src/core/stdfile/src/stdafx.h | 11 ++++++++--- 8 files changed, 60 insertions(+), 60 deletions(-) (limited to 'src/core/stdfile') diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 089f5d999f..9dda11aa92 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -47,7 +47,7 @@ static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) struct FileSendData fsd; fsd.hContact = hContact; fsd.ppFiles = nullptr; - return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); + return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); } static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) @@ -65,7 +65,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) fsd.ppFiles[i] = mir_a2u(ppFiles[i]); fsd.ppFiles[count] = nullptr; - HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); + HWND hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); for (int j = 0; j < count; j++) mir_free((void*)fsd.ppFiles[j]); return (INT_PTR)hWnd; @@ -76,7 +76,7 @@ static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) FileSendData fsd; fsd.hContact = hContact; fsd.ppFiles = (const wchar_t**)lParam; - return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); + return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); } static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) @@ -91,7 +91,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam); return 0; } @@ -101,8 +101,8 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) cle.hContact = hContact; cle.hDbEvent = hdbe; cle.lParam = lParam; - if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle); + if (db_get_b(NULL, MODULENAME, "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) { + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle); } else { Skin_PlaySound("RecvFile"); diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index 7a8125d02a..60b1dc43e9 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -184,7 +184,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) } else iconIndex = 0; - HICON hIcon = ExtractIcon(hInst, szIconFile, iconIndex); + HICON hIcon = ExtractIcon(g_plugin.getInst(), szIconFile, iconIndex); if (hIcon) fileInfo.hIcon = hIcon; } diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index ef06a6d4b2..3d75637686 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -66,16 +66,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE); SetDlgItemText(hwndDlg, IDC_FILEDIR, str); - CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED); - switch (db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) { + CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, MODULENAME, "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, MODULENAME, "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, MODULENAME, "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, MODULENAME, "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED); + switch (db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE)) { case VIRUSSCAN_AFTERDL: CheckDlgButton(hwndDlg, IDC_SCANAFTERDL, BST_CHECKED); break; case VIRUSSCAN_DURINGDL: CheckDlgButton(hwndDlg, IDC_SCANDURINGDL, BST_CHECKED); break; default: CheckDlgButton(hwndDlg, IDC_NOSCANNER, BST_CHECKED); break; } - CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, MODULENAME, "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED); for (int i = 0; i < _countof(virusScanners); i++) { wchar_t szScanExe[MAX_PATH]; @@ -90,7 +90,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } DBVARIANT dbv; - if (db_get_ws(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) { + if (db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv) == 0) { SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal); db_free(&dbv); } @@ -99,7 +99,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0); } - switch (db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK)) { + switch (db_get_b(NULL, MODULENAME, "IfExists", FILERESUME_ASK)) { case FILERESUME_RESUMEALL: CheckDlgButton(hwndDlg, IDC_RESUME, BST_CHECKED); break; case FILERESUME_OVERWRITEALL: CheckDlgButton(hwndDlg, IDC_OVERWRITE, BST_CHECKED); break; case FILERESUME_RENAMEALL: CheckDlgButton(hwndDlg, IDC_RENAME, BST_CHECKED); break; @@ -205,16 +205,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t str[512]; GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str)); RemoveInvalidPathChars(str); - db_set_ws(NULL, "SRFile", "RecvFilesDirAdv", str); - db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT)); - db_set_b(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); - db_set_b(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); - db_set_b(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR)); - db_set_b(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE))); + db_set_ws(NULL, MODULENAME, "RecvFilesDirAdv", str); + db_set_b(NULL, MODULENAME, "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT)); + db_set_b(NULL, MODULENAME, "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); + db_set_b(NULL, MODULENAME, "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); + db_set_b(NULL, MODULENAME, "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR)); + db_set_b(NULL, MODULENAME, "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE))); GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str)); - db_set_ws(NULL, "SRFile", "ScanCmdLine", str); - db_set_b(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING)); - db_set_b(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(hwndDlg, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL)))); + db_set_ws(NULL, MODULENAME, "ScanCmdLine", str); + db_set_b(NULL, MODULENAME, "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING)); + db_set_b(NULL, MODULENAME, "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(hwndDlg, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL)))); return TRUE; } break; @@ -226,7 +226,7 @@ int FileOptInitialise(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 900000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER); odp.szTitle.a = LPGEN("File transfers"); odp.szGroup.a = LPGEN("Events"); diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 36160ebdf0..3db0e42786 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -125,7 +125,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B { wchar_t tszTemp[MAX_PATH]; - ptrW tszRecvPath(db_get_wsa(NULL, "SRFile", "RecvFilesDirAdv")); + ptrW tszRecvPath(db_get_wsa(NULL, MODULENAME, "RecvFilesDirAdv")); if (tszRecvPath) wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else @@ -165,7 +165,7 @@ void GetReceivedFilesDir(wchar_t *szDir, int cchDir) { wchar_t tszTemp[MAX_PATH]; - ptrW tszRecvPath(db_get_wsa(NULL, "SRFile", "RecvFilesDirAdv")); + ptrW tszRecvPath(db_get_wsa(NULL, MODULENAME, "RecvFilesDirAdv")); if (tszRecvPath) wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l mir_snprintf(idstr, "MruDir%d", i); DBVARIANT dbv; - if (db_get_ws(NULL, "SRFile", idstr, &dbv)) + if (db_get_ws(NULL, MODULENAME, idstr, &dbv)) break; SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal); db_free(&dbv); @@ -257,7 +257,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl); SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right - rcDateCtrl.left - (rcBtn2.left - rcBtn1.left), rcDateCtrl.bottom - rcDateCtrl.top, SWP_NOZORDER | SWP_NOMOVE); } - else if (db_get_b(NULL, "SRFile", "AutoAccept", 0)) { + else if (db_get_b(NULL, MODULENAME, "AutoAccept", 0)) { //don't check auto-min here to fix BUG#647620 PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK)); } @@ -313,12 +313,12 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBVARIANT dbv; for (i = MAX_MRU_DIRS-2;i>=0;i--) { mir_snprintf(idstr, "MruDir%d", i); - if (db_get_ws(NULL, "SRFile", idstr, &dbv)) continue; + if (db_get_ws(NULL, MODULENAME, idstr, &dbv)) continue; mir_snprintf(idstr, "MruDir%d", i+1); - db_set_ws(NULL, "SRFile", idstr, dbv.ptszVal); + db_set_ws(NULL, MODULENAME, idstr, dbv.ptszVal); db_free(&dbv); } - db_set_ws(NULL, "SRFile", idstr, szRecvDir); + db_set_ws(NULL, MODULENAME, idstr, szRecvDir); } } EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAMES), FALSE); @@ -332,7 +332,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->hwndTransfer = FtMgr_AddTransfer(dat); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); //check for auto-minimize here to fix BUG#647620 - if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && db_get_b(NULL, "SRFile", "AutoMin", 0)) { + if (db_get_b(NULL, MODULENAME, "AutoAccept", 0) && db_get_b(NULL, MODULENAME, "AutoMin", 0)) { ShowWindow(hwndDlg, SW_HIDE); ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE); } diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 7cfd4097ad..f5227c6f79 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -31,7 +31,7 @@ static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i) if (dat->send) return 1; if (dat->fileVirusScanned == nullptr) return 0; if (dat->fileVirusScanned[i]) return 1; - if (db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1; + if (db_get_b(NULL, MODULENAME, "WarnBeforeOpening", 1) == 0) return 1; return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File received"), MB_YESNO|MB_DEFBUTTON2); } @@ -94,7 +94,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei) static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) { DBVARIANT dbv; - if (!db_get_ws(NULL, "SRFile", "ScanCmdLine", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv)) { if (dbv.ptszVal[0]) { STARTUPINFO si = { 0 }; si.cb = sizeof(si); @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath); dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath); if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK; - else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK); + else dat->resumeBehaviour = db_get_b(NULL, MODULENAME, "IfExists", FILERESUME_ASK); SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); } @@ -518,7 +518,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemTextA(hwndDlg, IDC_FILENAME, ""); if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles > 1 && !dat->send) SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); - if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) { + if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) { if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0); else { @@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dat->resumeBehaviour == FILERESUME_ASK) { TDlgProcFileExistsParam param = { hwndDlg, fts }; ShowWindow(hwndDlg, SW_SHOWNORMAL); - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)¶m); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)¶m); EnableWindow(hwndDlg, FALSE); } else { @@ -649,7 +649,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR LPGENW("Transfer completed, open folder."), FTS_OPEN); - int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE); + int useScanner = db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE); if (useScanner != VIRUSSCAN_DISABLE) { struct virusscanthreadstartinfo *vstsi; vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo)); @@ -706,7 +706,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_SIZE: - Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_FILETRANSFERINFO), FileTransferDlgResizer); + Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FILETRANSFERINFO), FileTransferDlgResizer); RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE); RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE); diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp index 00ba7cd691..46d329b9f2 100644 --- a/src/core/stdfile/src/ftmanager.cpp +++ b/src/core/stdfile/src/ftmanager.cpp @@ -163,7 +163,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (i == dat->wnds->realCount) PostMessage(GetParent(hwnd), WM_TIMER, 1, NULL); - if(dat->runningCount == 0 && wParam == ACKRESULT_SUCCESS && db_get_b(NULL, "SRFile", "AutoClose", 0)) + if(dat->runningCount == 0 && wParam == ACKRESULT_SUCCESS && db_get_b(NULL, MODULENAME, "AutoClose", 0)) ShowWindow(hwndFtMgr, SW_HIDE); break; @@ -276,8 +276,8 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM dat->hhkPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwnd, M_PRESHUTDOWN); - dat->hwndIncoming = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc); - dat->hwndOutgoing = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc); + dat->hwndIncoming = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc); + dat->hwndOutgoing = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc); ShowWindow(dat->hwndIncoming, SW_SHOW); tci.mask = TCIF_PARAM|TCIF_TEXT; @@ -288,7 +288,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM tci.lParam = (LPARAM)dat->hwndOutgoing; TabCtrl_InsertItem(hwndTab, 1, &tci); - Utils_RestoreWindowPosition(hwnd, NULL, "SRFile", "FtMgrDlg_", RWPF_NOACTIVATE); + Utils_RestoreWindowPosition(hwnd, NULL, MODULENAME, "FtMgrDlg_", RWPF_NOACTIVATE); // Fall through to setup initial placement } case WM_SIZE: @@ -414,7 +414,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_CLOSE: ShowWindow(hwnd, SW_HIDE); - if (db_get_b(NULL, "SRFile", "AutoClear", 1)) { + if (db_get_b(NULL, MODULENAME, "AutoClear", 1)) { PostMessage(dat->hwndIncoming, WM_FT_CLEANUP, 0, 0); PostMessage(dat->hwndOutgoing, WM_FT_CLEANUP, 0, 0); } @@ -427,7 +427,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM DestroyWindow(dat->hwndOutgoing); mir_free(dat); SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); - Utils_SaveWindowPosition(hwnd, NULL, "SRFile", "FtMgrDlg_"); + Utils_SaveWindowPosition(hwnd, NULL, MODULENAME, "FtMgrDlg_"); break; case WM_ACTIVATE: @@ -476,11 +476,11 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND FtMgr_Show(bool bForceActivate, bool bFromMenu) { - bool bAutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */ + bool bAutoMin = db_get_b(NULL, MODULENAME, "AutoMin", 0) != 0; /* lqbe */ bool bJustCreated = (hwndFtMgr == nullptr); if (bJustCreated) - hwndFtMgr = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc); + hwndFtMgr = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc); if (bFromMenu) { /* lqbe */ ShowWindow(hwndFtMgr, SW_RESTORE); @@ -520,13 +520,13 @@ void FtMgr_ShowPage(int page) HWND FtMgr_AddTransfer(FileDlgData *fdd) { - bool bForceActivate = fdd->send || !db_get_b(NULL, "SRFile", "AutoAccept", 0); + bool bForceActivate = fdd->send || !db_get_b(NULL, MODULENAME, "AutoAccept", 0); TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA); if (dat == nullptr) return nullptr; HWND hwndBox = fdd->send ? dat->hwndOutgoing : dat->hwndIncoming; - HWND hwndFt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd); + HWND hwndFt = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd); ShowWindow(hwndFt, SW_SHOWNA); SendMessage(hwndBox, WM_FT_ADD, 0, (LPARAM)hwndFt); FtMgr_ShowPage(fdd->send ? 1 : 0); diff --git a/src/core/stdfile/src/main.cpp b/src/core/stdfile/src/main.cpp index 51e71e11ab..36ef0dcfdc 100644 --- a/src/core/stdfile/src/main.cpp +++ b/src/core/stdfile/src/main.cpp @@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc., int LoadSendRecvFileModule(void); +CMPlugin g_plugin; + CLIST_INTERFACE* pcli; -HINSTANCE hInst; int hLangpack; ITaskbarList3 * pTaskbarInterface; @@ -42,12 +43,6 @@ PLUGININFOEX pluginInfo = { { 0x39698dce, 0x7ed4, 0x4334, {0xac, 0x4c, 0xba, 0x8b, 0x37, 0xa8, 0x6f, 0x13}} }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; diff --git a/src/core/stdfile/src/stdafx.h b/src/core/stdfile/src/stdafx.h index eba834de22..2edc930862 100644 --- a/src/core/stdfile/src/stdafx.h +++ b/src/core/stdfile/src/stdafx.h @@ -43,9 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#define __NO_CMPLUGIN_NEEDED #include - #include #include #include @@ -74,6 +72,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../mir_app/src/resource.h" -extern HINSTANCE hInst; +#define MODULENAME "SRFile" + +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULENAME) + {} +}; extern ITaskbarList3 * pTaskbarInterface; -- cgit v1.2.3