summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/resource.h13
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp42
-rw-r--r--protocols/VKontakte/src/vk_options.cpp52
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp13
-rw-r--r--protocols/VKontakte/src/vk_proto.h14
5 files changed, 127 insertions, 7 deletions
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index d469f7b127..252877ef6d 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -75,6 +75,17 @@
#define IDC_NEWSBBC_BASIC 1067
#define IDC_NEWSBBC_ADV 1068
#define IDC_IEVIEW 1069
+#define IDC_F_POSTS 1070
+#define IDC_F_PHOTOS 1071
+#define IDC_F_TAGS 1072
+#define IDC_F_WALLPHOTOS 1073
+#define IDC_S_FRIENDS 1074
+#define IDC_S_GROUPS 1075
+#define IDC_S_PAGES 1076
+#define IDC_S_FOLLOWING 1077
+#define IDC_S_BANNED 1078
+#define IDC_S_NOREPOSTES 1079
+
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
@@ -82,7 +93,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1070
+#define _APS_NEXT_CONTROL_VALUE 1071
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
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));
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index c5728a7e20..4cff0b64a6 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -349,7 +349,19 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
CheckDlgButton(hwndDlg, IDC_NOTIF_ENBL, ppro->m_bNotificationsEnabled ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SPEC_CONT_ENBL, ppro->m_bSpecialContactAlwaysEnabled ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NEWSAUTOCLEAR, ppro->m_bNewsAutoClearHistory ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_F_POSTS, ppro->m_bNewsFilterPosts ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_F_PHOTOS, ppro->m_bNewsFilterPhotos ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_F_TAGS, ppro->m_bNewsFilterTags ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_F_WALLPHOTOS, ppro->m_bNewsFilterWallPhotos ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_FRIENDS, ppro->m_bNewsSourceFriends ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_GROUPS, ppro->m_bNewsSourceGroups ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_PAGES, ppro->m_bNewsSourcePages ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_FOLLOWING, ppro->m_bNewsSourceFollowing ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_BANNED, ppro->m_bNewsSourceIncludeBanned ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_S_NOREPOSTES, ppro->m_bNewsSourceNoReposts ? BST_CHECKED : BST_UNCHECKED);
+
SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETRANGE, 0, MAKELONG(60*24, 1));
SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETPOS, 0, ppro->m_iNewsInterval);
@@ -370,6 +382,16 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
case IDC_NOTIF_ENBL:
case IDC_SPEC_CONT_ENBL:
case IDC_NEWSAUTOCLEAR:
+ case IDC_F_POSTS:
+ case IDC_F_PHOTOS:
+ case IDC_F_TAGS:
+ case IDC_F_WALLPHOTOS:
+ case IDC_S_FRIENDS:
+ case IDC_S_GROUPS:
+ case IDC_S_PAGES:
+ case IDC_S_FOLLOWING:
+ case IDC_S_BANNED:
+ case IDC_S_NOREPOSTES:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -393,6 +415,36 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
ppro->m_bNewsAutoClearHistory = IsDlgButtonChecked(hwndDlg, IDC_NEWSAUTOCLEAR) == BST_CHECKED;
ppro->setByte("NewsAutoClearHistory", ppro->m_bNewsAutoClearHistory);
+ ppro->m_bNewsFilterPosts = IsDlgButtonChecked(hwndDlg, IDC_F_POSTS) == BST_CHECKED;
+ ppro->setByte("NewsFilterPosts", ppro->m_bNewsFilterPosts);
+
+ ppro->m_bNewsFilterPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_PHOTOS) == BST_CHECKED;
+ ppro->setByte("NewsFilterPhotos", ppro->m_bNewsFilterPhotos);
+
+ ppro->m_bNewsFilterTags = IsDlgButtonChecked(hwndDlg, IDC_F_TAGS) == BST_CHECKED;
+ ppro->setByte("NewsFilterTags", ppro->m_bNewsFilterTags);
+
+ ppro->m_bNewsFilterWallPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_WALLPHOTOS) == BST_CHECKED;
+ ppro->setByte("NewsFilterWallPhotos", ppro->m_bNewsFilterWallPhotos);
+
+ ppro->m_bNewsSourceFriends = IsDlgButtonChecked(hwndDlg, IDC_S_FRIENDS) == BST_CHECKED;
+ ppro->setByte("NewsSourceFriends", ppro->m_bNewsSourceFriends);
+
+ ppro->m_bNewsSourceGroups = IsDlgButtonChecked(hwndDlg, IDC_S_GROUPS) == BST_CHECKED;
+ ppro->setByte("NewsSourceGroups", ppro->m_bNewsSourceGroups);
+
+ ppro->m_bNewsSourcePages = IsDlgButtonChecked(hwndDlg, IDC_S_PAGES) == BST_CHECKED;
+ ppro->setByte("NewsSourcePages", ppro->m_bNewsSourcePages);
+
+ ppro->m_bNewsSourceFollowing = IsDlgButtonChecked(hwndDlg, IDC_S_FOLLOWING) == BST_CHECKED;
+ ppro->setByte("NewsSourceFollowing", ppro->m_bNewsSourceFollowing);
+
+ ppro->m_bNewsSourceIncludeBanned = IsDlgButtonChecked(hwndDlg, IDC_S_BANNED) == BST_CHECKED;
+ ppro->setByte("NewsSourceIncludeBanned", ppro->m_bNewsSourceIncludeBanned);
+
+ ppro->m_bNewsSourceNoReposts = IsDlgButtonChecked(hwndDlg, IDC_S_NOREPOSTES) == BST_CHECKED;
+ ppro->setByte("NewsSourceNoReposts", ppro->m_bNewsSourceNoReposts);
+
TCHAR buffer[5] = { 0 };
GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, SIZEOF(buffer));
ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 9ca06e231a..61c11dde35 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -84,9 +84,20 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_iNotificationsInterval = getDword("NotificationsInterval", 1);
m_iIMGBBCSupport = getByte("IMGBBCSupport", 0);
m_iBBCForNews = getByte("BBCForNews", 0);
- m_bNewsAutoClearHistory = getBool("NewsAutoClearHistory", 0);
+ m_bNewsAutoClearHistory = getBool("NewsAutoClearHistory", false);
m_iNewsAutoClearHistoryInterval = getDword("NewsAutoClearHistoryInterval", 60*60*24*3);
+ m_bNewsFilterPosts = getBool("NewsFilterPosts", true);
+ m_bNewsFilterPhotos = getBool("NewsFilterPhotos", true);
+ m_bNewsFilterTags = getBool("NewsFilterTags", true);
+ m_bNewsFilterWallPhotos = getBool("NewsFilterWallPhotos", true);
+ m_bNewsSourceFriends = getBool("NewsSourceFriends", true);
+ m_bNewsSourceGroups = getBool("NewsSourceGroups", true);
+ m_bNewsSourcePages = getBool("NewsSourcePages", true);
+ m_bNewsSourceFollowing = getBool("NewsSourceFollowing", true);
+ m_bNewsSourceIncludeBanned = getBool("NewsSourceIncludeBanned", false);
+ m_bNewsSourceNoReposts = getBool("NewsSourceNoReposts", false);
+
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
vk_Instances.insert(this);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 4c41ce0709..7355130c1c 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -193,7 +193,7 @@ struct CVKNewsItem : public MZeroedObject {
{
tDate = NULL;
vkUser = NULL;
- bIsGroup = bIsRepost = true;
+ bIsGroup = bIsRepost = false;
};
CMString tszId;
@@ -552,7 +552,17 @@ private:
m_bNewsEnabled,
m_bNotificationsEnabled,
m_bSpecialContactAlwaysEnabled,
- m_bNewsAutoClearHistory;
+ m_bNewsAutoClearHistory,
+ m_bNewsFilterPosts,
+ m_bNewsFilterPhotos,
+ m_bNewsFilterTags,
+ m_bNewsFilterWallPhotos,
+ m_bNewsSourceFriends,
+ m_bNewsSourceGroups,
+ m_bNewsSourcePages,
+ m_bNewsSourceFollowing,
+ m_bNewsSourceIncludeBanned,
+ m_bNewsSourceNoReposts;
int m_iNewsInterval, m_iNotificationsInterval, m_iNewsAutoClearHistoryInterval;