From 5c794a21c8e0c943e69b08a9ba52064149d663a6 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Mon, 23 Jul 2012 18:40:18 +0000 Subject: unicode URLs git-svn-id: http://svn.miranda-ng.org/main/trunk@1134 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/chat/window.cpp | 24 ++++++++++-------------- plugins/TabSRMM/src/containeroptions.cpp | 2 +- plugins/TabSRMM/src/infopanel.cpp | 5 +---- 3 files changed, 12 insertions(+), 19 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/chat/window.cpp b/plugins/TabSRMM/chat/window.cpp index cffaa6ba0b..38274b5d25 100644 --- a/plugins/TabSRMM/chat/window.cpp +++ b/plugins/TabSRMM/chat/window.cpp @@ -2860,20 +2860,20 @@ LABEL_SHOWWINDOW: break; case ID_SEARCH_GOOGLE: { - char szURL[4096]; + TCHAR szURL[4096]; if (pszWord[0]) { - mir_snprintf(szURL, sizeof(szURL), "http://www.google.com/search?q=" TCHAR_STR_PARAM, pszWord); - CallService(MS_UTILS_OPENURL, 1, (LPARAM) szURL); + mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL); } PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); } break; case ID_SEARCH_WIKIPEDIA: { - char szURL[4096]; + TCHAR szURL[4096]; if (pszWord[0]) { - mir_snprintf(szURL, sizeof(szURL), "http://en.wikipedia.org/wiki/" TCHAR_STR_PARAM, pszWord); - CallService(MS_UTILS_OPENURL, 1, (LPARAM) szURL); + mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL); } PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); } @@ -2938,7 +2938,6 @@ LABEL_SHOWWINDOW: isLink = IsStringValidLink(tr.lpstrText); if (isLink) { - char* pszUrl = t2a(tr.lpstrText, 0); if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN) { HMENU hSubMenu; POINT pt; @@ -2950,17 +2949,16 @@ LABEL_SHOWWINDOW: ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt); switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { case ID_NEW: - CallService(MS_UTILS_OPENURL, 1, (LPARAM) pszUrl); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) tr.lpstrText); break; case ID_CURR: - CallService(MS_UTILS_OPENURL, 0, (LPARAM) pszUrl); + CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM) tr.lpstrText); break; case ID_COPY: { - HGLOBAL hData; if (!OpenClipboard(hwndDlg)) break; EmptyClipboard(); - hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1)); lstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); @@ -2970,13 +2968,11 @@ LABEL_SHOWWINDOW: break; } mir_free(tr.lpstrText); - mir_free(pszUrl); return TRUE; } else if (((ENLINK *) lParam)->msg == WM_LBUTTONUP) { - CallService(MS_UTILS_OPENURL, 1, (LPARAM) pszUrl); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) tr.lpstrText); SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); mir_free(tr.lpstrText); - mir_free(pszUrl); return TRUE; } } else if (g_Settings.ClickableNicks) { // clicked a nick name diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 312435c3ab..99cc908fcc 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } case IDC_O_HELP_TITLEFORMAT: - CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://miranda.or.at/TabSRMM/TitleBarFormatting"); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)_T("http://miranda.or.at/TabSRMM/TitleBarFormatting")); break; case IDOK: diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 0dde6d3eda..5480eeea9d 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1650,10 +1650,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam const TCHAR* tszUrl = Utils::extractURLFromRichEdit(e, m_hRich); if (tszUrl) { - char* szUrl = mir_t2a(tszUrl); - - CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl); - mir_free(szUrl); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tszUrl); mir_free(const_cast(tszUrl)); } ::DestroyWindow(hwnd); -- cgit v1.2.3