diff options
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/request_queue.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/endpoint.h | 42 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 15 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 1 |
6 files changed, 16 insertions, 47 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 134c4273d6..6ae4652ff3 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -27,12 +27,12 @@ AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpR case HOST_GRAPH: m_szUrl = "skypegraph.skype.com"; break;
case HOST_LOGIN: m_szUrl = "login.skype.com"; break;
case HOST_DEFAULT:
+ AddHeader("MS-IC3-Product", "Sfl");
m_szUrl.Format("%s/v1", g_plugin.szDefaultServer.c_str());
break;
}
AddHeader("User-Agent", NETLIB_USER_AGENT);
- AddHeader("MS-IC3-Product", "Sfl");
if (url)
m_szUrl.Append(url);
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h deleted file mode 100644 index ab866aa39a..0000000000 --- a/protocols/SkypeWeb/src/requests/endpoint.h +++ /dev/null @@ -1,42 +0,0 @@ -/*
-Copyright (c) 2015-25 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_ENDPOINT_H_
-#define _SKYPE_REQUEST_ENDPOINT_H_
-
-struct CreateEndpointRequest : public AsyncHttpRequest
-{
- CreateEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated)
- {
- m_szParam = "{\"endpointFeatures\":\"Agent,Presence2015,MessageProperties,CustomUserProperties,Casts,ModernBots,AutoIdleForWebApi,secureThreads,notificationStream,InviteFree,SupportsReadReceipts,ued\"}";
-
- AddHeader("Origin", "https://web.skype.com");
- AddHeader("Referer", "https://web.skype.com/");
- AddAuthentication(ppro);
- }
-};
-
-struct DeleteEndpointRequest : public AsyncHttpRequest
-{
- DeleteEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/endpoints/" + mir_urlEncode(ppro->m_szId), &CSkypeProto::OnEndpointDeleted)
- {
- }
-};
-
-#endif //_SKYPE_REQUEST_ENDPOINT_H_
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 804160fc6a..06234effbe 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -147,7 +147,18 @@ void CSkypeProto::TryCreateEndpoint() m_impl.m_heartBeat.StartSafe(600 * 1000);
- PushRequest(new CreateEndpointRequest(this));
+ SendCreateEndpoint();
+}
+
+void CSkypeProto::SendCreateEndpoint()
+{
+ auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated);
+ pReq->m_szParam = "{\"endpointFeatures\":\"Agent,Presence2015,MessageProperties,CustomUserProperties,Casts,ModernBots,AutoIdleForWebApi,secureThreads,notificationStream,InviteFree,SupportsReadReceipts,ued\"}";
+ pReq->AddHeader("Origin", "https://web.skype.com");
+ pReq->AddHeader("Referer", "https://web.skype.com/");
+ pReq->AddAuthentication(this);
+
+ PushRequest(pReq);
}
void CSkypeProto::OnEndpointCreated(MHttpResponse *response, AsyncHttpRequest*)
@@ -174,7 +185,7 @@ void CSkypeProto::OnEndpointCreated(MHttpResponse *response, AsyncHttpRequest*) int iEnd = szUrl.Find('/');
g_plugin.szDefaultServer = (iEnd != -1) ? szUrl.Left(iEnd) : szUrl;
}
- PushRequest(new CreateEndpointRequest(this));
+ SendCreateEndpoint();
return;
case 401: // unauthorized
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 620b03b386..6e68c5ce16 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -215,7 +215,7 @@ int CSkypeProto::SetStatus(int iNewStatus) if (iNewStatus == ID_STATUS_OFFLINE) {
if (m_iStatus > ID_STATUS_CONNECTING + 1 && m_szId)
- PushRequest(new DeleteEndpointRequest(this));
+ PushRequest(new AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/endpoints/" + mir_urlEncode(m_szId), &CSkypeProto::OnEndpointDeleted));
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
// logout
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index a7ab5a6df6..6cdf9fdde6 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -237,6 +237,7 @@ private: // login
void Login();
void TryCreateEndpoint();
+ void SendCreateEndpoint();
void SendPresence();
// profile
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 162b708a77..917bea0194 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -116,7 +116,6 @@ struct AsyncHttpRequest : public MTHttpRequest<CSkypeProto> #include "requests/capabilities.h"
#include "requests/chatrooms.h"
#include "requests/contacts.h"
-#include "requests/endpoint.h"
#include "requests/history.h"
#include "requests/login.h"
#include "requests/messages.h"
|