diff options
Diffstat (limited to 'protocols/Teams/src/proto.h')
-rw-r--r-- | protocols/Teams/src/proto.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/protocols/Teams/src/proto.h b/protocols/Teams/src/proto.h index de6a543bd9..aad0d47b7a 100644 --- a/protocols/Teams/src/proto.h +++ b/protocols/Teams/src/proto.h @@ -1,3 +1,5 @@ +#define TEAMS_CLIENT_ID "8ec6bc83-69c8-4392-8f08-b3c986009232" + enum HostType { HOST_OTHER = 0, HOST_LOGIN = 1, @@ -13,6 +15,26 @@ struct AsyncHttpRequest : public MTHttpRequest<CTeamsProto> class CTeamsProto : public PROTO<CTeamsProto> { friend class COptionsMainDlg; + friend class CDeviceCodeDlg; + + class CTeamsProtoImpl + { + friend class CTeamsProto; + CTeamsProto &m_proto; + + CTimer m_loginPoll; + void OnLoginPoll(CTimer *) + { + m_proto.LoginPoll(); + } + + CTeamsProtoImpl(CTeamsProto &pro) : + m_proto(pro), + m_loginPoll(Miranda_GetSystemWindow(), UINT_PTR(this) + 1) + { + m_loginPoll.OnEvent = Callback(this, &CTeamsProtoImpl::OnLoginPoll); + } + } m_impl; CMStringA GetTenant(); @@ -22,6 +44,7 @@ class CTeamsProto : public PROTO<CTeamsProto> LIST<AsyncHttpRequest> m_requests; MEventHandle m_hRequestQueueEvent; HANDLE m_hRequestQueueThread; + CMStringA m_szAccessToken; void __cdecl WorkerThread(void *); @@ -34,9 +57,17 @@ class CTeamsProto : public PROTO<CTeamsProto> void PushRequest(AsyncHttpRequest *request); // login + CMStringW m_wszUserCode; + CMStringA m_szDeviceCode, m_szDeviceCookie, m_szVerificationUrl; + time_t m_iLoginExpires; + void Login(); + void LoginPoll(); + void LoginError(); void RefreshToken(const char *pszScope, AsyncHttpRequest::MTHttpRequestHandler pFunc); + void OnReceiveDevicePoll(MHttpResponse *response, AsyncHttpRequest *pRequest); + void OnReceiveDeviceToken(MHttpResponse *response, AsyncHttpRequest *pRequest); void OnRefreshAccessToken(MHttpResponse *response, AsyncHttpRequest *pRequest); void OnRefreshSubstrate(MHttpResponse *response, AsyncHttpRequest *pRequest); |