diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-26 07:48:02 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-26 07:48:02 +0000 |
commit | 53e54f19ecbcd12202473505dd12cea27b453f2c (patch) | |
tree | adce7986ea2f73d3b84c8a30939c5c71f8148431 /protocols/VKontakte/src/vk_feed.cpp | |
parent | efee96cfd3e6318ed376363ab9781bd944940107 (diff) |
VKontakte: add filtering by type and source content for news
git-svn-id: http://svn.miranda-ng.org/main/trunk@11642 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_feed.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 9f13a44dea..d392063d06 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -385,13 +385,48 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) debugLogA("CVkProto::RetrieveUnreadNews");
if (!IsOnline())
return;
+
+ CMStringA szFilter;
+ szFilter = m_bNewsFilterPosts ? "post" : "";
+
+ szFilter += szFilter.IsEmpty() ? "" : ",";
+ szFilter += m_bNewsFilterPhotos ? "photo" : "";
+
+ szFilter += szFilter.IsEmpty() ? "" : ",";
+ szFilter += m_bNewsFilterTags ? "photo_tag" : "";
+
+ szFilter += szFilter.IsEmpty() ? "" : ",";
+ szFilter += m_bNewsFilterWallPhotos ? "wall_photo" : "";
+
+ if (szFilter.IsEmpty()){
+ debugLogA("CVkProto::RetrieveUnreadNews szFilter empty");
+ return;
+ }
+ CMStringA szSource;
+ szSource = m_bNewsSourceFriends ? "friends" : "";
+
+ szSource += szSource.IsEmpty() ? "" : ",";
+ szSource += m_bNewsSourceGroups ? "groups" : "";
+
+ szSource += szSource.IsEmpty() ? "" : ",";
+ szSource += m_bNewsSourcePages ? "pages" : "";
+
+ szSource += szSource.IsEmpty() ? "" : ",";
+ szSource += m_bNewsSourceFollowing ? "following" : "";
+
+ if (szSource.IsEmpty()){
+ debugLogA("CVkProto::RetrieveUnreadNews szSource empty");
+ return;
+ }
+
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/newsfeed.get.json", true, &CVkProto::OnReceiveUnreadNews)
<< INT_PARAM("count", 100)
- << INT_PARAM("return_banned", 0)
+ << INT_PARAM("return_banned", m_bNewsSourceIncludeBanned ? 1 : 0)
<< INT_PARAM("max_photos", 5)
<< INT_PARAM("start_time", tLastNewsTime + 1)
- << CHAR_PARAM("filters", "post,photo,photo_tag,wall_photo")
+ << CHAR_PARAM("filters", szFilter.GetBuffer())
+ << CHAR_PARAM("source_ids", szSource.GetBuffer())
<< VER_API);
}
@@ -428,7 +463,8 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p }
for (int i = 0; i < vkNews.getCount(); i++)
- AddFeedEvent(vkNews[i].tszText, vkNews[i].tDate);
+ if (!(m_bNewsSourceNoReposts && vkNews[i].bIsRepost))
+ AddFeedEvent(vkNews[i].tszText, vkNews[i].tDate);
setDword("LastNewsTime", time(NULL));
|