diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-01 03:04:14 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-01 03:04:14 +0000 |
commit | 5a711f8a20a86ec1519e6ea96cdd1f75b2d01d9e (patch) | |
tree | 59ae9fa3e2c89d4a32eac58e0d8b31c788a8f7db /protocols | |
parent | 5df6191d2ada9898dfb07658811011cc59509ef9 (diff) |
VKontakte:
refactoring SetMirVer
clear old MirVer on start proto
git-svn-id: http://svn.miranda-ng.org/main/trunk@10658 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 71 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 1 |
2 files changed, 38 insertions, 34 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 2304339c5e..8a5303b3a1 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -421,40 +421,43 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) CMString MirVer, OldMirVer;
OldMirVer = db_get_sa(hContact, m_szModuleName, "MirVer");
- if (platform == VK_APP_ID)
+ bool bSetFlag = OldMirVer.IsEmpty() || (OldMirVer == "VKontakte (other)");
+
+ switch (platform){
+ case VK_APP_ID:
MirVer = "Miranda NG VKontakte";
- else
- switch (platform){
- case 1:
- MirVer = "VKontakte (mobile)";
- break;
- case 2:
- MirVer = "VKontakte (iphone)";
- break;
- case 3:
- MirVer = "VKontakte (ipad)";
- break;
- case 4:
- MirVer = "VKontakte (android)";
- break;
- case 5:
- MirVer = "VKontakte (wphone)";
- break;
- case 6:
- MirVer = "VKontakte (windows)";
- break; // Official app for Windows 8.X
- case 7:
- MirVer = "VKontakte (website)";
- break;
- default:
- MirVer = "VKontakte (other)";
+ bSetFlag = true;
+ break;
+ case 1:
+ MirVer = "VKontakte (mobile)";
+ bSetFlag = true;
+ break;
+ case 2:
+ MirVer = "VKontakte (iphone)";
+ break;
+ case 3:
+ MirVer = "VKontakte (ipad)";
+ break;
+ case 4:
+ MirVer = "VKontakte (android)";
+ break;
+ case 5:
+ MirVer = "VKontakte (wphone)";
+ break;
+ case 6:
+ MirVer = "VKontakte (windows)";
+ break; // Official app for Windows 8.X
+ case 7:
+ MirVer = "VKontakte (website)";
+ bSetFlag = true;
+ break;
+ default:
+ MirVer = "VKontakte (other)";
}
-
- if (OldMirVer != MirVer)
- if (OldMirVer.IsEmpty()
- || (OldMirVer == "VKontakte (other)")
- || (platform == 7)
- || (platform == 1)
- || (platform == VK_APP_ID))
- setTString(hContact, "MirVer", MirVer.GetBuffer());
+
+ if (OldMirVer == MirVer)
+ return;
+
+ if (bSetFlag)
+ setTString(hContact, "MirVer", MirVer.GetBuffer());
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 86d12c6547..d1f2152bfe 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -460,6 +460,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)){
db_unset(hContact, m_szModuleName, "Auth");
db_unset(hContact, m_szModuleName, "ReqAuth");
+ SetMirVer(hContact, -1);
if (bCleanContacts&&!isChatRoom(hContact))
arContacts.insert((HANDLE)hContact);
}
|