From df5a99c47693ecca5337b1c0f1a65cdb6a4048a0 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 6 Jun 2015 19:01:08 +0000 Subject: SkypeWeb: Fix status changing error 729. git-svn-id: http://svn.miranda-ng.org/main/trunk@14027 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_login.cpp | 27 +++++++++++++++++---------- protocols/SkypeWeb/src/skype_proto.h | 3 ++- protocols/SkypeWeb/src/skype_trouter.cpp | 3 ++- protocols/SkypeWeb/src/skype_utils.cpp | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index a6e26bc53c..b26516bc32 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -17,6 +17,8 @@ along with this program. If not, see . #include "stdafx.h" +UINT_PTR CSkypeProto::m_timer; + void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) { if (response == NULL || response->pData == NULL) @@ -80,7 +82,6 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) OnLoginSuccess(); } - void CSkypeProto::OnLoginSuccess() { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0); @@ -172,21 +173,27 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) SetStatus(ID_STATUS_OFFLINE); return; } - char *cName; + SendPresence(true); +} + +void CSkypeProto::SendPresence(bool isLogin) +{ + ptrA epname; ptrT place(getTStringA("Place")); - if (place && *place) - cName = mir_utf8encodeT(place); + if (!getBool("UseHostName", false) && place && *place) + epname = mir_utf8encodeT(place); else { - char compName[MAX_COMPUTERNAME_LENGTH + 1]; + TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD size = SIZEOF(compName); - GetComputerNameA(compName, &size); - cName = compName; + GetComputerName(compName, &size); + epname = mir_utf8encodeT(compName); } - PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, cName, Server), &CSkypeProto::OnCapabilitiesSended); - - mir_free(cName); + if (isLogin) + PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, epname, Server), &CSkypeProto::OnCapabilitiesSended); + else + PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, epname, Server)); } void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 6a16d06939..ca3ddc7a26 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -98,7 +98,7 @@ public: void __cdecl SearchBasicThread(void* id); //////////////////////////////////////////// - UINT_PTR m_timer; + static UINT_PTR m_timer; static int CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2); void ProcessTimer(); static INT_PTR EventGetIcon(WPARAM wParam, LPARAM lParam); @@ -174,6 +174,7 @@ private: void OnLoginOAuth(const NETLIBHTTPREQUEST *response); void OnLoginSuccess(); void OnEndpointCreated(const NETLIBHTTPREQUEST *response); + void SendPresence(bool isLogin = false); void OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response); void OnCapabilitiesSended(const NETLIBHTTPREQUEST *response); void OnStatusChanged(const NETLIBHTTPREQUEST *response); diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 5971a6a49b..f86f29376c 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -105,7 +105,8 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p) int iStart = 0; CMStringA szToken = data.Tokenize(":", iStart).Trim(); TRouter.sessId = szToken.GetString(); - m_hTrouterThread = ForkThreadEx(&CSkypeProto::TRouterThread, 0, NULL); + if (!m_hTrouterThread) + m_hTrouterThread = ForkThreadEx(&CSkypeProto::TRouterThread, 0, NULL); if (!isHealth) SendRequest(new RegisterTrouterRequest(TokenSecret, TRouter.url.c_str(), TRouter.sessId.c_str())); diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 9430f0f2e6..d0cf4ed480 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -760,7 +760,7 @@ void CSkypeProto::ProcessTimer() if (IsOnline()) { PushRequest(new GetContactListRequest(TokenSecret), &CSkypeProto::LoadContactList); - + SendPresence(false); if (!m_hTrouterThread) SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter); } -- cgit v1.2.3