summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_feed.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-06-24 08:49:49 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-06-24 08:49:49 +0000
commitfe4cec89d652ba57f7a47d98fb320f710b33ae98 (patch)
treeec60d2e26ad90cd8de31a029d6bb9aeb9fa20b89 /protocols/VKontakte/src/vk_feed.cpp
parent3d01a16121bbdaf4b324f375e28d6e6b0feb4fed (diff)
VKontakte:
added friend_accepted notification type version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@17026 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_feed.cpp')
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index 4aac6e56ac..c889c12705 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -466,6 +466,11 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV
const JSONNode &jnFeedback = jnItem["feedback"];
const JSONNode &jnParent = jnItem["parent"];
+ if (m_vkOptions.bNotificationFilterAcceptedFriends && tszType == _T("friend_accepted") && jnFeedback && vkFeedbackType == VKObjType::vkUsers) {
+ OnFriendAccepted(jnFeedback);
+ return NULL;
+ }
+
if (!jnFeedback || !jnParent)
return NULL;
@@ -503,6 +508,24 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV
return NULL;
}
+void CVkProto::OnFriendAccepted(const JSONNode & jnFeedback)
+{
+ const JSONNode &jnUsers = jnFeedback["items"];
+
+ for (auto it = jnUsers.begin(); it != jnUsers.end(); ++it) {
+ const JSONNode &jnUserItem = (*it);
+ if (!jnUserItem["from_id"])
+ continue;
+
+ LONG iUserId = jnUserItem["from_id"].as_int();
+ MCONTACT hContact = FindUser(iUserId, true);
+
+ RetrieveUserInfo(iUserId);
+ CVkDBAddAuthRequestThreadParam *param = new CVkDBAddAuthRequestThreadParam(hContact, true);
+ ForkThread(&CVkProto::DBAddAuthRequestThread, (void *)param);
+ }
+}
+
CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers)
{
debugLogA("CVkProto::GetVkGroupInvates");