diff options
97 files changed, 296 insertions, 399 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 875f73b744..7e064ed31b 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex 2d86f6d572..96a43396d5 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib Binary files differindex 875f73b744..7e064ed31b 100644 --- a/bin12/lib/mir_core.lib +++ b/bin12/lib/mir_core.lib diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib Binary files differindex 2d86f6d572..96a43396d5 100644 --- a/bin12/lib/mir_core64.lib +++ b/bin12/lib/mir_core64.lib diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index 205f22d9ff..f71dfedd65 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -64,24 +64,19 @@ type ISOcode: array [0..2] of AnsiChar;
end;
-const
- OUF_NEWWINDOW = 1;
- OUF_UNICODE = 2;
{
- wParam : OUF_* flag
- lParam : Pointer to a null terminated string containing Url
Affect : Open a URL in the user's default web browser, see notes
- Returns: 0 on success, [non zero on failure]
Notes : bOpenInWindow should be zero to open the URL in the browoser window
the user last used, or nonzero to open in a new browser window,
if there's no browser running, it will be started to show the URL
- Version: v0.1.0.1+
}
- MS_UTILS_OPENURL:PAnsiChar = 'Utils/OpenURL';
+procedure Utils_OpenUrl(const url:PAnsiChar; bOpenInWindow:BYTE=1); stdcall;
+ external CoreDLL name 'Utils_OpenUrl';
+
+procedure Utils_OpenUrlW(const url:PWideChar; bOpenInWindow:BYTE=1); stdcall;
+ external CoreDLL name 'Utils_OpenUrlW';
{
- wParam : 0
- lParam : Pointer to an initalised TUTILRESIZEDIALOG structure
Affect : Resize a dialog by calling a custom routine to move each control, see notes
Returns: 0 on success, [non zero] on failure
Notes : Does not support DIALOGTEMPLATEEX dialogboxes, and will return
diff --git a/include/m_utils.h b/include/m_utils.h index 3e8545f766..96e7cbe783 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -40,31 +40,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_string.h>
#endif
-//this entire module is v0.1.0.1+
-//this module cannot be redefined by a plugin, because it's not useful for it
-//to be possible
-//There are some more utility services in the database for dealing with time
-//and simple string scrambling, but they are very db-orientated
-
-/* Opens a URL in the user's default web browser v0.1.0.1+
-wParam = OUF_* flags
-lParam = (LPARAM)(const TCHAR*)szUrl
-returns 0 always
-bOpenInNewWindow should be zero to open the URL in the browser window the user
-last used, or nonzero to open in a new browser window. If there's no browser
-running, one will be opened to show the URL.
-*/
-
-#define OUF_NEWWINDOW 1
-#define OUF_UNICODE 2
+/////////////////////////////////////////////////////////////////////////////////////////
+// Opens a URL in the user's default web browser
+//
+// bOpenInNewWindow should be zero to open the URL in the browser window the user
+// last used, or nonzero to open in a new browser window. If there's no browser
+// running, one will be opened to show the URL.
-#if defined( _UNICODE )
- #define OUF_TCHAR OUF_UNICODE
-#else
- #define OUF_TCHAR 0
-#endif
+EXTERN_C MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow = true);
+EXTERN_C MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow = true);
-#define MS_UTILS_OPENURL "Utils/OpenURL"
+#define Utils_OpenUrlT Utils_OpenUrlW
/////////////////////////////////////////////////////////////////////////////////////////
// Resizes a dialog by calling a custom routine to move the individual
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<FILEINFO> &todo = *(vector<FILEINFO> *)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<ENLINK *>(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<TCHAR *>(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;
}
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index d81b65f3c0..84e7fa7f4f 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -1090,7 +1090,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_NEWAIMACCOUNTLINK) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://www.aim.com/redirects/inclient/register.adp");
+ Utils_OpenUrl("http://www.aim.com/redirects/inclient/register.adp");
return TRUE;
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index b3bfdc93b3..5c14ce4f95 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -913,7 +913,7 @@ void FacebookProto::OpenUrl(std::string url) ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data)); else // Or use Miranda's service - CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)data); + Utils_OpenUrlT(data); } void FacebookProto::ReadNotificationWorker(void *p) diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index fcafd253b7..c2cf1f7235 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -110,7 +110,7 @@ void DoOpenUrl(LPSTR tokenResp, LPSTR url) size_t size = mir_strlen(TOKEN_AUTH_URL) + 1 + mir_strlen(encodedToken) + mir_strlen(encodedUrl);
LPSTR composedUrl = (LPSTR)alloca(size);
mir_snprintf(composedUrl, size, TOKEN_AUTH_URL, encodedToken, encodedUrl);
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)composedUrl);
+ Utils_OpenUrl(composedUrl);
}
BOOL AuthAndOpen(HANDLE hUser, LPSTR url, LPSTR mailbox, LPSTR pwd)
@@ -151,7 +151,7 @@ void OpenUrlThread(void *param) HANDLE hUser = FindNetUserHandle(data->acc);
if (!hUser || !AuthAndOpen(hUser, data->url, data->mailbox, data->pwd))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)data->url);
+ Utils_OpenUrl(data->url);
free(data);
}
@@ -196,17 +196,11 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) return TRUE;
}
-static void ShellExecuteThread(PVOID param)
-{
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)param);
- mir_free(param);
-}
-
void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
{
extern DWORD itlsSettings;
if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (DWORD)TlsGetValue(itlsSettings)) || !OpenUrlWithAuth(acc, mailbox, url))
- mir_forkthread(ShellExecuteThread, mir_tstrdup(url));
+ Utils_OpenUrlT(url);
}
void OpenContactInbox(LPCSTR szModuleName)
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 90cf3cb757..c0fabf5a18 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -347,7 +347,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w szIP[0] = 0;
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
mir_sntprintf(szUrl, _countof(szUrl), _T("http://whois.domaintools.com/%s"), szIP);
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)szUrl);
+ Utils_OpenUrlT(szUrl);
break;
}
}
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 5d68c0ee30..eda6f4f40d 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -1067,7 +1067,7 @@ void COtherPrefsDlg::OnInitDialog() void COtherPrefsDlg::OnUrl(CCtrlButton*)
{
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://members.chello.se/matrix/index.html");
+ Utils_OpenUrl("http://members.chello.se/matrix/index.html");
}
void COtherPrefsDlg::OnPerformCombo(CCtrlData*)
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 571e4949de..7570cb68fc 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -70,7 +70,7 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_REGISTER:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)URL_REGISTER);
+ Utils_OpenUrl(URL_REGISTER);
break;
case IDC_UIN:
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index b9c66d361a..8114a6e72d 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -172,16 +172,12 @@ void g_MenuUninit(void) CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_OPEN_PROFILE], 0);
}
-
INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM)
{
- DWORD dwUin = getContactUin(hContact);
- char url[256];
- mir_snprintf(url, _countof(url), "http://www.icq.com/people/%d",dwUin);
- return CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
+ Utils_OpenUrl(CMStringA(FORMAT, "http://www.icq.com/people/%d", getContactUin(hContact)));
+ return 0;
}
-
int CIcqProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM)
{
if (hContact == NULL)
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 2559bdfb3b..36c1c1bfb0 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -107,11 +107,11 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_LOOKUPLINK:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)URL_FORGOT_PASSWORD);
+ Utils_OpenUrl(URL_FORGOT_PASSWORD);
return TRUE;
case IDC_NEWUINLINK:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)URL_REGISTER);
+ Utils_OpenUrl(URL_REGISTER);
return TRUE;
case IDC_RESETSERVER:
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index bc33468517..71ede5b4fe 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -347,7 +347,7 @@ void CJabberDlgBookmarks::OpenBookmark() m_proto->GroupchatJoinRoom(server, room, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)), item->password);
}
}
- else CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)item->jid);
+ else Utils_OpenUrlT(item->jid);
}
INT_PTR CJabberDlgBookmarks::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 1381a7036d..71050641ed 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1331,7 +1331,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g char *bufPtr, *url = mir_t2a(p);
for (bufPtr = url; *bufPtr && !isspace(*bufPtr); ++bufPtr);
*bufPtr++ = 0;
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
+ Utils_OpenUrl(url);
mir_free(url);
break;
}
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index c17fc4152a..a5eb5aa6ff 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -69,7 +69,7 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_WIN_INBOX_URL "https://win.mail.ru/cgi-bin/start"
#define MRA_PDA_INBOX_URL "http://pda.mail.ru/cgi-bin/start"
#define MRA_EDIT_PROFILE_URL "https://win.mail.ru/cgi-bin/userinfo?mra=1"
-#define MRA_SEARCH_URL _T("http://go.mail.ru")
+#define MRA_SEARCH_URL "http://go.mail.ru"
// used spesialy! added: /domain/user
#define MRA_BLOGS_URL "http://blogs.mail.ru"
@@ -79,8 +79,8 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_WORLD_URL "http://my.mail.ru"
// without auth
-#define MRA_REGISTER_URL _T("https://win.mail.ru/cgi-bin/signup")
-#define MRA_FORGOT_PASSWORD_URL _T("https://win.mail.ru/cgi-bin/passremind")
+#define MRA_REGISTER_URL "https://win.mail.ru/cgi-bin/signup"
+#define MRA_FORGOT_PASSWORD_URL "https://win.mail.ru/cgi-bin/passremind"
// wParam = hContact
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp index a1d4b1830b..de0a8b9d35 100644 --- a/protocols/MRA/src/MraMPop.cpp +++ b/protocols/MRA/src/MraMPop.cpp @@ -68,7 +68,7 @@ DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStr MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
if (!getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) || !m_bLoggedIn) { /* Open without web auth. / Not loggedIn. */
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)lpszUrl.c_str());
+ Utils_OpenUrl(lpszUrl);
return NO_ERROR;
}
/* Add to queue. */
@@ -128,7 +128,7 @@ void CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue) pmpsqMPopSessionQueue->bKeyValid = false;
szEmail.MakeLower();
szUrl.Format(MRA_MPOP_AUTH_URL, szEmail, pmpsqMPopSessionQueue->lpszMPOPKey, pmpsqi->lpszUrl);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl.c_str());
+ Utils_OpenUrl(szUrl);
debugLogA("Opening URL: %s\n", szUrl);
}
mir_free(pmpsqi);
@@ -145,7 +145,7 @@ void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue) MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
while (FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)pmpsqi->lpszUrl);
+ Utils_OpenUrl(pmpsqi->lpszUrl);
mir_free(pmpsqi);
}
}
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index ec0ee058dd..5d2082a1fd 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -21,7 +21,7 @@ INT_PTR CMraProto::MraEditProfile(WPARAM, LPARAM) INT_PTR CMraProto::MraWebSearch(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_SEARCH_URL);
+ Utils_OpenUrl(MRA_SEARCH_URL);
return 0;
}
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index b833a7cd22..6edfcfb59e 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -20,11 +20,11 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_NEW_ACCOUNT_LINK:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_REGISTER_URL);
+ Utils_OpenUrl(MRA_REGISTER_URL);
return TRUE;
case IDC_LOOKUPLINK:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_FORGOT_PASSWORD_URL);
+ Utils_OpenUrl(MRA_FORGOT_PASSWORD_URL);
return TRUE;
}
if ((LOWORD(wParam) == IDC_LOGIN || LOWORD(wParam) == IDC_PASSWORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
@@ -71,7 +71,7 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_NEW_ACCOUNT_LINK:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_REGISTER_URL);
+ Utils_OpenUrl(MRA_REGISTER_URL);
return TRUE;
}
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index ce01104a1e..417acf320f 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -247,7 +247,7 @@ int CMsnProto::MSN_GetPassportAuth(void) if (retVal != 0) {
if (errurl) {
debugLogA("Starting URL: '%s'", errurl);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)errurl);
+ Utils_OpenUrl(errurl);
}
ezxml_t tokf = ezxml_get(xml, "S:Body", 0, "S:Fault", 0, "S:Detail", -1);
@@ -809,33 +809,33 @@ int CMsnProto::MSN_AuthOAuth(void) char *pAccessToken;
/* Extract access_token from Location can be found */
- for (int i = 0; i < nlhrReply->headersCount; i++)
+ for (int i = 0; i < nlhrReply->headersCount; i++) {
if (!mir_strcmpi(nlhrReply->headers[i].szName, "Location") &&
- (pAccessToken = strstr(nlhrReply->headers[i].szValue, "access_token=")) &&
- (pEnd=strchr(pAccessToken+13, '&')))
- {
+ (pAccessToken = strstr(nlhrReply->headers[i].szValue, "access_token=")) &&
+ (pEnd = strchr(pAccessToken + 13, '&'))) {
char *pRefreshToken, *pExpires, szToken[1024];
- bool bLogin=false;
+ bool bLogin = false;
*pEnd = 0;
- pAccessToken+=13;
+ pAccessToken += 13;
UrlDecode(pAccessToken);
replaceStr(authAccessToken, pAccessToken);
/* Extract refresh token */
- if ((pRefreshToken = strstr(pEnd+1, "refresh_token=")) && (pEnd=strchr(pRefreshToken+14, '&'))) {
+ if ((pRefreshToken = strstr(pEnd + 1, "refresh_token=")) && (pEnd = strchr(pRefreshToken + 14, '&'))) {
*pEnd = 0;
- pRefreshToken+=14;
+ pRefreshToken += 14;
}
replaceStr(authRefreshToken, pRefreshToken);
/* Extract expire time */
time(&authTokenExpiretime);
- if ((pExpires = strstr(pEnd+1, "expires_in=")) && (pEnd=strchr(pExpires+11, '&'))) {
+ if ((pExpires = strstr(pEnd + 1, "expires_in=")) && (pEnd = strchr(pExpires + 11, '&'))) {
*pEnd = 0;
- pExpires+=11;
- authTokenExpiretime+=atoi(pExpires);
- } else authTokenExpiretime+=86400;
+ pExpires += 11;
+ authTokenExpiretime += atoi(pExpires);
+ }
+ else authTokenExpiretime += 86400;
/* Copy auth Cookies to class for other web requests like contact list fetching to avoid ActiveSync */
mir_free(authCookies);
@@ -844,14 +844,15 @@ int CMsnProto::MSN_AuthOAuth(void) int loginRet;
/* Do Login via Skype login server, if not possible switch to SkypeWebExperience login */
- if ((loginRet = LoginSkypeOAuth(pRefreshToken))<1) {
- if (loginRet<0) bLogin=true; else retVal = 0;
- } else {
+ if ((loginRet = LoginSkypeOAuth(pRefreshToken)) < 1) {
+ if (loginRet < 0) bLogin = true; else retVal = 0;
+ }
+ else {
/* SkyLogin succeeded, request required tokens */
if (RefreshOAuth(pRefreshToken, "service::ssl.live.com::MBI_SSL", szToken)) {
replaceStr(authSSLToken, szToken);
replaceStr(authUser, MyOptions.szEmail);
- authMethod=retVal=1;
+ authMethod = retVal = 1;
}
}
mir_free(authSkypeComToken); authSkypeComToken = NULL;
@@ -866,39 +867,43 @@ int CMsnProto::MSN_AuthOAuth(void) nlhr.dataLength = (int)mir_strlen(nlhr.pData);
nlhr.szUrl = "https://skypewebexperience.live.com/v1/User/Initialization";
nlhr.nlc = hHttpsConnection;
-
+
/* Request MappingContainer */
mHttpsTS = clock();
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
mHttpsTS = clock();
- if (nlhrReply) {
+ if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
/* Parse JSON stuff for MappingContainer */
char *pMappingContainer;
- if ((pMappingContainer = strstr(nlhrReply->pData, "\"MappingContainer\":\"")) &&
- (pEnd=strchr(pMappingContainer+20, '"')))
- {
+ if ((pMappingContainer = strstr(nlhrReply->pData, "\"MappingContainer\":\"")) &&
+ (pEnd = strchr(pMappingContainer + 20, '"'))) {
*pEnd = 0;
- pMappingContainer+=20;
+ pMappingContainer += 20;
UrlDecode(pMappingContainer);
replaceStr(authUIC, pMappingContainer);
replaceStr(authUser, MyOptions.szEmail);
authMethod = retVal = 2;
- } else retVal = 0;
- } else retVal = 0;
- } else hHttpsConnection = NULL;
+ }
+ else retVal = 0;
+ }
+ else retVal = 0;
+ }
+ else hHttpsConnection = NULL;
}
}
- } else {
+ }
+ }
+ else {
/* There may be a problem with login, i.e. M$ security measures. Open up browser
* window with same URL in order to let user correct this */
if (nlhrReply->resultCode == 200 && nlhrReply->pData && strstr(nlhrReply->pData, "ar/cancel")) {
url.Format("https://login.live.com/oauth20_authorize.srf?%s", pszPostParams);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url.GetString());
+ Utils_OpenUrl(url);
}
hHttpsConnection = NULL;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 6c5e3a4fcd..cce21faa02 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -944,7 +944,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) hippy.AppendFormat("/ppsecure/sha1auth.srf?lc=%d&token=%s", itoa(langpref, passport, 10), ptrA(mir_urlEncode(post)));
debugLogA("Starting URL: '%s'", hippy);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)hippy.GetString());
+ Utils_OpenUrl(hippy.GetString());
}
}
@@ -984,7 +984,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara tData->proto->MsnInvokeMyURL(true, tData->url);
}
else if (tData->url != NULL)
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)tData->url);
+ Utils_OpenUrl(tData->url);
}
PUDeletePopup(hWnd);
break;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 183252d3db..0d40a98100 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND:
if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"https://signup.live.com");
+ Utils_OpenUrl("https://signup.live.com");
return TRUE;
}
@@ -531,7 +531,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND:
if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"https://signup.live.com");
+ Utils_OpenUrl("https://signup.live.com");
return TRUE;
}
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 6e1f1b1658..f59c2284a4 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -46,8 +46,7 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM) char url[MAX_PATH];
DWORD gameId = getDword(hContact, "GameID", 0);
mir_snprintf(url, _countof(url), "steam://rungameid/%lu", gameId);
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
-
+ Utils_OpenUrl(url);
return 0;
}
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 5667c73c3c..07b14b853e 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -225,8 +225,9 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) }
mir_free(login);
mir_free(password);
+
mir_snprintf(szFileName, _countof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szFileName);
+ Utils_OpenUrl(szFileName);
return 0;
}
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 42a58970fb..0d17ca7519 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -147,7 +147,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_REGISTERACCOUNT: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)TLEN_REGISTER); + Utils_OpenUrl(TLEN_REGISTER); break; } break; @@ -282,7 +282,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara MarkChanges(1, hwndDlg); break; case IDC_REGISTERACCOUNT: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM) TLEN_REGISTER); + Utils_OpenUrl(TLEN_REGISTER); break; case IDC_OFFLINE_MESSAGE_OPTION: case IDC_ALERT_POLICY: diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 23d6e15e33..fcd515f43e 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -497,10 +497,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_COMMAND:
// Get the plugin data (we need the Popup service to do it)
url = (std::string *)PUGetPluginData(hwnd);
- if (url != NULL) {
- //std::string url = profile_base_url("https://twitter.com/") + http::url_encode(dbv.pszVal);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, reinterpret_cast<LPARAM>(url->c_str()));
- }
+ if (url != NULL)
+ Utils_OpenUrl(url->c_str());
+
// Intentionally no break here
case WM_CONTEXTMENU:
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index c9bd871c80..fd3ba76d75 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -241,7 +241,7 @@ INT_PTR TwitterProto::VisitHomepage(WPARAM hContact, LPARAM) std::string url = profile_base_url("https://twitter.com/") + http::url_encode(dbv.pszVal);
db_set_s(hContact, m_szModuleName, "Homepage", url.c_str());
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, reinterpret_cast<LPARAM>(url.c_str()));
+ Utils_OpenUrl(url.c_str());
db_free(&dbv);
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index 71dbb239c9..dd6cb1a567 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -62,7 +62,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_NEWACCOUNTLINK) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, reinterpret_cast<LPARAM>("https://twitter.com/signup"));
+ Utils_OpenUrl("https://twitter.com/signup");
return true;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 5b8b7f7b0f..ee65cb5714 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -792,10 +792,9 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) case IDM_VISIT_PROFILE:
hContact = FindUser(cu->m_uid);
- if (hContact == NULL) {
- CMString tszUrl(FORMAT, _T("http://vk.com/id%d"), cu->m_uid);
- CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)tszUrl.GetBuffer());
- } else
+ if (hContact == NULL)
+ Utils_OpenUrlT(CMString(FORMAT, _T("http://vk.com/id%d"), cu->m_uid));
+ else
SvcVisitProfile(hContact, 0);
break;
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 98a7e633aa..a21e27105e 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_URL:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://vk.com");
+ Utils_OpenUrl("http://vk.com");
break;
case IDC_LOGIN:
@@ -138,7 +138,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_URL:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://vk.com");
+ Utils_OpenUrl("http://vk.com");
break;
case IDC_LOGIN:
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index ac81248d63..fe0b523837 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -696,10 +696,10 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM)
{
debugLogA("CVkProto::SvcOpenBroadcast");
+
CMString tszAudio(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
-
if (!tszAudio.IsEmpty())
- CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)tszAudio.GetBuffer());
+ Utils_OpenUrlT(tszAudio);
return 0;
}
@@ -709,14 +709,13 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) debugLogA("CVkProto::SvcVisitProfile");
LONG userID = getDword(hContact, "ID", -1);
ptrT tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
- CMString tszUrl("https://vk.com/");
+ CMString tszUrl("https://vk.com/");
if (tszDomain)
tszUrl.Append(tszDomain);
else
tszUrl.AppendFormat(_T("id%i"), userID);
- CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)tszUrl.GetBuffer());
-
+ Utils_OpenUrlT(tszUrl);
return 0;
}
\ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 02e16a955a..f0bbccc50a 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -32,7 +32,8 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { this->launchparams[3] == 'p'&&
this->launchparams[4] == ':')
{
- return CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)this->launchparams);
+ Utils_OpenUrl(this->launchparams);
+ return 0;
}
}
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 968e3e6664..6349e85c56 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1971,8 +1971,7 @@ static INT_PTR GotoProfile(WPARAM hContact, LPARAM lParam) strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)temp);
-
+ Utils_OpenUrl(temp);
return 0;
}
@@ -1991,8 +1990,7 @@ static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM lParam) strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)temp);
-
+ Utils_OpenUrl(temp);
return 0;
}
@@ -2007,7 +2005,7 @@ static INT_PTR GotoProfile2(WPARAM wParam, LPARAM lParam) strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)temp);
+ Utils_OpenUrl(temp);
return 0;
}
@@ -2023,7 +2021,7 @@ static INT_PTR GotoProfileAct(WPARAM wParam, LPARAM lParam) strcat_s(temp, 64, dbv.pszVal);
db_free(&dbv);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)temp);
+ Utils_OpenUrl(temp);
return 0;
}
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 670564ea8f..145f49dd2c 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -230,11 +230,11 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableDlgItem(hwndDlg, IDC_KONFIG_3, TRUE); } if (LOWORD(wParam) == IDC_URLNEWACC) { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://www.xfire.com/register/"); + Utils_OpenUrl("http://www.xfire.com/register/"); return TRUE; } if (LOWORD(wParam) == IDC_LOSTPW) { - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"https://secure.xfire.com/lost_password/"); + Utils_OpenUrl("https://secure.xfire.com/lost_password/"); return TRUE; } diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 085c488add..2049e99ec8 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -65,10 +65,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (LOWORD(wParam)) { case IDC_NEWYAHOOACCOUNTLINK: - CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, - ppro->getByte("YahooJapan", 0) ? - (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" : - (LPARAM)"http://edit.yahoo.com/config/eval_register"); + Utils_OpenUrl(ppro->getByte("YahooJapan", 0) ? "http://edit.yahoo.co.jp/config/eval_register" : "http://edit.yahoo.com/config/eval_register"); return TRUE; //case IDC_DISABLE_UTF8: diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 0689e010b3..2bafb22610 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -683,12 +683,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_NEWYAHOOACCOUNTLINK) {
- CallService(MS_UTILS_OPENURL,
- OUF_NEWWINDOW,
- ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN) == 1) ?
- (LPARAM) "http://edit.yahoo.co.jp/config/eval_register" :
- (LPARAM) "http://edit.yahoo.com/config/eval_register"
- );
+ Utils_OpenUrl(IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN) == 1 ?
+ "http://edit.yahoo.co.jp/config/eval_register" : "http://edit.yahoo.com/config/eval_register");
return TRUE;
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 0155d8a3c6..9d79dd8d07 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -237,8 +237,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) }
debugLogA("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
-
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)tUrl);
+ Utils_OpenUrl(tUrl);
}
//=======================================================
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 7a04f48e61..486fe2a7b1 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -79,7 +79,7 @@ static LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT message, WPARAM wParam, if (HIWORD(wParam) == STN_CLICKED) {
char *szURL = (char*)PUGetPluginData(hWnd);
if (szURL != NULL)
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szURL);
+ Utils_OpenUrl(szURL);
PUDeletePopup(hWnd);
return 0;
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 13dc4c0497..511c18c65b 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -2215,18 +2215,15 @@ LABEL_SHOWWINDOW: case ID_SEARCH_GOOGLE:
if (pszWord[0])
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR,
- (LPARAM)CMString(FORMAT, _T("http://www.google.com/search?q=%s"), pszWord).GetString());
+ 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[1024];
- 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;
@@ -2267,11 +2264,11 @@ 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:
@@ -2292,7 +2289,7 @@ LABEL_SHOWWINDOW: return TRUE;
}
- CallService(MS_UTILS_OPENURL, OUF_TCHAR|OUF_NEWWINDOW, (LPARAM) tr.lpstrText);
+ Utils_OpenUrlT(tr.lpstrText);
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
mir_free(tr.lpstrText);
break;
diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index af276a413d..a6a09e1220 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -41,19 +41,19 @@ static INT_PTR AboutCommand(WPARAM wParam, LPARAM) static INT_PTR IndexCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://wiki.miranda-ng.org"));
+ Utils_OpenUrl("http://wiki.miranda-ng.org");
return 0;
}
static INT_PTR WebsiteCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda-ng.org"));
+ Utils_OpenUrl("http://miranda-ng.org");
return 0;
}
static INT_PTR BugCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://trac.miranda-ng.org/newticket"));
+ Utils_OpenUrl("http://trac.miranda-ng.org/newticket");
return 0;
}
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index f654cae874..3fb66a7e25 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -168,10 +168,10 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hwndDlg, IDC_URL, url, _countof(url));
switch(TrackPopupMenu(hSubMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL)) {
case IDM_OPENNEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
+ Utils_OpenUrl(url);
break;
case IDM_OPENEXISTING:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
+ Utils_OpenUrl(url);
break;
case IDM_COPYLINK:
{
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 0ac9910f84..d51607ad5c 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -345,7 +345,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
+ Utils_OpenUrl(szPage);
}
}
break;
@@ -483,7 +483,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
+ Utils_OpenUrl(szPage);
}
break;
}
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index d1d42ab4cc..1019b695e3 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -198,11 +198,9 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TEXTRANGE tr;
tr.chrg = param->chrg;
tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
- SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
+ SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- char *tmp = mir_t2a(tr.lpstrText);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)tmp);
- mir_free(tmp);
+ Utils_OpenUrlT(tr.lpstrText);
mir_free(tr.lpstrText);
}
return TRUE;
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 735d4ab1bf..96f3f78553 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -126,12 +126,12 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char buf[512];
mir_strcpy(buf, "mailto:");
if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), &buf[7], _countof(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)buf);
+ Utils_OpenUrl(buf);
}
break;
case IDC_MORELANG:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda-ng.org/index.php?title=Langpacks/en#Download");
+ Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Langpacks/en#Download");
break;
case IDC_LANGUAGES:
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 278050a96d..24ef35348b 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -522,7 +522,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (HIWORD(wParam) == STN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_GETMOREPLUGINS:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/");
+ Utils_OpenUrl("http://miranda-ng.org/downloads/");
break;
case IDC_PLUGINEMAIL:
@@ -531,7 +531,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char *p = &buf[7];
mir_strcpy(buf, "mailto:");
if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), p, _countof(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
+ Utils_OpenUrl(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p);
break;
}
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index ce4c986679..0c5ae404f3 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -913,7 +913,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM break;
case IDC_LNK_ADDONS:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/");
+ Utils_OpenUrl("http://miranda-ng.org/");
break;
case IDOK:
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 194a2a7696..882eade304 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -202,7 +202,7 @@ void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd) static void OpenIconsPage()
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/");
+ Utils_OpenUrl("http://miranda-ng.org/");
}
static int OpenPopupMenu(HWND hwndDlg)
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index 0fb366e812..6722e17c83 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, strFull);
}
if (LOWORD(wParam) == IDC_GETMORE) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/addons/category/14");
+ Utils_OpenUrl("http://miranda-ng.org/addons/category/14");
break;
}
if (LOWORD(wParam) == IDC_LOCATION)
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index 64b204da68..8efafe2673 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -28,9 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam);
-int InitOpenUrl(void);
int InitPathUtils(void);
-void InitXmlApi(void);
int InitCrypt(void);
void UninitCrypt(void);
@@ -352,7 +350,6 @@ int LoadUtilsModule(void) CreateServiceFunction(MS_UTILS_ENTERSTRING, svcEnterString);
CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda);
- InitOpenUrl();
InitPathUtils();
InitCrypt();
return 0;
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index d12bbf2897..fed657fd09 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -971,3 +971,5 @@ TimeZone_ToStringW @1128 TimeZone_UtcToLocal @1129
Utils_ResizeDialog @1130
Utils_GetRandom @1131
+Utils_OpenUrl @1132
+Utils_OpenUrlW @1133
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 3cd65aa139..af4a9a45d7 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -971,3 +971,5 @@ TimeZone_ToStringW @1128 TimeZone_UtcToLocal @1129
Utils_ResizeDialog @1130
Utils_GetRandom @1131
+Utils_OpenUrl @1132
+Utils_OpenUrlW @1133
diff --git a/src/mir_app/src/openurl.cpp b/src/mir_core/src/openurl.cpp index 1ad7b508ad..00b2813322 100644 --- a/src/mir_app/src/openurl.cpp +++ b/src/mir_core/src/openurl.cpp @@ -65,18 +65,14 @@ static void OpenURLThread(void *arg) delete hUrlInfo;
}
-static INT_PTR OpenURL(WPARAM wParam, LPARAM lParam)
+MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
- if (lParam == 0)
- return 1;
-
- TOpenUrlInfo *hUrlInfo = new TOpenUrlInfo((wParam & OUF_UNICODE) ? mir_wstrdup((WCHAR*)lParam) : mir_a2t((char*)lParam), wParam & OUF_NEWWINDOW);
- forkthread(OpenURLThread, 0, hUrlInfo);
- return 0;
+ if (pszUrl)
+ forkthread(OpenURLThread, 0, new TOpenUrlInfo(mir_a2t(pszUrl), bOpenInNewWindow));
}
-int InitOpenUrl(void)
+MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
{
- CreateServiceFunction(MS_UTILS_OPENURL, OpenURL);
- return 0;
+ if (pszUrl)
+ forkthread(OpenURLThread, 0, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
}
|