summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-06-14 15:12:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-06-14 15:12:38 +0300
commit3ed6cb8e1529be9278b23515317d891b277eaaed (patch)
tree0ec14791617f036a65440bfaabeb6840c6e78d88
parent62686fa957f952f0125c168b23e98c9e2d70c5c0 (diff)
Teams: everything related to /threads & /conversations from now on works only via HOST_CHATS
-rw-r--r--protocols/Teams/src/stdafx.h1
-rw-r--r--protocols/Teams/src/teams_chatrooms.cpp4
-rw-r--r--protocols/Teams/src/teams_files.cpp2
-rw-r--r--protocols/Teams/src/teams_http.cpp7
-rw-r--r--protocols/Teams/src/teams_messages.cpp4
-rw-r--r--protocols/Teams/src/teams_proto.cpp4
6 files changed, 8 insertions, 14 deletions
diff --git a/protocols/Teams/src/stdafx.h b/protocols/Teams/src/stdafx.h
index ef50cefd9c..82542b649b 100644
--- a/protocols/Teams/src/stdafx.h
+++ b/protocols/Teams/src/stdafx.h
@@ -67,7 +67,6 @@ enum SkypeHost
{
HOST_API,
HOST_CONTACTS,
- HOST_DEFAULT,
HOST_LOGIN,
HOST_TEAMS,
HOST_TEAMS_API,
diff --git a/protocols/Teams/src/teams_chatrooms.cpp b/protocols/Teams/src/teams_chatrooms.cpp
index 7a35d00562..ca0621bed5 100644
--- a/protocols/Teams/src/teams_chatrooms.cpp
+++ b/protocols/Teams/src/teams_chatrooms.cpp
@@ -343,7 +343,7 @@ void CTeamsProto::SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage)
node << INT_PARAM("skypeemoteoffset", 4);
CMStringA szUrl = "/users/ME/conversations/" + mir_urlEncode(T2Utf(si->ptszID)) + "/messages";
- AsyncHttpRequest *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, szUrl, &CTeamsProto::OnMessageSent);
+ AsyncHttpRequest *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_CHATS, szUrl, &CTeamsProto::OnMessageSent);
pReq->m_szParam = node.write().c_str();
pReq->pUserInfo = new COwnMessage(szMessage);
pReq->hContact = si->hContact;
@@ -354,7 +354,7 @@ void CTeamsProto::SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage)
void CTeamsProto::GetChatMembers(const LIST<char> &ids, SESSION_INFO *si)
{
- auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/profiles", &CTeamsProto::OnGetChatMembers);
+ auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_CHATS, "/profiles", &CTeamsProto::OnGetChatMembers);
JSONNode node, mris(JSON_ARRAY); mris.set_name("mris");
for (auto &it : ids)
diff --git a/protocols/Teams/src/teams_files.cpp b/protocols/Teams/src/teams_files.cpp
index 4efb89a662..bab5d72c6d 100644
--- a/protocols/Teams/src/teams_files.cpp
+++ b/protocols/Teams/src/teams_files.cpp
@@ -274,7 +274,7 @@ void CTeamsProto::OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest
doc.Print(&printer);
// create a new file transfer event using previously filled slot
- auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT);
+ auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_CHATS);
pReq->m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", mir_urlEncode(getId(fup->hContact)).c_str());
pReq->hContact = fup->hContact;
diff --git a/protocols/Teams/src/teams_http.cpp b/protocols/Teams/src/teams_http.cpp
index 7e3e050b8d..9f90bebe71 100644
--- a/protocols/Teams/src/teams_http.cpp
+++ b/protocols/Teams/src/teams_http.cpp
@@ -28,11 +28,6 @@ AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpR
case HOST_TEAMS_API: m_szUrl = TEAMS_BASE_HOST "/api/mt/beta"; break;
case HOST_CHATS: m_szUrl = TEAMS_BASE_HOST "/api/chatsvc/consumer/v1"; break;
case HOST_PRESENCE: m_szUrl = "presence." TEAMS_BASE_HOST "/v1"; break;
-
- case HOST_DEFAULT:
- AddHeader("MS-IC3-Product", "Sfl");
- m_szUrl = "msgapi." TEAMS_BASE_HOST "/v1";
- break;
}
AddHeader("User-Agent", TEAMS_USER_AGENT);
@@ -104,7 +99,6 @@ MHttpResponse* CTeamsProto::DoSend(AsyncHttpRequest *pReq)
switch (pReq->m_host) {
case HOST_CONTACTS:
- case HOST_DEFAULT:
pReq->AddAuthentication(this);
pReq->AddHeader("Accept", "application/json");
pReq->AddHeader("X-Stratus-Caller", TEAMS_CLIENTINFO_NAME);
@@ -133,6 +127,7 @@ MHttpResponse* CTeamsProto::DoSend(AsyncHttpRequest *pReq)
case HOST_CHATS:
pReq->AddAuthentication(this);
+ pReq->AddHeader("MS-IC3-Product", "Sfl");
pReq->AddHeader("Accept", "application/json");
break;
diff --git a/protocols/Teams/src/teams_messages.cpp b/protocols/Teams/src/teams_messages.cpp
index beb077eb64..276776fb83 100644
--- a/protocols/Teams/src/teams_messages.cpp
+++ b/protocols/Teams/src/teams_messages.cpp
@@ -105,7 +105,7 @@ int CTeamsProto::SendServerMsg(MCONTACT hContact, const char *szMessage, int64_t
m_OutMessages.insert(pOwnMessage = new COwnMessage(m_iMessageId, iRandomId));
}
- AsyncHttpRequest *pReq = new AsyncHttpRequest(existingMsgId ? REQUEST_PUT : REQUEST_POST, HOST_DEFAULT, szUrl, &CTeamsProto::OnMessageSent);
+ AsyncHttpRequest *pReq = new AsyncHttpRequest(existingMsgId ? REQUEST_PUT : REQUEST_POST, HOST_CHATS, szUrl, &CTeamsProto::OnMessageSent);
pReq->hContact = hContact;
pReq->pUserInfo = pOwnMessage;
pReq->m_szParam = node.write().c_str();
@@ -225,7 +225,7 @@ void CTeamsProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent)
if (IsOnline()) {
DB::EventInfo dbei(hDbEvent, false);
if (dbei && dbei.szId) {
- auto *pReq = new AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/properties?name=consumptionhorizon");
+ auto *pReq = new AsyncHttpRequest(REQUEST_PUT, HOST_CHATS, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/properties?name=consumptionhorizon");
auto msgTimestamp = _atoi64(dbei.szId);
JSONNode node(JSON_NODE);
diff --git a/protocols/Teams/src/teams_proto.cpp b/protocols/Teams/src/teams_proto.cpp
index a9462bec8d..dfa09503e0 100644
--- a/protocols/Teams/src/teams_proto.cpp
+++ b/protocols/Teams/src/teams_proto.cpp
@@ -89,7 +89,7 @@ void CTeamsProto::OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent, int flags)
DB::EventInfo dbei(hDbEvent, false);
if (dbei.szId) {
- auto *pReq = new AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages/" + dbei.szId);
+ auto *pReq = new AsyncHttpRequest(REQUEST_DELETE, HOST_CHATS, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages/" + dbei.szId);
pReq->AddAuthentication(this);
pReq->AddHeader("Origin", "https://web.skype.com");
pReq->AddHeader("Referer", "https://web.skype.com/");
@@ -260,7 +260,7 @@ int CTeamsProto::UserIsTyping(MCONTACT hContact, int iState)
node << INT64_PARAM("clientmessageid", getRandomId()) << CHAR_PARAM("contenttype", "Application/Message") << CHAR_PARAM("content", "")
<< CHAR_PARAM("messagetype", (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping");
- auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages");
+ auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_CHATS, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages");
pReq->m_szParam = node.write().c_str();
PushRequest(pReq);
return 0;