summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-30 18:40:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-30 18:40:17 +0000
commit4239659c7d805936ca4defc3c418224ffbce12a6 (patch)
treef1ba3fa99cbe856adf23eca15a8450ed050690fd /protocols
parentc00d1d01ba72a6a00a915dd9c303e9322264f2ee (diff)
VK: contact list sync option
git-svn-id: http://svn.miranda-ng.org/main/trunk@7960 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/res/resource.rc4
-rw-r--r--protocols/VKontakte/src/resource.h5
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_options.cpp4
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp12
5 files changed, 23 insertions, 4 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index c5f96aad2d..4b70ce0494 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -50,8 +50,10 @@ BEGIN
LTEXT "Contact list group:",IDC_STATIC,12,88,146,8
EDITTEXT IDC_GROUPNAME,167,86,121,12,ES_AUTOHSCROLL
GROUPBOX "Advanced",IDC_STATIC,4,108,293,108
- CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,121,278,10
+ CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,120,278,10
CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,134,278,10
+ CONTROL "Automatically wipe local contacts missing in your Friends list",IDC_AUTOCLEAN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,278,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index 3624c5ca01..8eaf42c489 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -23,15 +23,16 @@
#define IDC_CLIST 1013
#define IDC_HIDECHATS 1014
#define IDC_CONTACT 1015
+#define IDC_AUTOCLEAN 1020
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1020
+#define _APS_NEXT_CONTROL_VALUE 1021
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index babbb11507..8c62208741 100644
--- a/protocols/VKontakte/src/version.h
+++ b/protocols/VKontakte/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 9
+#define __BUILD_NUM 10
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 60cfb60407..2a270e7005 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -120,6 +120,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery);
CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
return TRUE;
case WM_COMMAND:
@@ -137,6 +138,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case IDC_DELIVERY:
case IDC_HIDECHATS:
+ case IDC_AUTOCLEAN:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -165,6 +167,8 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
ppro->setByte("HideChats", ppro->m_bHideChats);
+
+ ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
}
break;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 384fee7270..eb7e1a5344 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -296,6 +296,13 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
if (pResponse == NULL)
return;
+ bool bCleanContacts = getByte("AutoClean", 0) != 0;
+ LIST<void> arContacts(10, PtrKeySortT);
+ if (bCleanContacts)
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ if (!isChatRoom(hContact))
+ arContacts.insert(hContact);
+
for (int i = 0; (pInfo = json_at(pResponse, i)) != NULL; i++) {
ptrT szValue(json_as_string(json_get(pInfo, "uid")));
if (szValue == NULL)
@@ -303,6 +310,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
CMString tszNick;
HANDLE hContact = FindUser(_ttoi(szValue), true);
+ arContacts.remove(hContact);
szValue = json_as_string(json_get(pInfo, "first_name"));
if (szValue) {
setTString(hContact, "FirstName", szValue);
@@ -338,6 +346,10 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
if (szValue && *szValue)
setTString(hContact, "Phone", szValue);
}
+
+ if (bCleanContacts)
+ for (int i = 0; i < arContacts.getCount(); i++)
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)arContacts[i], 0);
}
/////////////////////////////////////////////////////////////////////////////////////////