diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-13 19:53:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-13 19:53:55 +0000 |
commit | 087300b294b87ab2705244908ec932a5a8c98262 (patch) | |
tree | 2f95e894f876d3d8876ac8f1902edc994b9992bd /plugins/TabSRMM/src/msgdialog.cpp | |
parent | cb6be442595479bfd577d4cc7399861ff246f5e7 (diff) |
fix for the url extractor
git-svn-id: http://svn.miranda-ng.org/main/trunk@11377 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/msgdialog.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0b14a60e49..a97008bf54 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2064,24 +2064,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_RBUTTONDOWN: case WM_LBUTTONUP: { - CHARRANGE sel; - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin != sel.cpMax) - break; - - TEXTRANGEW tr; - tr.chrg = ((ENLINK*)lParam)->chrg; - tr.lpstrText = (TCHAR*)_alloca(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL) { - memmove(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1); - memcpy(tr.lpstrText, _T("mailto:"), 7); - } - if (!IsStringValidLink(tr.lpstrText)) + ptrT tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG))); + if (!IsStringValidLink(tszUrl)) break; if (((ENLINK*)lParam)->msg != WM_RBUTTONDOWN) { - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText); + CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl); SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE)); break; } @@ -2093,11 +2081,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { case IDM_OPENNEW: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, tszUrl); break; case IDM_OPENEXISTING: - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText); + CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl); break; case IDM_COPYLINK: @@ -2105,9 +2093,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tszUrl) + 1)); TCHAR *buf = (TCHAR*)GlobalLock(hData); - mir_tstrcpy(buf, tr.lpstrText); + mir_tstrcpy(buf, tszUrl); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); CloseClipboard(); |