diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-11-28 07:53:55 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-11-28 07:53:55 +0000 |
commit | c602f1813c094cf5b355867ee253a9ad4ef3c147 (patch) | |
tree | fd644e63e9078c4d47225d08178d0fde9184f091 /protocols/VKontakte/src/vk_thread.cpp | |
parent | 0c89be2bea895bfe6c6077f4ac09d72fdffd160f (diff) |
VKontakte:
fix unset and timer for multiprotocol configuration
remove 'goto' contructions
code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@11127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index a925887b68..326833dc79 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -50,10 +50,11 @@ void CVkProto::ConnectionFailed(int iReason) static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- for (int i = 0; i < vk_Instances.getCount(); i++){
- vk_Instances[i]->SetServerStatus(vk_Instances[i]->m_iDesiredStatus);
- vk_Instances[i]->RetrieveUsersInfo(true);
- }
+ for (int i = 0; i < vk_Instances.getCount(); i++)
+ if (vk_Instances[i]->IsOnline()){
+ vk_Instances[i]->SetServerStatus(vk_Instances[i]->m_iDesiredStatus);
+ vk_Instances[i]->RetrieveUsersInfo(true);
+ }
}
static void CALLBACK VKSetTimer(void *pObject)
@@ -95,7 +96,7 @@ void CVkProto::OnLoggedOut() bool bOnline = false;
for (int i=0; i < vk_Instances.getCount(); i++)
- bOnline = bOnline && vk_Instances[i]->IsOnline();
+ bOnline = bOnline || vk_Instances[i]->IsOnline();
if(!bOnline)
CallFunctionAsync(VKUnsetTimer, this);
SetAllContactStatuses(ID_STATUS_OFFLINE);
@@ -182,8 +183,7 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq return;
}
- if (reply->resultCode != 200) { // something went wrong
-LBL_NoForm:
+ if (reply->resultCode != 200 || !strstr(reply->pData, "form method=\"post\"")){ // something went wrong
ConnectionFailed(LOGINERR_NOSERVER);
return;
}
@@ -192,16 +192,14 @@ LBL_NoForm: ConnectionFailed(LOGINERR_WRONGPASSWORD);
return;
}
-
- // Application requests access to user's account
- if (!strstr(reply->pData, "form method=\"post\""))
- goto LBL_NoForm;
-
+
CMStringA szAction, szBody;
bool bSuccess = AutoFillForm(reply->pData, szAction, szBody);
if (!bSuccess || szAction.IsEmpty() || szBody.IsEmpty()) {
- if (m_prevError)
- goto LBL_NoForm;
+ if (m_prevError){
+ ConnectionFailed(LOGINERR_NOSERVER);
+ return;
+ }
m_prevError = true;
}
|