summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-10-01 03:04:14 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-10-01 03:04:14 +0000
commit5a711f8a20a86ec1519e6ea96cdd1f75b2d01d9e (patch)
tree59ae9fa3e2c89d4a32eac58e0d8b31c788a8f7db /protocols/VKontakte/src/misc.cpp
parent5df6191d2ada9898dfb07658811011cc59509ef9 (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/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp71
1 files changed, 37 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