diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-15 18:47:45 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-15 18:47:45 +0300 |
commit | 42fee4bf18089b08790194f64687158e344e56b1 (patch) | |
tree | 0b0a6eb299b8e9f748de96e91f17bbafa73695da /plugins/TabSRMM | |
parent | 478b3261723a914310271ece3ef91abc9ce2b4cc (diff) |
WM_DROPFILES / WM_PASTE processing unification
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 14 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 104 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/srmm.cpp | 1 |
5 files changed, 0 insertions, 122 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index d036181d41..305b33fc1a 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1731,10 +1731,6 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_NCPAINT:
return CSkin::DrawRichEditFrame(m_message.GetHwnd(), this, ID_EXTBKINPUTAREA, msg, wParam, lParam, stubMessageProc);
- case WM_DROPFILES:
- SendMessage(m_hwnd, WM_DROPFILES, wParam, lParam);
- return 0;
-
case WM_CHAR:
KbdState(isShift, isCtrl, isAlt);
@@ -1762,11 +1758,6 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) ActivateTooltip(IDC_SRMM_MESSAGE, szBuffer);
}
}
- else if (hClip = GetClipboardData(CF_BITMAP))
- SendHBitmapAsFile((HBITMAP)hClip);
- else if (hClip = GetClipboardData(CF_HDROP))
- SendMessage(m_hwnd, WM_DROPFILES, WPARAM(hClip), 0);
-
CloseClipboard();
}
break;
@@ -2646,11 +2637,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) CB_DestroyAllButtons();
return 0;
- case WM_DROPFILES:
- if (!ProcessFileDrop((HDROP)wParam, m_cache->getActiveContact()))
- ActivateTooltip(IDC_SRMM_MESSAGE, TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
- return 0;
-
case DM_CHECKQUEUEFORCLOSE:
{
int *uOpen = (int*)lParam;
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 4ee9fc0d87..747af1f254 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1883,110 +1883,6 @@ void CMsgDialog::SaveSplitter() }
/////////////////////////////////////////////////////////////////////////////////////////
-// send a pasted bitmap by file transfer.
-
-static LIST<wchar_t> vTempFilenames(5);
-
-void CMsgDialog::SendHBitmapAsFile(HBITMAP hbmp) const
-{
- const wchar_t *mirandatempdir = L"Miranda";
- const wchar_t *filenametemplate = L"\\clp-%Y%m%d-%H%M%S0.jpg";
- wchar_t filename[MAX_PATH];
- size_t tempdirlen = GetTempPath(MAX_PATH, filename);
- bool fSend = true;
-
- const char *szProto = m_cache->getActiveProto();
- int wMyStatus = Proto_GetStatus(szProto);
-
- uint32_t protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- uint32_t typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
-
- // check protocol capabilities, status modes and visibility lists (privacy)
- // to determine whether the file can be sent. Throw a warning if any of
- // these checks fails.
- if (!(protoCaps & PF1_FILESEND))
- fSend = false;
-
- if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == m_cache->getActiveStatus() && !(typeCaps & PF4_OFFLINEFILES)))
- fSend = false;
-
- if (!fSend) {
- CWarning::show(CWarning::WARN_SENDFILE, MB_OK | MB_ICONEXCLAMATION | CWarning::CWF_NOALLOWHIDE);
- return;
- }
-
- if (tempdirlen <= 0 || tempdirlen >= MAX_PATH - mir_wstrlen(mirandatempdir) - mir_wstrlen(filenametemplate) - 2) // -2 is because %Y takes 4 symbols
- filename[0] = 0; // prompt for a new name
- else {
- mir_wstrcpy(filename + tempdirlen, mirandatempdir);
- if ((GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES || ((GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) == 0)) && CreateDirectory(filename, nullptr) == 0)
- filename[0] = 0;
- else {
- tempdirlen = mir_wstrlen(filename);
-
- time_t rawtime;
- time(&rawtime);
- const tm *timeinfo;
- timeinfo = _localtime32((__time32_t *)& rawtime);
- wcsftime(filename + tempdirlen, MAX_PATH - tempdirlen, filenametemplate, timeinfo);
- size_t firstnumberpos = tempdirlen + 14;
- size_t lastnumberpos = tempdirlen + 20;
- while (GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES) { // while it exists
- for (size_t pos = lastnumberpos; pos >= firstnumberpos; pos--)
- if (filename[pos]++ != '9')
- break;
- else
- if (pos == firstnumberpos)
- filename[0] = 0; // all filenames exist => prompt for a new name
- else
- filename[pos] = '0';
- }
- }
- }
-
- if (filename[0] == 0) { // prompting to save
- wchar_t filter[MAX_PATH];
- mir_snwprintf(filter, L"%s%c*.jpg%c%c", TranslateT("JPEG-compressed images"), 0, 0, 0);
-
- OPENFILENAME dlg;
- dlg.lStructSize = sizeof(dlg);
- dlg.lpstrFilter = filter;
- dlg.nFilterIndex = 1;
- dlg.lpstrFile = filename;
- dlg.nMaxFile = MAX_PATH;
- dlg.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
- dlg.lpstrDefExt = L"jpg";
- if (!GetSaveFileName(&dlg))
- return;
- }
-
- IMGSRVC_INFO ii;
- ii.cbSize = sizeof(ii);
- ii.hbm = hbmp;
- ii.pwszName = filename;
- ii.dwMask = IMGI_HBITMAP;
- ii.fif = FIF_JPEG;
- if (!Image_Save(&ii)) {
- CWarning::show(CWarning::WARN_SAVEFILE, MB_OK | MB_ICONEXCLAMATION | CWarning::CWF_NOALLOWHIDE);
- return;
- }
-
- vTempFilenames.insert(mir_wstrdup(filename));
-
- wchar_t *ppFiles[2] = { filename, 0 };
- File::Send(m_cache->getActiveContact(), ppFiles);
-}
-
-// remove all temporary files created by the "send clipboard as file" feature.
-void TSAPI CleanTempFiles()
-{
- for (auto &it : vTempFilenames) {
- DeleteFileW(it);
- mir_free(it);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// Sets a status bar text for a contact
void CMsgDialog::SetStatusText(const wchar_t *wszText, HICON hIcon)
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 963e0bdbdf..84a0c4186a 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -39,6 +39,4 @@ void TSAPI RearrangeTab(HWND hwndDlg, const CMsgDialog *dat, int iMode, BOOL bool TSAPI IsStatusEvent(int eventType);
bool TSAPI IsCustomEvent(int eventType);
-void TSAPI CleanTempFiles();
-
#endif
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index c39d333514..ce555f1157 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -430,7 +430,6 @@ class CMsgDialog : public CSrmmBaseDialog void PlayIncomingSound(void) const;
LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, WPARAM wParam, LPARAM lParam);
void SaveAvatarToFile(HBITMAP hbm, int isOwnPic);
- void SendHBitmapAsFile(HBITMAP hbmp) const;
void ShowPopupMenu(const CCtrlBase&, POINT pt);
void StreamEvents(MEVENT, int, bool);
void UpdateWindowIcon(void);
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index e5d51e9202..f594448dbf 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -136,7 +136,6 @@ int CMPlugin::Unload() int iRet = SplitmsgShutdown();
Skin->setupTabCloseBitmap(true);
Skin->UnloadAeroTabs();
- CleanTempFiles();
SendLater::shutDown();
delete Skin;
delete sendQueue;
|