summaryrefslogtreecommitdiff
path: root/protocols/Teams/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Teams/src')
-rw-r--r--protocols/Teams/src/teams_login.cpp1
-rw-r--r--protocols/Teams/src/teams_proto.h4
-rw-r--r--protocols/Teams/src/teams_server.cpp38
-rw-r--r--protocols/Teams/src/teams_trouter.cpp2
4 files changed, 3 insertions, 42 deletions
diff --git a/protocols/Teams/src/teams_login.cpp b/protocols/Teams/src/teams_login.cpp
index 2eaf0e2f60..4d494276b2 100644
--- a/protocols/Teams/src/teams_login.cpp
+++ b/protocols/Teams/src/teams_login.cpp
@@ -41,6 +41,7 @@ void CTeamsProto::LoggedIn()
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
SetServerStatus(m_iStatus);
+ SendPresence();
StartTrouter();
}
diff --git a/protocols/Teams/src/teams_proto.h b/protocols/Teams/src/teams_proto.h
index f3c33b727c..be53411952 100644
--- a/protocols/Teams/src/teams_proto.h
+++ b/protocols/Teams/src/teams_proto.h
@@ -176,7 +176,7 @@ public:
void OnSearch(MHttpResponse *response, AsyncHttpRequest *pRequest);
// login
- void OnSubscriptionsCreated(MHttpResponse *response, AsyncHttpRequest *pRequest);
+
void OnCapabilitiesSended(MHttpResponse *response, AsyncHttpRequest *pRequest);
void OnStatusChanged(MHttpResponse *response, AsyncHttpRequest *pRequest);
@@ -302,10 +302,8 @@ private:
void SetServerStatus(int iStatus);
- void CreateSubscription();
void CreateContactSubscription();
-
// utils
__forceinline bool IsOnline() const
{ return (m_iStatus > ID_STATUS_OFFLINE);
diff --git a/protocols/Teams/src/teams_server.cpp b/protocols/Teams/src/teams_server.cpp
index 16acce435d..d7e029af08 100644
--- a/protocols/Teams/src/teams_server.cpp
+++ b/protocols/Teams/src/teams_server.cpp
@@ -48,7 +48,7 @@ void CTeamsProto::SendPresence()
else {
wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = _countof(compName);
- GetComputerName(compName, &size);
+ GetComputerNameW(compName, &size);
epname = mir_utf8encodeW(compName);
}
@@ -117,42 +117,6 @@ void CTeamsProto::SetServerStatus(int iStatus)
/////////////////////////////////////////////////////////////////////////////////////////
-void CTeamsProto::OnSubscriptionsCreated(MHttpResponse *response, AsyncHttpRequest *)
-{
- if (response == nullptr) {
- debugLogA(__FUNCTION__ ": failed to create subscription");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, 1001);
- SetStatus(ID_STATUS_OFFLINE);
- }
- else SendPresence();
-}
-
-void CTeamsProto::CreateSubscription()
-{
- JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources");
- interestedResources << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/properties")
- << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/messages")
- << CHAR_PARAM("", "/v1/users/ME/contacts/ALL")
- << CHAR_PARAM("", "/v1/threads/ALL");
-
- JSONNode subscription, trouter;
- subscription << CHAR_PARAM("channelType", "HttpLongPoll") << interestedResources;
- trouter << CHAR_PARAM("channelType", "TrouterPush") << CHAR_PARAM("longPollUrl", m_szTrouterSurl) << interestedResources;
-
- JSONNode subscriptions(JSON_ARRAY); subscriptions.set_name("subscriptions");
- subscriptions << subscription << trouter;
-
- JSONNode node;
- node << INT_PARAM("startingTimeSpan", 0) << CHAR_PARAM("endpointFeatures", "Agent,Presence2015,MessageProperties,CustomUserProperties,NotificationStream,SupportsSkipRosterFromThreads")
- << subscriptions;
-
- auto *pReq = new AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT_V2, "/users/ME/endpoints/" + m_szEndpoint, &CTeamsProto::OnSubscriptionsCreated);
- pReq->m_szParam = node.write().c_str();
- PushRequest(pReq);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void CTeamsProto::CreateContactSubscription()
{
CMStringA szUrl = m_szTrouterSurl;
diff --git a/protocols/Teams/src/teams_trouter.cpp b/protocols/Teams/src/teams_trouter.cpp
index 2772b39578..5d8ac4a00d 100644
--- a/protocols/Teams/src/teams_trouter.cpp
+++ b/protocols/Teams/src/teams_trouter.cpp
@@ -62,8 +62,6 @@ void CTeamsProto::OnTrouterInfo(MHttpResponse *response, AsyncHttpRequest *)
if (!ccid.IsEmpty())
pReq << CHAR_PARAM("ccid", ccid);
PushRequest(pReq);
-
- CreateSubscription();
}
void CTeamsProto::StartTrouter()