summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-03-16 10:52:18 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-03-16 10:52:18 +0000
commit927f7544d4639e95929da0827d73a830caf40667 (patch)
tree4114b60330f28ac1c0618a4d1131ed6b04c712a8 /protocols
parente157b8ecc9d3c75d7b7aef9f59ce69975d702d1d (diff)
VKontakte:
add ‘Mark notification as viewed on receive’ option version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@12414 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/res/resource.rc47
-rw-r--r--protocols/VKontakte/src/resource.h3
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp28
-rw-r--r--protocols/VKontakte/src/vk_options.cpp5
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp1
-rw-r--r--protocols/VKontakte/src/vk_proto.h4
7 files changed, 61 insertions, 29 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index a883513268..ad446b8f81 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -59,7 +59,7 @@ BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 297
TOPMARGIN, 7
- BOTTOMMARGIN, 222
+ BOTTOMMARGIN, 227
END
IDD_ACCMGRUI, DIALOG
@@ -149,12 +149,12 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10
END
-IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 230
+IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 235
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "News and event notifications",IDC_STATIC,4,8,293,90
+ GROUPBOX "News and event notifications",IDC_STATIC,4,8,293,98
CTEXT "WARNING: Causes excessive network traffic!!!",IDC_STATIC,12,18,278,8
CONTROL "Enable news feeds",IDC_NEWS_ENBL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,29,169,10
LTEXT "Interval for news updates (min):",IDC_STATIC,16,40,169,8
@@ -164,27 +164,29 @@ BEGIN
LTEXT "Interval for notification updates (min):",IDC_STATIC,16,62,169,8
EDITTEXT IDC_ED_INT_NOTIF,190,57,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN_INT_NOTIF,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,230,57,14,14
+ CONTROL "Mark notification as viewed on receive",IDC_NOTIF_MARK_VIEWED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,72,278,10
CONTROL "Special contact always enabled",IDC_SPEC_CONT_ENBL,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,73,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,83,278,10
CONTROL "Autoclear news and notification history",IDC_NEWSAUTOCLEAR,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,84,278,10
- GROUPBOX "News types",IDC_STATIC,4,98,293,35
- CONTROL "Wall posts",IDC_F_POSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,109,129,10
- CONTROL "Photos",IDC_F_PHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,120,129,10
- CONTROL "Photos tags",IDC_F_TAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,109,129,10
- CONTROL "Wall photos",IDC_F_WALLPHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,120,129,10
- GROUPBOX "News sources",IDC_STATIC,4,134,293,46
- CONTROL "Friends",IDC_S_FRIENDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,145,129,10
- CONTROL "Groups",IDC_S_GROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,156,129,10
- CONTROL "Include banned sources",IDC_S_BANNED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,167,129,10
- CONTROL "Pages",IDC_S_PAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,145,129,10
- CONTROL "Subscriptions to users",IDC_S_FOLLOWING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,156,129,10
- CONTROL "No reposts",IDC_S_NOREPOSTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,167,129,10
- GROUPBOX "Notifications types",IDC_STATIC,4,181,293,36
- CONTROL "Comments",IDC_N_COMMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,192,129,10
- CONTROL "Likes",IDC_N_LIKES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,203,129,10
- CONTROL "Reposts",IDC_N_REPOSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,192,129,10
- CONTROL "Mentions in comments",IDC_N_MENTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,203,129,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,94,278,10
+ GROUPBOX "News types",IDC_STATIC,4,106,293,35
+ CONTROL "Wall posts",IDC_F_POSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,117,129,10
+ CONTROL "Photos",IDC_F_PHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,128,129,10
+ CONTROL "Photos tags",IDC_F_TAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,117,129,10
+ CONTROL "Wall photos",IDC_F_WALLPHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,128,129,10
+ GROUPBOX "News sources",IDC_STATIC,4,142,293,46
+ CONTROL "Friends",IDC_S_FRIENDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,153,129,10
+ CONTROL "Groups",IDC_S_GROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,166,129,10
+ CONTROL "Include banned sources",IDC_S_BANNED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,175,129,10
+ CONTROL "Pages",IDC_S_PAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,153,129,10
+ CONTROL "Subscriptions to users",IDC_S_FOLLOWING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,164,129,10
+ CONTROL "No reposts",IDC_S_NOREPOSTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,175,129,10
+ GROUPBOX "Notifications types",IDC_STATIC,4,189,293,36
+ CONTROL "Comments",IDC_N_COMMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,200,129,10
+ CONTROL "Likes",IDC_N_LIKES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,211,129,10
+ CONTROL "Reposts",IDC_N_REPOSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,200,129,10
+ CONTROL "Mentions in comments",IDC_N_MENTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,211,129,10
END
IDD_ACCMGRUI DIALOGEX 0, 0, 186, 68
@@ -302,7 +304,6 @@ END
IDD_WALLPOST DIALOGEX 0, 0, 316, 144
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION ""
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Share",IDOK,205,123,50,14
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index da2e728ec0..8f71ff1966 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -103,6 +103,7 @@
#define IDC_ED_URL 1092
#define IDC_ONLY_FRIENDS 1093
#define IDC_ST_WARNING 1095
+#define IDC_NOTIF_MARK_VIEWED 1096
// Next default values for new objects
//
@@ -111,7 +112,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 122
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1096
+#define _APS_NEXT_CONTROL_VALUE 1097
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index d44c6569b9..3f543d71c8 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 50
+#define __BUILD_NUM 51
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index de43af6405..abe233451a 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -543,22 +543,38 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime)
<< VER_API);
}
-bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem)
+bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented)
{
+ isCommented = false;
if (vkNotificationItem->vkParentType == vkNull)
return false;
if (vkNotificationItem->tszType == _T("mention_comments")
|| vkNotificationItem->tszType == _T("mention_comment_photo")
- || vkNotificationItem->tszType == _T("mention_comment_video"))
+ || vkNotificationItem->tszType == _T("mention_comment_video")){
+ isCommented = true;
return m_bNotificationFilterMentions;
+ }
bool result = (vkNotificationItem->vkFeedbackType == vkUsers && m_bNotificationFilterLikes);
result = (vkNotificationItem->vkFeedbackType == vkCopy && m_bNotificationFilterReposts) || result;
result = (vkNotificationItem->vkFeedbackType == vkComment && m_bNotificationFilterComments) || result;
+
+ isCommented = (vkNotificationItem->vkFeedbackType == vkComment);
+
return result;
}
+void CVkProto::NotificationMarkAsViewed()
+{
+ debugLogA("CVkProto::NotificationMarkAsViewed");
+ if (!IsOnline())
+ return;
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/notifications.markAsViewed.json", true, &CVkProto::OnReceiveSmth)
+ << VER_API);
+}
+
void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnReceiveUnreadNotifications %d", reply->resultCode);
@@ -588,11 +604,17 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR
delete vkNotificationItem;
}
+ bool bNotificationCommentAdded = false;
+ bool bNotificationComment = false;
for (int i = 0; i < vkNotification.getCount(); i++)
- if (FilterNotification(&vkNotification[i]))
+ if (FilterNotification(&vkNotification[i], bNotificationComment)) {
AddFeedEvent(vkNotification[i].tszText, vkNotification[i].tDate);
+ bNotificationCommentAdded = bNotificationComment || bNotificationCommentAdded;
+ }
setDword("LastNotificationsTime", time(NULL));
+ if (m_bNotificationsMarkAsViewed && bNotificationCommentAdded)
+ NotificationMarkAsViewed();
vkNotification.destroy();
vkUsers.destroy();
}
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 7c82a41464..f2da107e70 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -364,6 +364,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
CheckDlgButton(hwndDlg, IDC_NEWS_ENBL, ppro->m_bNewsEnabled ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIF_ENBL, ppro->m_bNotificationsEnabled ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NOTIF_MARK_VIEWED, ppro->m_bNotificationsMarkAsViewed ? 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);
@@ -402,6 +403,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
case IDC_NEWS_ENBL:
case IDC_NOTIF_ENBL:
+ case IDC_NOTIF_MARK_VIEWED:
case IDC_SPEC_CONT_ENBL:
case IDC_NEWSAUTOCLEAR:
case IDC_F_POSTS:
@@ -435,6 +437,9 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
ppro->m_bNotificationsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_ENBL) == BST_CHECKED;
ppro->setByte("NotificationsEnabled", ppro->m_bNotificationsEnabled);
+ ppro->m_bNotificationsMarkAsViewed = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_MARK_VIEWED) == BST_CHECKED;
+ ppro->setByte("NotificationsMarkAsViewed", ppro->m_bNotificationsMarkAsViewed);
+
ppro->m_bSpecialContactAlwaysEnabled = IsDlgButtonChecked(hwndDlg, IDC_SPEC_CONT_ENBL) == BST_CHECKED;
ppro->setByte("SpecialContactAlwaysEnabled", ppro->m_bSpecialContactAlwaysEnabled);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 00d793c473..16a3fc1c64 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -81,6 +81,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_bNewsEnabled = getBool("NewsEnabled", false);
m_iMaxLoadNewsPhoto = getByte("MaxLoadNewsPhoto", 5);
m_bNotificationsEnabled = getBool("NotificationsEnabled", false);
+ m_bNotificationsMarkAsViewed = getBool("NotificationsMarkAsViewed", true);
m_bSpecialContactAlwaysEnabled = getBool("SpecialContactAlwaysEnabled", false);
m_iNewsInterval = getDword("NewsInterval", 15);
m_iNotificationsInterval = getDword("NotificationsInterval", 1);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 3296e5d0a6..63647070a7 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -378,7 +378,8 @@ struct CVkProto : public PROTO<CVkProto>
void OnReceiveUnreadNews(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveUnreadNotifications(time_t tLastNotificationsTime);
- bool FilterNotification(CVKNewsItem* vkNotificationItem);
+ bool FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented);
+ void NotificationMarkAsViewed();
void OnReceiveUnreadNotifications(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveUnreadEvents();
void NewsClearHistory();
@@ -578,6 +579,7 @@ private:
m_bUserForceOnlineOnActivity,
m_bNewsEnabled,
m_bNotificationsEnabled,
+ m_bNotificationsMarkAsViewed,
m_bSpecialContactAlwaysEnabled,
m_bNewsAutoClearHistory,
m_bNewsFilterPosts,