summaryrefslogtreecommitdiff
path: root/protocols/MSN/src/msn_auth.cpp
diff options
context:
space:
mode:
authorPiotr Piastucki <leech.miranda@gmail.com>2015-06-04 12:10:46 +0000
committerPiotr Piastucki <leech.miranda@gmail.com>2015-06-04 12:10:46 +0000
commitde1841e8600420cf3cf35cb73d6e0226a9519687 (patch)
tree7ec105c6a941070ddd7e5fa84c3f6a36a9d8dacc /protocols/MSN/src/msn_auth.cpp
parent9f5554e211907907ec149a7c8919bc70daf77026 (diff)
Fixed a memleak in groupchat
Added support for contact list fetching for plain Skype user finally enabling usage of Skype accounts via skylogin.dll (login only working once in a session though, currently cannot find out why). Prevent launching of duplicate keepAliveThread git-svn-id: http://svn.miranda-ng.org/main/trunk@13995 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src/msn_auth.cpp')
-rw-r--r--protocols/MSN/src/msn_auth.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index 47192116cd..ac3640694f 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -941,18 +941,10 @@ const char *CMsnProto::GetSkypeToken(bool bAsAuthHeader)
char szToken[1024];
// Ensure that token isn't expired
- MSN_AuthOAuth();
+ if (MyOptions.netId == NETID_MSN) MSN_AuthOAuth();
// No token available, fetch it
if (!authSkypeToken) {
- // Get skype.com OAuth token needed to acquire skype_token
- if (!authSkypeComToken) {
- if (RefreshOAuth(authRefreshToken, "service::skype.com::MBI_SSL", szToken))
- replaceStr(authSkypeComToken, szToken);
- else return NULL;
- }
-
- // Get skype_token
NETLIBHTTPREQUEST nlhr = { 0 };
NETLIBHTTPREQUEST *nlhrReply;
NETLIBHTTPHEADER headers[1];
@@ -966,12 +958,33 @@ const char *CMsnProto::GetSkypeToken(bool bAsAuthHeader)
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = (char*)MSN_USER_AGENT;
- nlhr.szUrl = "https://api.skype.com/rps/skypetoken";
- mir_snprintf(szPOST, sizeof(szPOST), "scopes=client&clientVersion=%s&access_token=%s&partner=999",
- msnProductVer, authSkypeComToken);
- nlhr.dataLength = (int)strlen(szPOST);
- nlhr.pData = (char*)(const char*)szPOST;
+ nlhr.pData = szPOST;
+
+ if (MyOptions.netId == NETID_SKYPE) {
+ BYTE digest[16];
+ int cbPasswd;
+ char szPassword[100]={0};
+
+ cbPasswd=mir_snprintf(szPassword, sizeof(szPassword), "%s\nskyper\n", MyOptions.szEmail);
+ db_get_static(NULL, m_szModuleName, "Password", szPassword+cbPasswd, sizeof(szPassword)-cbPasswd-1);
+ mir_md5_hash((BYTE*)szPassword, mir_strlen(szPassword), digest);
+ mir_base64_encodebuf(digest, sizeof(digest), szPassword, sizeof(szPassword));
+ nlhr.szUrl = "https://api.skype.com/login/skypetoken";
+ nlhr.dataLength = mir_snprintf(szPOST, sizeof(szPOST), "scopes=client&clientVersion=%s&username=%s&passwordHash=%s",
+ msnProductVer, MyOptions.szEmail, szPassword);
+ } else {
+ // Get skype.com OAuth token needed to acquire skype_token
+ if (!authSkypeComToken) {
+ if (RefreshOAuth(authRefreshToken, "service::skype.com::MBI_SSL", szToken))
+ replaceStr(authSkypeComToken, szToken);
+ else return NULL;
+ }
+ // Get skype_token
+ nlhr.szUrl = "https://api.skype.com/rps/skypetoken";
+ nlhr.dataLength = mir_snprintf(szPOST, sizeof(szPOST), "scopes=client&clientVersion=%s&access_token=%s&partner=999",
+ msnProductVer, authSkypeComToken);
+ }
mHttpsTS = clock();
nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);