From ba456be50d3b780e4accf075ba78d5badf282b05 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 Jun 2015 19:09:56 +0000 Subject: MS_UTIL_OPENURL -> mir_core::Utils_OpenUrl git-svn-id: http://svn.miranda-ng.org/main/trunk@14306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BASS_interface/src/Main.cpp | 2 +- plugins/BasicHistory/src/HistoryWindow.cpp | 2 +- plugins/Clist_modern/src/modern_toolbar.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 2 +- plugins/CrashDumper/src/upload.cpp | 4 +- plugins/Db3x_mmap/src/dbheaders.cpp | 2 +- plugins/HTTPServer/src/GuiElements.cpp | 15 +-- plugins/HistoryLinkListPlus/src/linklist_dlg.cpp | 19 +-- plugins/HistoryPlusPlus/hpp_global.pas | 13 +- plugins/HistoryPlusPlus/hpp_opt_dialog.pas | 2 +- plugins/IEView/src/IEView.cpp | 4 +- plugins/ModernOpt/src/modernopt.cpp | 2 +- plugins/ModernOpt/src/mopt_home.cpp | 2 +- plugins/Msg_Export/src/FileViewer.cpp | 2 +- plugins/Non-IM Contact/src/main.cpp | 4 +- plugins/PackUpdater/Src/Notifications.cpp | 6 +- plugins/PluginUpdater/src/DlgListNew.cpp | 2 +- plugins/Popup/src/opt_skins.cpp | 2 +- plugins/Scriver/src/input.cpp | 2 +- plugins/Scriver/src/utils.cpp | 2 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 2 +- plugins/SimpleStatusMsg/src/msgbox.cpp | 4 +- plugins/SimpleStatusMsg/src/utils.cpp | 2 +- plugins/SpellChecker/src/options.cpp | 2 +- plugins/TabSRMM/src/chat/window.cpp | 22 ++- plugins/TabSRMM/src/containeroptions.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 3 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 6 +- plugins/TabSRMM/src/msgoptions.cpp | 10 +- plugins/TabSRMM/src/sendlater.cpp | 2 +- plugins/TabSRMM/src/templates.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 2 +- plugins/TipperYM/src/options.cpp | 2 +- plugins/UserInfoEx/src/ctrl_edit.cpp | 165 ++++++++++------------- plugins/UserInfoEx/src/svc_email.cpp | 2 +- plugins/UserInfoEx/src/svc_homepage.cpp | 2 +- plugins/Weather/src/weather_contacts.cpp | 11 +- plugins/Weather/src/weather_ini.cpp | 5 +- plugins/Weather/src/weather_userinfo.cpp | 6 +- plugins/WebView/src/webview.cpp | 8 +- plugins/WebView/src/webview_alerts.cpp | 12 +- plugins/WebView/src/webview_datawnd.cpp | 4 +- plugins/YAMN/src/proto/pop3/pop3opt.cpp | 2 +- 44 files changed, 156 insertions(+), 215 deletions(-) (limited to 'plugins') diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 71c227194c..5bc586b9a1 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -301,7 +301,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case IDC_GETBASS: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://www.un4seen.com/"); + Utils_OpenUrl("http://www.un4seen.com/"); break; } break; diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index e0dd0ff8bc..6c8262cf10 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -526,7 +526,7 @@ void ClickLink(HWND hwnd, ENLINK *penLink) tr.chrg = penLink->chrg; tr.lpstrText = buf; SendMessage(hwnd, EM_GETTEXTRANGE, 0, (LPARAM) & tr); - CallService(MS_UTILS_OPENURL, (penLink->nmhdr.code == IDM_OPENNEW ? OUF_NEWWINDOW : 0) | OUF_TCHAR, (LPARAM) tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText, penLink->nmhdr.code == IDM_OPENNEW); } } } diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 2e4cdd5ba4..2b50be863d 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -349,7 +349,7 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) if (!ServiceExists(MS_TTB_REMOVEBUTTON) && bOldSetting == 1) if (IDYES == MessageBox(NULL, TranslateTS(szWarning), TranslateT("Toolbar upgrade"), MB_ICONQUESTION | MB_YESNO)) - CallService(MS_UTILS_OPENURL, 0, (LPARAM)szUrl); + Utils_OpenUrl(szUrl); return 0; } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 94dddfd150..810855072a 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1869,7 +1869,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar DestroyWindow(hwndDlg); return TRUE; case IDC_SUPPORT: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/"); + Utils_OpenUrl("http://miranda-ng.org/"); break; } break; diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index f277c1eec7..fbd87e2f5c 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -71,9 +71,9 @@ void OpenAuthUrl(const char* url) char str[256]; mir_snprintf(str, url, user); // XXX: fix me mir_snprintf(str, "http://vi.miranda-ng.org/detail/%s", user); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)str); + Utils_OpenUrl(str); } - else CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://vi.miranda-ng.org/"); + else Utils_OpenUrl("http://vi.miranda-ng.org/"); } void CreateAuthString(char* auth) diff --git a/plugins/Db3x_mmap/src/dbheaders.cpp b/plugins/Db3x_mmap/src/dbheaders.cpp index 2a5c15de99..a8089aca16 100644 --- a/plugins/Db3x_mmap/src/dbheaders.cpp +++ b/plugins/Db3x_mmap/src/dbheaders.cpp @@ -81,7 +81,7 @@ int CDb3Mmap::CheckDbHeaders(bool bInteractive) RegCloseKey(hPathSetting); } - CallService(MS_UTILS_OPENURL, 0, LPARAM("http://wiki.miranda-ng.org/index.php?title=Updating_pre-0.94.9_version_to_0.95.1_and_later")); + Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Updating_pre-0.94.9_version_to_0.95.1_and_later"); Sleep(1000); exit(0); } diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index b76183bcf3..8750275df3 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -928,22 +928,15 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara MessageBox(hwndDlg, TranslateT("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK); CloseClipboard(); - } else { - CallService(MS_UTILS_OPENURL, 0, (LPARAM)sLink.c_str()); } - } else { - MessageBox(hwndDlg, TranslateT("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK); + else Utils_OpenUrl(sLink.c_str()); } - } else { - MessageBox(hwndDlg, TranslateT("No share selected"), MSG_BOX_TITEL, MB_OK); + else MessageBox(hwndDlg, TranslateT("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK); } + else MessageBox(hwndDlg, TranslateT("No share selected"), MSG_BOX_TITEL, MB_OK); + return TRUE; } - /* - case IDCANCEL: - case IDOK: - DestroyWindow(hwndDlg); - return TRUE;*/ } break; } diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index b42543771d..edf22e89e2 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -104,7 +104,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (((LPNMHDR)lParam)->code != EN_LINK) break; LPTSTR link; - BYTE openNewWindow, mouseEvent; + BYTE mouseEvent; ENLINK *pENLink = (ENLINK*)lParam; mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF); @@ -123,16 +123,11 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&pENLink->chrg); SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETSELTEXT, 0, (LPARAM)link); - if (_tcsstr(link, _T("mailto:")) != NULL) { + if (_tcsstr(link, _T("mailto:")) != NULL) ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); - } else { - openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF); - if (openNewWindow == 0xFF) - openNewWindow = 0; - else - openNewWindow = OUF_NEWWINDOW; - - CallService(MS_UTILS_OPENURL, openNewWindow | OUF_TCHAR, (LPARAM)link); + else { + bool openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF) != 0xFF; + Utils_OpenUrlT(link); } mir_free(link); break; @@ -162,13 +157,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (_tcsstr(link, _T("mailto:")) != NULL) ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); else - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)link); + Utils_OpenUrlT(link); break; case IDM_LINK_OPENNEW: if (_tcsstr(link, _T("mailto:")) != NULL) ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); else - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)link); + Utils_OpenUrlT(link); break; case IDM_LINK_COPY: { size_t dataLen; diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas index a1e19d21aa..d0b04669c6 100644 --- a/plugins/HistoryPlusPlus/hpp_global.pas +++ b/plugins/HistoryPlusPlus/hpp_global.pas @@ -433,17 +433,6 @@ var URLTextW: String; URLTextA: AnsiString; begin -{ - if EncodeURL(URLText, URLTextW) then - begin - URLTextA := WideToAnsiString(URLTextW, CP_ACP); - if not SameStr(URLTextW, AnsiToWideString(URLTextA, CP_ACP)) then - URLTextA := QuoteURL(URLTextW); - end - else - URLTextA := WideToAnsiString(URLText, CP_ACP); - CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); -} if EncodeURL(URLText, URLTextW) then begin URLTextA := AnsiString(URLTextW); @@ -452,7 +441,7 @@ begin end else URLTextA := AnsiString(URLText); - CallService(MS_UTILS_OPENURL,WPARAM(NewWindow),LPARAM(@URLTextA[1])); + Utils_OpenUrl(@URLTextA[1]); end; function AnsiToWideString(const S: AnsiString; CodePage: Cardinal; InLength: Integer = -1): WideString; diff --git a/plugins/HistoryPlusPlus/hpp_opt_dialog.pas b/plugins/HistoryPlusPlus/hpp_opt_dialog.pas index ab70486199..36a93ccbb5 100644 --- a/plugins/HistoryPlusPlus/hpp_opt_dialog.pas +++ b/plugins/HistoryPlusPlus/hpp_opt_dialog.pas @@ -255,7 +255,7 @@ begin WM_COMMAND: begin case LoWord(wParam) of ID_NEEDOPTIONS_LINK: begin - CallService(MS_UTILS_OPENURL,TWPARAM(True),TLPARAM(PAnsiChar(URL_NEEDOPTIONS))); + Utils_OpenUrl(URL_NEEDOPTIONS); Result := 1; end; else diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 098cb1a71f..45bee1cf40 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -170,7 +170,7 @@ void IEViewSink::BeforeNavigate2(IDispatch*, VARIANT* url, VARIANT*, VARIANT*, V #ifndef GECKO if (mir_tstrcmp(url->bstrVal, _T("about:blank"))) { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)url->bstrVal); + Utils_OpenUrlT(url->bstrVal); *cancel = VARIANT_TRUE; } #endif @@ -1035,7 +1035,7 @@ bool IEView::mouseClick(POINT pt) if ((GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000)) SendMessage(GetParent(hwnd), WM_COMMAND, IDCANCEL, 0); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)url); + Utils_OpenUrlT(url); return true; } } diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index 0e7d47fb0d..186670df28 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -231,7 +231,7 @@ static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[dat->iPage]; if (obj->optObject.lpzHelpUrl) - CallService(MS_UTILS_OPENURL,0,(LPARAM)obj->optObject.lpzHelpUrl); + Utils_OpenUrl(obj->optObject.lpzHelpUrl); } break; diff --git a/plugins/ModernOpt/src/mopt_home.cpp b/plugins/ModernOpt/src/mopt_home.cpp index c8154a4e12..e89026193f 100644 --- a/plugins/ModernOpt/src/mopt_home.cpp +++ b/plugins/ModernOpt/src/mopt_home.cpp @@ -53,7 +53,7 @@ INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND: switch ( LOWORD(wParam)) { case IDC_BTN_HELP: - CallService(MS_UTILS_OPENURL,OUF_TCHAR,(LPARAM)_T("http://miranda-ng.org/")); + Utils_OpenUrl("http://miranda-ng.org/"); break; default: diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 87a4b04606..b5027a7506 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -1167,7 +1167,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, stToGet.chrg = pstLink->chrg; stToGet.lpstrText = szUrl; if (SendMessage(pstLink->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&stToGet) > 0) - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl); + Utils_OpenUrlT(szUrl); return TRUE; } diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 5b41419efd..1fd92e6c59 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -36,10 +36,10 @@ INT_PTR doubleClick(WPARAM wParam, LPARAM lParam) if (!db_get_static(wParam, MODNAME, "ProgramParams", params, _countof(params))) mir_strcpy(params, ""); if (strstr(program, "http://") || strstr(program, "https://")) - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)program); + Utils_OpenUrl(program); else shellEXEerror = (int)ShellExecuteA(NULL, NULL, program, params, NULL, SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :) if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND) - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)program); + Utils_OpenUrl(program); } else editContact(wParam, 0); return 1; diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 4af9065bf3..431b5a373a 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -381,7 +381,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5]; if (mir_tstrcmp(tszExt, _T(".html")) == 0) { char* szUrl = mir_t2a(todo[i].File.tszDownloadURL); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl); + Utils_OpenUrl(szUrl); mir_free(szUrl); } else { @@ -529,9 +529,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case IDC_INFO: int sel = ListView_GetSelectionMark(hwndList); vector &todo = *(vector *)GetWindowLongPtr(hDlg, GWLP_USERDATA); - char* szUrl = mir_t2a(todo[sel].tszInfoURL); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl); - mir_free(szUrl); + Utils_OpenUrlT(todo[sel].tszInfoURL); } break; } diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index cd8f86a4ee..b331b0ee67 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -114,7 +114,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP TCHAR link[MAX_PATH]; mir_sntprintf(link, _countof(link), PLUGIN_INFO_URL, tszFileName); - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM) link); + Utils_OpenUrlT(link); } } } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 25bf6ce808..858ab90075 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -399,7 +399,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case IDC_GETSKINS: - CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://miranda-ng.org/addons/category/13"); + Utils_OpenUrl("http://miranda-ng.org/addons/category/13"); break; case IDC_BTN_RELOAD: diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index a0f1370476..d1ec8952fe 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -409,7 +409,7 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * DestroyMenu(hMenu); } if (bOpenLink) - CallService(MS_UTILS_OPENURL, OUF_TCHAR | OUF_NEWWINDOW, (LPARAM)tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText); SetFocus(hwndFocus); mir_free(tr.lpstrText); diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index fad8d388c0..4e650afb20 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -400,7 +400,7 @@ void SearchWord(TCHAR * word, int engine) break; } - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szURL); + Utils_OpenUrl(szURL); } } diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 30d89eeb56..d130a8314d 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -351,7 +351,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) char *szMsgURL = (char *)mir_alloc(i + 1); if (szMsgURL) { mir_strncpy(szMsgURL, szURL, i + 1); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szMsgURL); + Utils_OpenUrl(szMsgURL); mir_free(szMsgURL); } } diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 0ce63d8e39..62fae706de 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -445,11 +445,11 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) break; case ID__FORTUNEAWAYMSG: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/"); + Utils_OpenUrl("http://miranda-ng.org/"); break; case ID__VARIABLES: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/"); + Utils_OpenUrl("http://miranda-ng.org/"); break; case ID__VARIABLES_MOREVARIABLES: diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index 486bf5481d..4a32d2ffbc 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -84,7 +84,7 @@ int GetRandom(int from, int to) if ((to - from) < 1) return from; unsigned randnum; - CallService(MS_UTILS_GETRANDOM, sizeof(randnum), (LPARAM)&randnum); + Utils_GetRandom(&randnum, sizeof(randnum)); return ((randnum % (to - from + 1)) + from); } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index bd8a929a04..8596f1679e 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -196,7 +196,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: if (LOWORD(wParam) == IDC_GETMORE) - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.services.openoffice.org/wiki/Dictionaries"); + Utils_OpenUrl("http://wiki.services.openoffice.org/wiki/Dictionaries"); if (LOWORD(wParam) == IDC_DEF_LANG && (HIWORD(wParam) == CBN_SELCHANGE && (HWND)lParam == GetFocus())) { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 05a476ec16..acd55b81c9 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2562,20 +2562,16 @@ LABEL_SHOWWINDOW: break; case ID_SEARCH_GOOGLE: - if (pszWord[0]) { - TCHAR szURL[4096]; - mir_sntprintf(szURL, _countof(szURL), _T("http://www.google.com/search?q=%s"), pszWord); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL); - } + if (pszWord[0]) + Utils_OpenUrlT(CMString(FORMAT, _T("http://www.google.com/search?q=%s"), pszWord)); + PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); break; case ID_SEARCH_WIKIPEDIA: - if (pszWord[0]) { - TCHAR szURL[4096]; - mir_sntprintf(szURL, _countof(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL); - } + if (pszWord[0]) + Utils_OpenUrlT(CMString(FORMAT, _T("http://en.wikipedia.org/wiki/%s"), pszWord)); + PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); break; @@ -2633,10 +2629,10 @@ 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, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText); break; case ID_CURR: - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText); break; case ID_COPY: Utils::CopyToClipBoard(tr.lpstrText, hwndDlg); @@ -2647,7 +2643,7 @@ LABEL_SHOWWINDOW: return TRUE; } if (((ENLINK*)lParam)->msg == WM_LBUTTONUP) { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText); SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); mir_free(tr.lpstrText); return TRUE; diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 6e3a6f8583..8cf6f571ed 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } case IDC_O_HELP_TITLEFORMAT: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda.or.at/TabSRMM/TitleBarFormatting")); + Utils_OpenUrl("http://miranda.or.at/TabSRMM/TitleBarFormatting"); break; case IDOK: diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 0b0fcc1ac8..5075eaef36 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -626,8 +626,9 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDCANCEL: DestroyWindow(hwndDlg); return TRUE; + case IDC_SUPPORT: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda.or.at/"); + Utils_OpenUrl("http://miranda.or.at/"); break; } break; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 97c73680fe..69d93b24a2 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1574,7 +1574,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ENLINK *e = reinterpret_cast(lParam); ptrT tszUrl(Utils::extractURLFromRichEdit(e, m_hRich)); if (tszUrl) - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, tszUrl); + Utils_OpenUrlT(tszUrl); ::DestroyWindow(hwnd); } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a280a1b173..464b9dda62 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2021,7 +2021,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; if (pLink->msg != WM_RBUTTONDOWN) { - CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl); + Utils_OpenUrlT(tszUrl); SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE)); break; } @@ -2033,11 +2033,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, tszUrl); + Utils_OpenUrlT(tszUrl); break; case IDM_OPENEXISTING: - CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl); + Utils_OpenUrlT(tszUrl); break; case IDM_COPYLINK: diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 7888c5067b..24337f7518 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -331,7 +331,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_HELP_GENERAL: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/UsingSkins"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/UsingSkins"); break; case IDC_SKIN_CLOSENOW: @@ -594,7 +594,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_HELP_GENERAL: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/GeneralSettings"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/GeneralSettings"); break; case IDC_RESETWARNINGS: @@ -953,7 +953,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam (IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN) || IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN))); break; case IDC_MTN_HELP: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/TypingNotifications"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/TypingNotifications"); return 0; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -1123,7 +1123,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) != 0); break; case IDC_HELP_CONTAINERS: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Containers"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/Containers"); break; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -1203,7 +1203,7 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_COMMAND: if (LOWORD(wParam) == IDC_PLUS_HELP) { - CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/AdvancedTweaks"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/AdvancedTweaks"); break; } else if (LOWORD(wParam) == IDC_PLUS_REVERT) { // revert to defaults... diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 4110f1dc15..53fb83a61e 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -783,7 +783,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_QMGR_HELP: - CallService(MS_UTILS_OPENURL, 0, LPARAM("http://wiki.miranda.or.at/TabSRMM/SendLater")); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/SendLater"); break; // this handles all commands sent by the context menu diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 364f423795..b0ae015ba4 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -234,7 +234,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_VARIABLESHELP: - CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Templates"); + Utils_OpenUrl("http://wiki.miranda.or.at/TabSRMM/Templates"); break; case IDC_EDITTEMPLATE: diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 8bb8a41109..68844d70d1 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -1400,7 +1400,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP const wchar_t *wszUrl = Utils::extractURLFromRichEdit(e, ::GetDlgItem(hwnd, IDC_WARNTEXT)); if (wszUrl) { - CallService(MS_UTILS_OPENURL, OUF_UNICODE, (LPARAM)wszUrl); + Utils_OpenUrlW(wszUrl); mir_free(const_cast(wszUrl)); } } diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index ddf1333b7b..175a8f261e 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -1840,7 +1840,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else if (LOWORD(wParam) == IDC_CHK_LOADPROPORTIONS) opt.bLoadProportions = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADPROPORTIONS) ? true : false; else if (LOWORD(wParam) == IDC_BTN_GETSKINS) - CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://miranda-ng.org/addons/category/48"); + Utils_OpenUrl("http://miranda-ng.org/addons/category/48"); break; } diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 1734518c17..299aeb0663 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -31,14 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * @return This static method returns the pointer of the created object. **/ + CBaseCtrl* CEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE dbType) { - CEditCtrl *ctrl = NULL; - - ctrl = new CEditCtrl(hDlg, idCtrl, USERINFO, pszSetting); - if (ctrl) { + CEditCtrl *ctrl = new CEditCtrl(hDlg, idCtrl, USERINFO, pszSetting); + if (ctrl) ctrl->_dbType = dbType; - } + return (ctrl); } @@ -53,15 +52,14 @@ CBaseCtrl* CEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE * * @return This static method returns the pointer of the created object. **/ + CBaseCtrl* CEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszModule, LPCSTR pszSetting, BYTE dbType) { - CEditCtrl *ctrl = NULL; - - ctrl = new CEditCtrl(hDlg, idCtrl, pszModule, pszSetting); - if (ctrl) { + CEditCtrl *ctrl = new CEditCtrl(hDlg, idCtrl, pszModule, pszSetting); + if (ctrl) ctrl->_dbType = dbType; - } - return (ctrl); + + return ctrl; } /** @@ -105,22 +103,21 @@ void CEditCtrl::OnReset() * * @return nothing **/ + BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) { - if (!_Flags.B.hasChanged) - { + if (!_Flags.B.hasChanged) { DBVARIANT dbv; TCHAR szText[64]; _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = 0; _Flags.W |= DB::Setting::GetTStringCtrl(hContact, _pszModule, _pszModule, pszProto, _pszSetting, &dbv); - - EnableWindow(_hwnd, - !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0)); + + EnableWindow(_hwnd, + !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0)); MIR_FREE(_pszValue); - switch (dbv.type) - { + switch (dbv.type) { case DBVT_BYTE: _itot_s(dbv.bVal, szText, _countof(szText), 10); SetWindowText(_hwnd, szText); @@ -140,13 +137,12 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) break; case DBVT_TCHAR: - if (dbv.ptszVal) - { + if (dbv.ptszVal) { SetWindowText(_hwnd, dbv.ptszVal); _pszValue = dbv.ptszVal; break; } - + default: SetWindowText(_hwnd, _T("")); db_free(&dbv); @@ -165,27 +161,23 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) * * @return nothing **/ + void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) { - if (_Flags.B.hasChanged) - { + if (_Flags.B.hasChanged) { const char* pszModule = hContact ? _pszModule : pszProto; - if (_Flags.B.hasCustom || !hContact) - { + if (_Flags.B.hasCustom || !hContact) { DWORD cch = GetWindowTextLength(_hwnd); - if (cch > 0) - { + if (cch > 0) { LPTSTR val = (LPTSTR)mir_alloc((cch + 1) * sizeof(TCHAR)); - if (GetWindowText(_hwnd, val, cch + 1) > 0) - { + if (GetWindowText(_hwnd, val, cch + 1) > 0) { DBVARIANT dbv; dbv.type = _dbType; - switch (_dbType) - { + switch (_dbType) { case DBVT_BYTE: dbv.bVal = (BYTE)_tcstol(val, NULL, 10); break; @@ -206,17 +198,14 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) dbv.type = DBVT_DELETED; } - if (dbv.type != DBVT_DELETED) - { - if (!db_set(hContact, pszModule, _pszSetting, &dbv)) - { - if (!hContact) - { + if (dbv.type != DBVT_DELETED) { + if (!db_set(hContact, pszModule, _pszSetting, &dbv)) { + if (!hContact) { _Flags.B.hasCustom = 0; _Flags.B.hasProto = 1; } _Flags.B.hasChanged = 0; - + // save new value MIR_FREE(_pszValue); _pszValue = val; @@ -227,14 +216,13 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) MIR_FREE(val); } } - if (_Flags.B.hasChanged) - { + if (_Flags.B.hasChanged) { db_unset(hContact, pszModule, _pszSetting); _Flags.B.hasChanged = 0; OnInfoChanged(hContact, pszProto); - } + } InvalidateRect(_hwnd, NULL, TRUE); } } @@ -246,8 +234,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) **/ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) { - if ((wChangedMsg == EN_UPDATE) || (wChangedMsg == EN_CHANGE)) - { + if ((wChangedMsg == EN_UPDATE) || (wChangedMsg == EN_CHANGE)) { const int cch = GetWindowTextLength(_hwnd); _Flags.B.hasChanged = mir_tstrlen(_pszValue) != cch; @@ -256,13 +243,11 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) if (!_Flags.B.hasChanged && _Flags.B.hasCustom) { BYTE need_free = 0; LPTSTR szText; - - __try - { + + __try { szText = (LPTSTR)alloca((cch + 1) * sizeof(TCHAR)); } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except (EXCEPTION_EXECUTE_HANDLER) { szText = (LPTSTR)mir_alloc((cch + 1) * sizeof(TCHAR)); need_free = 1; } @@ -272,9 +257,8 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) _Flags.B.hasChanged = mir_tstrcmp(_pszValue, szText); if (need_free) MIR_FREE(szText); - } else { - _Flags.B.hasChanged = 0; } + else _Flags.B.hasChanged = 0; } InvalidateRect(_hwnd, NULL, TRUE); @@ -292,75 +276,62 @@ void CEditCtrl::OpenUrl() LPTSTR szUrl; BYTE need_free = 0; - __try - { + __try { szUrl = (LPTSTR)alloca((8 + lenUrl) * sizeof(TCHAR)); } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except (EXCEPTION_EXECUTE_HANDLER) { szUrl = (LPTSTR)mir_alloc((8 + lenUrl) * sizeof(TCHAR)); need_free = 1; } + if (szUrl && (GetWindowText(_hwnd, szUrl, lenUrl) > 0)) - { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szUrl); - } + Utils_OpenUrlT(szUrl); + if (need_free) - { MIR_FREE(szUrl); - } } LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) { if (lnk == NULL) return FALSE; - switch (lnk->msg) - { + + switch (lnk->msg) { case WM_SETCURSOR: - { - SetCursor(LoadCursor(NULL, IDC_HAND)); - SetWindowLongPtr(GetParent(_hwnd), DWLP_MSGRESULT, TRUE); - } + SetCursor(LoadCursor(NULL, IDC_HAND)); + SetWindowLongPtr(GetParent(_hwnd), DWLP_MSGRESULT, TRUE); return TRUE; - case WM_LBUTTONUP: - { - TEXTRANGE tr; - BYTE need_free = 0; + case WM_LBUTTONUP: + TEXTRANGE tr; + BYTE need_free = 0; - // do not call function if user selected some chars of the url string - SendMessage(_hwnd, EM_EXGETSEL, NULL, (LPARAM) &tr.chrg); - if (tr.chrg.cpMax == tr.chrg.cpMin) - { - // retrieve the url string - tr.chrg = lnk->chrg; + // do not call function if user selected some chars of the url string + SendMessage(_hwnd, EM_EXGETSEL, NULL, (LPARAM)&tr.chrg); + if (tr.chrg.cpMax == tr.chrg.cpMin) { + // retrieve the url string + tr.chrg = lnk->chrg; - __try - { - tr.lpstrText = (LPTSTR)alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR)); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - tr.lpstrText = (LPTSTR)mir_alloc((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR)); - need_free = 1; + __try { + tr.lpstrText = (LPTSTR)alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR)); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + tr.lpstrText = (LPTSTR)mir_alloc((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR)); + need_free = 1; + } + if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0)) { + 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)*sizeof(TCHAR)); + memcpy(tr.lpstrText, _T("mailto:"), (7 * sizeof(TCHAR))); } - if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0)) - { - 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)*sizeof(TCHAR)); - memcpy(tr.lpstrText, _T("mailto:"), (7*sizeof(TCHAR))); - } - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText); - } - if (need_free) - { - MIR_FREE(tr.lpstrText); - } + Utils_OpenUrlT(tr.lpstrText); } + + if (need_free) + MIR_FREE(tr.lpstrText); } } return FALSE; -} \ No newline at end of file +} diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index d5890f52e6..f14670ce3c 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -96,7 +96,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) mir_snprintf(szUrl, len + 1, "mailto:%s", val); mir_free(val); - result = CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl); + Utils_OpenUrl(szUrl); } else { result = 1; diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index e1dede08d9..93a0ba9b55 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -70,7 +70,7 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) { LPSTR szUrl = Get(wParam); if (szUrl) { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl); + Utils_OpenUrl(szUrl); mir_free(szUrl); } else MessageBox((HWND)lParam, TranslateT("User has no valid homepage"), TranslateT("View Homepage"), MB_OK); diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 4aed6418df..0bffa5a857 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -25,20 +25,18 @@ the contact. #include "weather.h" -static void OpenUrl( TCHAR* format, TCHAR* id ) +static void OpenUrl(TCHAR* format, TCHAR* id) { TCHAR loc[512]; - - GetID( id ); + GetID(id); mir_sntprintf(loc, _countof(loc), format, id); - - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)loc ); + Utils_OpenUrlT(loc); } //============ BASIC CONTACTS FUNCTIONS AND LINKS ============ - // view weather log for the contact // wParam = current contact + INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) { // see if the log path is set @@ -56,6 +54,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) // read complete forecast // wParam = current contact + INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam) { TCHAR id[256], loc2[256]; diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index c89472cb2c..f39cb973ac 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -553,11 +553,10 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break; case WM_COMMAND: - switch(LOWORD(wParam)) - { + switch(LOWORD(wParam)) { case IDC_STEP1: // update current data - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda-ng.org/")); + Utils_OpenUrl("http://miranda-ng.org/"); break; case IDC_STEP2: diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index aac6aa426e..0eb97fdb30 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -288,14 +288,14 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { LPNMHDR pNmhdr = (LPNMHDR)lParam; if (pNmhdr->idFrom == IDC_MTEXT && pNmhdr->code == EN_LINK) { - ENLINK *enlink = (ENLINK *) lParam; + ENLINK *enlink = (ENLINK *)lParam; switch (enlink->msg) { case WM_LBUTTONUP: TEXTRANGE tr; tr.chrg = enlink->chrg; - tr.lpstrText = ( LPTSTR )mir_alloc( sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); + tr.lpstrText = (LPTSTR)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); SendMessage(pNmhdr->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM) tr.lpstrText); + Utils_OpenUrlT(tr.lpstrText); mir_free(tr.lpstrText); break; } diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index d58f6cfe91..c46d9b9c3e 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -183,8 +183,8 @@ int Doubleclick(WPARAM wParam, LPARAM lParam) int action = db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1); if (action == 0) { - ptrT url( db_get_tsa(hContact, MODULENAME, "URL")); - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (WPARAM)url); + ptrT url(db_get_tsa(hContact, MODULENAME, "URL")); + Utils_OpenUrlT(url); db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); } @@ -456,9 +456,9 @@ int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, MCONTACT singlecontact) INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = wParam; - ptrT url( db_get_tsa(hContact, MODULENAME, "URL")); + ptrT url(db_get_tsa(hContact, MODULENAME, "URL")); if (url) - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); + Utils_OpenUrlT(url); db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); return 0; diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 5e1810cd89..4d5cee7b71 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -41,13 +41,13 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) PUDeletePopup(hWnd); } // open url - if ( db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0)) { - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); + if (db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0)) { + Utils_OpenUrlT(url); PUDeletePopup(hWnd); db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE); } // dismiss - if ( db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1)) + if (db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1)) PUDeletePopup(hWnd); } else if (hContact == NULL) @@ -56,14 +56,14 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) else if (message == WM_CONTEXTMENU) { // right click if (hContact != NULL) { // open datA window - if ( db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0)) { + if (db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0)) { NotifyEventHooks(hHookDisplayDataAlert, (int) hContact, 0); mir_forkthread(GetData, (void*)hContact); PUDeletePopup(hWnd); } // open url - if ( db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1)) { - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); + if (db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1)) { + Utils_OpenUrlT(url); PUDeletePopup(hWnd); db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE); } diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 4c0113f045..09bcbd867d 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -325,7 +325,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA memcpy(tr.lpstrText, "mailto:", 7); } - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM) tr.lpstrText); + Utils_OpenUrl(tr.lpstrText); SetFocus(GetDlgItem(hwndDlg, IDC_DATA)); free(tr.lpstrText); @@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (LOWORD(wParam)) { case IDC_OPEN_URL: GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, _countof(url)); - CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); + Utils_OpenUrlT(url); db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE); break; diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 4aaf1db2c1..337efd256a 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -120,7 +120,7 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam { char str[1024]; GetDlgItemTextA(hDlg,IDC_STWWW,str,_countof(str)); - CallService(MS_UTILS_OPENURL,OUF_NEWWINDOW,(LPARAM)str); + Utils_OpenUrl(str); break; } -- cgit v1.2.3