diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-03-30 20:04:12 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-03-30 20:04:12 +0300 |
| commit | 351a4ae54f9d6e2c1a5b9a6dee08961fbb51e92a (patch) | |
| tree | 8c0416992e12074612afdf86d33e2c5f85f51bba /protocols/Teams/src/teams_http.cpp | |
| parent | 5b036d1ae27b1ab12623778fec0aa90b239496c6 (diff) | |
Teams: synced with existing Skype code base
Diffstat (limited to 'protocols/Teams/src/teams_http.cpp')
| -rw-r--r-- | protocols/Teams/src/teams_http.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/protocols/Teams/src/teams_http.cpp b/protocols/Teams/src/teams_http.cpp index ecce58fa92..e32ae4c3cb 100644 --- a/protocols/Teams/src/teams_http.cpp +++ b/protocols/Teams/src/teams_http.cpp @@ -17,12 +17,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -AsyncHttpRequest::AsyncHttpRequest(int type, HostType host, LPCSTR url, MTHttpRequestHandler pFunc) : +AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpRequestHandler pFunc) : m_host(host) { switch (host) { + case HOST_API: m_szUrl = "api.skype.com"; break; + case HOST_PEOPLE: m_szUrl = "people.skype.com/v2"; break; + case HOST_CONTACTS: m_szUrl = "edge.skype.com/pcs/contacts/v2"; break; + case HOST_GRAPH: m_szUrl = "skypegraph.skype.com"; break; case HOST_LOGIN: m_szUrl = "login.microsoftonline.com"; break; case HOST_TEAMS: m_szUrl = "teams.live.com"; break; + + case HOST_DEFAULT: + AddHeader("MS-IC3-Product", "Sfl"); + m_szUrl = "msgapi.teams.live.com/v1"; + break; } AddHeader("User-Agent", NETLIB_USER_AGENT); @@ -33,17 +42,16 @@ AsyncHttpRequest::AsyncHttpRequest(int type, HostType host, LPCSTR url, MTHttpRe flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; requestType = type; } -/* + void AsyncHttpRequest::AddAuthentication(CTeamsProto *ppro) { - AddHeader("Authentication", CMStringA("skypetoken=") + ppro->m_szApiToken); + AddHeader("Authentication", CMStringA("skypetoken=") + ppro->m_szSkypeToken); } void AsyncHttpRequest::AddRegister(CTeamsProto *ppro) { AddHeader("RegistrationToken", CMStringA("registrationToken=") + ppro->m_szToken); } -*/ ///////////////////////////////////////////////////////////////////////////////////////// @@ -103,6 +111,31 @@ MHttpResponse* CTeamsProto::DoSend(AsyncHttpRequest *pReq) } } + switch (pReq->m_host) { + case HOST_API: + case HOST_PEOPLE: + case HOST_CONTACTS: + if (m_szSkypeToken) + pReq->AddHeader("X-Skypetoken", m_szSkypeToken); + + pReq->AddHeader("Accept", "application/json"); + pReq->AddHeader("Origin", "https://web.skype.com"); + pReq->AddHeader("Referer", "https://web.skype.com/"); + break; + + case HOST_GRAPH: + if (m_szSkypeToken) + pReq->AddHeader("X-Skypetoken", m_szSkypeToken); + pReq->AddHeader("Accept", "application/json"); + break; + + case HOST_DEFAULT: + if (m_szToken) + pReq->AddRegister(this); + pReq->AddHeader("Accept", "application/json, text/javascript"); + break; + } + debugLogA("Send request to %s", pReq->m_szUrl.c_str()); return Netlib_HttpTransaction(m_hNetlibUser, pReq); |
