diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-22 19:09:19 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-22 19:09:19 +0000 |
commit | 793ed2c300803e66baf0e39559cf6cc71e4766b2 (patch) | |
tree | dcd82f2e07dae9a6241bb53e6b7a9c28c939f6b3 /protocols/SkypeWeb/src | |
parent | adbd50c5672bf7e6c7cbb863d763c867266162b4 (diff) |
SkypeWeb: attempt to fix login troubles
git-svn-id: http://svn.miranda-ng.org/main/trunk@15013 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 13 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 7 |
3 files changed, 21 insertions, 5 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 3db5b33aaf..3a9446553c 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. UINT_PTR CSkypeProto::m_timer;
-void CSkypeProto::Login()
+void CSkypeProto::Login(void*)
{
// login
m_iStatus = ID_STATUS_CONNECTING;
@@ -34,6 +34,11 @@ void CSkypeProto::Login() ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
return;
}
+
+ mir_cslock lck(m_LoginLock);
+
+ if (m_iStatus > ID_STATUS_OFFLINE) return;
+
HistorySynced = isTerminated = false;
if ((tokenExpires - 1800) > time(NULL))
OnLoginSuccess();
@@ -44,6 +49,10 @@ void CSkypeProto::Login() else
SendRequest(new LoginOAuthRequest(li.szSkypename, szPassword), &CSkypeProto::OnLoginOAuth);
}
+
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_CONNECTING);
+
+ WaitForSingleObject(m_hLoginEvent, INFINITE);
}
void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response)
@@ -257,6 +266,8 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, 0, NULL);
+ SetEvent(m_hLoginEvent);
+
SendRequest(new LoadChatsRequest(li), &CSkypeProto::OnLoadChats);
SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 24b1cf110a..f4bdb7aac9 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -49,6 +49,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound"));
m_hTrouterEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ m_hLoginEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
SkypeSetTimer();
}
@@ -62,7 +63,8 @@ CSkypeProto::~CSkypeProto() UninitPopups();
CloseHandle(m_hTrouterEvent); m_hTrouterEvent = NULL;
-
+ CloseHandle(m_hLoginEvent); m_hLoginEvent = NULL;
+
SkypeUnsetTimer();
}
@@ -235,7 +237,7 @@ int CSkypeProto::SetStatus(int iNewStatus) if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE)
{
- Login();
+ ForkThread(&CSkypeProto::Login, NULL);
}
else
{
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 1b3a9d9d38..1b9dc890e3 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -109,6 +109,8 @@ private: m_TrouterConnection,
m_hTrouterEvent;
+ HANDLE m_hLoginEvent;
+
TRInfo TRouter;
LIST<void> m_PopupClasses;
@@ -122,8 +124,9 @@ private: mir_cs m_InviteDialogsLock;
mir_cs m_GCCreateDialogsLock;
mir_cs messageSyncLock;
- mir_cs m_StatusLock;
+ mir_cs m_LoginLock;
mir_cs m_AppendMessageLock;
+
static mir_cs accountsLock;
static mir_cs timerLock;
@@ -171,7 +174,7 @@ private: int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
// login
- void Login();
+ void __cdecl Login(void*);
void OnMSLoginFirst(const NETLIBHTTPREQUEST *response);
void OnMSLoginSecond(const NETLIBHTTPREQUEST *response);
void OnMSLoginThird(const NETLIBHTTPREQUEST *response);
|