From 76788a1a22cfff85e756e4f06d3433dae257412f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Mar 2023 20:00:31 +0300 Subject: =?UTF-8?q?fixes=20#3410=20(SkypeWeb:=20=D0=BF=D1=80=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=BA=D0=BE=D0=BB=20=D0=BD=D0=B5=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D0=B5=D1=82=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/SkypeWeb/src/skype_login.cpp | 30 +++++++++++++++++++++++++++ protocols/SkypeWeb/src/skype_proto.cpp | 37 +++++++--------------------------- protocols/SkypeWeb/src/skype_proto.h | 4 +++- 3 files changed, 40 insertions(+), 31 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 94faff30d8..396798b6dc 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -17,8 +17,34 @@ along with this program. If not, see . #include "stdafx.h" +void CSkypeProto::CheckConvert() +{ + m_szSkypename = getMStringA(SKYPE_SETTINGS_ID); + if (m_szSkypename.IsEmpty()) { + m_szSkypename = getMStringA(SKYPE_SETTINGS_LOGIN); + if (!m_szSkypename.IsEmpty()) { // old settings format, need to update all settings + m_szSkypename.Insert(0, "8:"); + setString(SKYPE_SETTINGS_ID, m_szSkypename); + + for (auto &hContact : AccContacts()) { + CMStringA id(ptrA(getUStringA(hContact, "Skypename"))); + if (!id.IsEmpty()) + setString(hContact, SKYPE_SETTINGS_ID, (isChatRoom(hContact)) ? "19:" + id : "8:" + id); + + ptrW wszNick(getWStringA(hContact, "Nick")); + if (wszNick == nullptr) + setUString(hContact, "Nick", id); + + delSetting(hContact, "Skypename"); + } + } + } +} + void CSkypeProto::Login() { + CheckConvert(); + // login m_iStatus = ID_STATUS_CONNECTING; StartQueue(); @@ -107,6 +133,10 @@ void CSkypeProto::OnLoginSuccess() m_bThreadsTerminated = false; ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0); + int oldStatus = m_iStatus; + m_iStatus = m_iDesiredStatus; + ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus); + m_szApiToken = getStringA("TokenSecret"); m_impl.m_heartBeat.StartSafe(600 * 1000); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 8bf269e682..f146b1ebdf 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -57,27 +57,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, NULL, NULL); - m_szSkypename = getMStringA(SKYPE_SETTINGS_ID); - if (m_szSkypename.IsEmpty()) { - m_szSkypename = getMStringA(SKYPE_SETTINGS_LOGIN); - if (!m_szSkypename.IsEmpty()) { // old settings format, need to update all settings - m_szSkypename.Insert(0, "8:"); - setString(SKYPE_SETTINGS_ID, m_szSkypename); - - for (auto &hContact : AccContacts()) { - CMStringA id(ptrA(getUStringA(hContact, "Skypename"))); - if (!id.IsEmpty()) - setString(hContact, SKYPE_SETTINGS_ID, (isChatRoom(hContact)) ? "19:"+id : "8:"+id); - - ptrW wszNick(getWStringA(hContact, "Nick")); - if (wszNick == nullptr) - setUString(hContact, "Nick", id); - - delSetting(hContact, "Skypename"); - } - } - } - + CheckConvert(); InitGroupChatModule(); } @@ -282,17 +262,14 @@ int CSkypeProto::SetStatus(int iNewStatus) setAllContactStatuses(ID_STATUS_OFFLINE, false); return 0; } - else { - if (old_status == ID_STATUS_CONNECTING) - return 0; - if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE) - Login(); - else - PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus))); - } + if (m_iStatus == ID_STATUS_CONNECTING) + return 0; - ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + if (m_iStatus == ID_STATUS_OFFLINE) + Login(); + else + PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus))); return 0; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 8a48e595dc..3bc4a5a6c2 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -80,7 +80,7 @@ public: // menus static void InitMenus(); - //popups + // popups void InitPopups(); void UninitPopups(); @@ -158,6 +158,8 @@ public: void OnGetChatInfo(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest); void OnReceiveAwayMsg(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest); + void CheckConvert(void); + bool CheckOauth(const char *szResponse); void LoadProfile(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest); -- cgit v1.2.3