From 5116d00341d784f690650bc4da8a5daed493fd59 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Tue, 14 Apr 2015 17:21:31 +0000 Subject: SkypeWeb: Login/logout refactoring part 1. git-svn-id: http://svn.miranda-ng.org/main/trunk@12822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_login.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'protocols/SkypeWeb/src/skype_login.cpp') diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 2df0ff7ceb..dc86c654dc 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -84,13 +84,13 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) std::string token = match[1]; setString("TokenSecret", token.c_str()); - /*regex = ""; + regex = ""; if (std::regex_search(content, match, regex)) { std::string expiresIn = match[1]; int seconds = atoi(expiresIn.c_str()); setDword("TokenExpiresIn", time(NULL) + seconds); - }*/ + } for (int i = 0; i < response->headersCount; i++) { @@ -102,13 +102,15 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) if (std::regex_search(content, match, regex)) cookies[match[1]] = match[2]; } + OnLoginSuccess(); +} - PushRequest(new CreateEndpointRequest(token.c_str()), &CSkypeProto::OnEndpointCreated); - - PushRequest(new GetProfileRequest(token.c_str()), &CSkypeProto::LoadProfile); - ptrA szUrl(getStringA("AvatarUrl")); - PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, NULL); - PushRequest(new GetContactListRequest(token.c_str()), &CSkypeProto::LoadContactList); +void CSkypeProto::OnLoginSuccess() +{ + PushRequest(new CreateEndpointRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::OnEndpointCreated); + PushRequest(new GetProfileRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::LoadProfile); + PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL); + PushRequest(new GetContactListRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::LoadContactList); } void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) -- cgit v1.2.3