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 --- protocols/AimOscar/src/ui.cpp | 2 +- protocols/FacebookRM/src/proto.cpp | 2 +- protocols/GTalkExt/src/inbox.cpp | 12 ++---- protocols/Gadu-Gadu/src/sessions.cpp | 2 +- protocols/IRCG/src/options.cpp | 2 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 2 +- protocols/IcqOscarJ/src/icq_menu.cpp | 8 +--- protocols/IcqOscarJ/src/icq_opts.cpp | 4 +- protocols/JabberG/src/jabber_bookmarks.cpp | 2 +- protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/MRA/src/MraConstans.h | 6 +-- protocols/MRA/src/MraMPop.cpp | 6 +-- protocols/MRA/src/Mra_menus.cpp | 2 +- protocols/MRA/src/Mra_options.cpp | 6 +-- protocols/MSN/src/msn_auth.cpp | 61 ++++++++++++++++-------------- protocols/MSN/src/msn_misc.cpp | 4 +- protocols/MSN/src/msn_opts.cpp | 4 +- protocols/Steam/src/steam_menus.cpp | 3 +- protocols/Tlen/src/tlen.cpp | 3 +- protocols/Tlen/src/tlen_opt.cpp | 4 +- protocols/Twitter/src/connection.cpp | 7 ++-- protocols/Twitter/src/proto.cpp | 2 +- protocols/Twitter/src/ui.cpp | 2 +- protocols/VKontakte/src/vk_chats.cpp | 7 ++-- protocols/VKontakte/src/vk_options.cpp | 4 +- protocols/VKontakte/src/vk_thread.cpp | 9 ++--- protocols/Xfire/src/Xfire_game.cpp | 3 +- protocols/Xfire/src/main.cpp | 10 ++--- protocols/Xfire/src/options.cpp | 4 +- protocols/Yahoo/src/options.cpp | 5 +-- protocols/Yahoo/src/proto.cpp | 8 +--- protocols/Yahoo/src/services.cpp | 3 +- protocols/Yahoo/src/util.cpp | 2 +- 33 files changed, 93 insertions(+), 110 deletions(-) (limited to 'protocols') 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(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(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("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; -- cgit v1.2.3