diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-04-16 03:02:56 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-04-16 03:02:56 +0000 |
commit | beba9d5e9ab1240bc17f0c7fa0d50f1be7633594 (patch) | |
tree | 25ca7cf1c6a6cbc543936abe538063202920506c /protocols/VKontakte | |
parent | f76455fc258fb45cb17b571ac2d34f8f3d5ef8d3 (diff) |
VKontakte:
add invite support
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@12852 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/res/resource.rc | 67 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/resource.h | 3 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 123 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 3 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 13 |
9 files changed, 166 insertions, 60 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 4df07eb816..a9a0f8acb8 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -58,8 +58,8 @@ BEGIN BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 297
- TOPMARGIN, 7
- BOTTOMMARGIN, 227
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 231
END
IDD_ACCMGRUI, DIALOG
@@ -149,44 +149,45 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10
END
-IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 235
+IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 232
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,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
- EDITTEXT IDC_ED_INT_NEWS,190,35,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_SPIN_INT_NEWS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,230,35,14,14
- CONTROL "Enable event notifications",IDC_NOTIF_ENBL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,51,169,10
- 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
+ GROUPBOX "News and event notifications",IDC_STATIC,4,4,293,97
+ CTEXT "WARNING: Causes excessive network traffic!!!",IDC_STATIC,12,14,278,8
+ CONTROL "Enable news feeds",IDC_NEWS_ENBL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,24,169,10
+ LTEXT "Interval for news updates (min):",IDC_STATIC,16,35,169,8
+ EDITTEXT IDC_ED_INT_NEWS,190,30,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_INT_NEWS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,230,30,14,14
+ CONTROL "Enable event notifications",IDC_NOTIF_ENBL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,46,169,10
+ LTEXT "Interval for notification updates (min):",IDC_STATIC,16,57,169,8
+ EDITTEXT IDC_ED_INT_NOTIF,190,52,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_INT_NOTIF,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,230,52,14,14
CONTROL "Mark notification as viewed on receive",IDC_NOTIF_MARK_VIEWED,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,72,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,278,10
CONTROL "Special contact always enabled",IDC_SPEC_CONT_ENBL,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,83,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,278,10
CONTROL "Autoclear news and notification history",IDC_NEWSAUTOCLEAR,
- "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,164,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
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,89,278,10
+ GROUPBOX "News types",IDC_STATIC,4,101,293,35
+ CONTROL "Wall posts",IDC_F_POSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,112,129,10
+ CONTROL "Photos",IDC_F_PHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,123,129,10
+ CONTROL "Photos tags",IDC_F_TAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,112,129,10
+ CONTROL "Wall photos",IDC_F_WALLPHOTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,123,129,10
+ GROUPBOX "News sources",IDC_STATIC,4,137,293,46
+ CONTROL "Friends",IDC_S_FRIENDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,129,10
+ CONTROL "Groups",IDC_S_GROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,159,129,10
+ CONTROL "Include banned sources",IDC_S_BANNED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,170,129,10
+ CONTROL "Pages",IDC_S_PAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,148,129,10
+ CONTROL "Subscriptions to users",IDC_S_FOLLOWING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,159,129,10
+ CONTROL "No reposts",IDC_S_NOREPOSTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,170,129,10
+ GROUPBOX "Notifications types",IDC_STATIC,4,184,293,45
+ CONTROL "Comments",IDC_N_COMMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,195,129,10
+ CONTROL "Likes",IDC_N_LIKES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,206,129,10
+ CONTROL "Invites",IDC_N_INVITES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,217,129,10
+ CONTROL "Reposts",IDC_N_REPOSTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,195,129,10
+ CONTROL "Mentions in comments",IDC_N_MENTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,206,129,10
END
IDD_ACCMGRUI DIALOGEX 0, 0, 186, 68
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 8d3a6c1295..1bc717248c 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -799,6 +799,10 @@ CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedba {
CVKNotification vkNotification[] = {
// type, parent, feedback, string for translate
+ { _T("group"), vkInvite, vkNull, _T("has invited you to a group") },
+ { _T("page"), vkInvite, vkNull, _T("has invited you to subscribe to a page") },
+ { _T("event"), vkInvite, vkNull, _T("invites you to event") },
+
{ _T("follow"), vkNull, vkUsers, _T("") },
{ _T("friend_accepted"), vkNull, vkUsers, _T("") },
{ _T("mention"), vkNull, vkPost, _T("") },
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 8f71ff1966..a9029746e6 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -104,6 +104,7 @@ #define IDC_ONLY_FRIENDS 1093
#define IDC_ST_WARNING 1095
#define IDC_NOTIF_MARK_VIEWED 1096
+#define IDC_N_INVITES 1097
// Next default values for new objects
//
@@ -112,7 +113,7 @@ #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 122
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1097
+#define _APS_NEXT_CONTROL_VALUE 1098
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index b153785e9c..ad23326b0b 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 52
+#define __BUILD_NUM 53
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index abe233451a..fd2de60bf3 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -110,7 +110,10 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, JSONNODE *pRe tszNick.AppendChar(' ');
tszNick += json_as_CMString(json_get(pProfile, "last_name"));
CMString tszLink = _T("https://vk.com/");
- tszLink += json_as_CMString(json_get(pProfile, "screen_name"));
+ CMString tszScreenName = json_as_CMString(json_get(pProfile, "screen_name"));
+ if (tszScreenName.IsEmpty())
+ tszScreenName.AppendFormat(_T("id%d"), UserId);
+ tszLink += tszScreenName;
CVkUserInfo * vkUser = new CVkUserInfo(UserId, false, tszNick, tszLink, FindUser(UserId));
vkUsers.insert(vkUser);
}
@@ -433,6 +436,51 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(JSONNODE *pItem, OBJLIST<CVkUserIn return NULL;
}
+CVKNewsItem* CVkProto::GetVkGroupInvates(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers)
+{
+ debugLogA("CVkProto::GetVkGroupInvates");
+ if (pItem == NULL)
+ return NULL;
+
+ CMString tszType = json_as_CMString(json_get(pItem, "type"));
+ VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
+ CMString tszNotificationTranslate = SpanVKNotificationType(tszType, vkFeedbackType, vkParentType);
+ LONG iGroupId = json_as_int(json_get(pItem, "id"));
+
+ if (iGroupId == 0)
+ return NULL;
+
+ CMString tszId;
+ tszId.AppendFormat(_T("%d,"), iGroupId);
+ CMString tszIds = ptrT(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds"));
+
+ if (tszIds.Find(tszId, 0) != -1)
+ return NULL;
+
+ LONG iUserId = json_as_int(json_get(pItem, "invited_by"));
+ CVKNewsItem *vkNotification = new CVKNewsItem();
+ vkNotification->tDate = time(NULL);
+ vkNotification->vkUser = GetVkUserInfo(iUserId, vkUsers);
+ vkNotification->tszType = tszType;
+ vkNotification->tszId = tszId;
+ vkNotification->vkFeedbackType = vkFeedbackType;
+ vkNotification->vkParentType = vkParentType;
+
+ CMString tszGroupName, tszGName, tszGLink;
+ tszGName = json_as_CMString(json_get(pItem, "name"));
+ tszGLink.AppendFormat(_T("https://vk.com/%s"), json_as_CMString(json_get(pItem, "screen_name")).GetBuffer());
+ tszGroupName = SetBBCString(tszGName.GetBuffer(), m_iBBCForNews, vkbbcUrl, tszGLink.GetBuffer());
+
+ CMString tszUsers = SetBBCString(vkNotification->vkUser->m_tszUserNick.GetBuffer(), m_iBBCForNews, vkbbcUrl, vkNotification->vkUser->m_tszLink.GetBuffer());
+
+ vkNotification->tszText.AppendFormat(_T("%s %s %s"), tszUsers.GetBuffer(), tszNotificationTranslate.GetBuffer(), tszGroupName.GetBuffer());
+
+ tszIds += tszId;
+ setTString("InviteGroupIds", tszIds);
+
+ return vkNotification;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime)
@@ -536,11 +584,15 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) debugLogA("CVkProto::RetrieveUnreadNotifications");
if (!IsOnline())
return;
-
- Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/notifications.get.json", true, &CVkProto::OnReceiveUnreadNotifications)
- << INT_PARAM("count", 100)
- << INT_PARAM("start_time", tLastNotificationsTime + 1)
- << VER_API);
+
+ CMString code;
+ code.AppendFormat(_T("return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s"),
+ (LONG)(tLastNotificationsTime + 1),
+ m_bNotificationFilterInvites ? _T(",\"groupinvates\":API.groups.getInvites({\"extended\":1})};") : _T("};"));
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveUnreadNotifications)
+ << TCHAR_PARAM("code", code.GetBuffer())
+ << VER_API);
}
bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented)
@@ -559,6 +611,7 @@ bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isComme bool result = (vkNotificationItem->vkFeedbackType == vkUsers && m_bNotificationFilterLikes);
result = (vkNotificationItem->vkFeedbackType == vkCopy && m_bNotificationFilterReposts) || result;
result = (vkNotificationItem->vkFeedbackType == vkComment && m_bNotificationFilterComments) || result;
+ result = (vkNotificationItem->vkParentType == vkInvite && m_bNotificationFilterInvites) || result;
isCommented = (vkNotificationItem->vkFeedbackType == vkComment);
@@ -586,35 +639,61 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR if (pResponse == NULL)
return;
+ JSONNODE *pNotifications = json_get(pResponse, "notifications");
+ JSONNODE *pGroupInvates = json_get(pResponse, "groupinvates");
+
OBJLIST<CVkUserInfo> vkUsers(5, NumericKeySortT);
- CreateVkUserInfoList(vkUsers, pResponse);
+ OBJLIST<CVKNewsItem> vkNotification(5, sttCompareVKNewsItems);
+
+ CreateVkUserInfoList(vkUsers, pNotifications);
+ CreateVkUserInfoList(vkUsers, pGroupInvates);
- JSONNODE *pItems = json_get(pResponse, "items");
- JSONNODE *pItem;
+ JSONNODE *pItems, *pItem;
- OBJLIST<CVKNewsItem> vkNotification(5, sttCompareVKNewsItems);
- if (pItems != NULL)
- for (int i = 0; (pItem = json_at(pItems, i)) != NULL; i++) {
- CVKNewsItem *vkNotificationItem = GetVkNotificationsItem(pItem, vkUsers);
- if (!vkNotificationItem)
- continue;
- if (vkNotification.find(vkNotificationItem) == NULL)
- vkNotification.insert(vkNotificationItem);
- else
- delete vkNotificationItem;
- }
+ if (pNotifications != NULL) {
+
+ pItems = json_get(pNotifications, "items");
+
+ if (pItems != NULL)
+ for (int i = 0; (pItem = json_at(pItems, i)) != NULL; i++) {
+ CVKNewsItem *vkNotificationItem = GetVkNotificationsItem(pItem, vkUsers);
+ if (!vkNotificationItem)
+ continue;
+ if (vkNotification.find(vkNotificationItem) == NULL)
+ vkNotification.insert(vkNotificationItem);
+ else
+ delete vkNotificationItem;
+ }
+
+ }
+
+ if (pGroupInvates != NULL) {
+ pItems = json_get(pGroupInvates, "items");
+
+ if (pItems != NULL)
+ for (int i = 0; (pItem = json_at(pItems, i)) != NULL; i++) {
+ CVKNewsItem *vkNotificationItem = GetVkGroupInvates(pItem, vkUsers);
+ if (!vkNotificationItem)
+ continue;
+ if (vkNotification.find(vkNotificationItem) == NULL)
+ vkNotification.insert(vkNotificationItem);
+ else
+ delete vkNotificationItem;
+ }
+ }
bool bNotificationCommentAdded = false;
bool bNotificationComment = false;
for (int i = 0; i < vkNotification.getCount(); i++)
- if (FilterNotification(&vkNotification[i], bNotificationComment)) {
+ 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 e87594c40f..37ce884a2d 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -384,6 +384,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_N_LIKES, ppro->m_bNotificationFilterLikes ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_N_REPOSTS, ppro->m_bNotificationFilterReposts ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_N_MENTIONS, ppro->m_bNotificationFilterMentions ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_N_INVITES, ppro->m_bNotificationFilterInvites ? 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);
@@ -420,6 +421,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar case IDC_N_LIKES:
case IDC_N_REPOSTS:
case IDC_N_MENTIONS:
+ case IDC_N_INVITES:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -485,9 +487,12 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar ppro->m_bNotificationFilterReposts = IsDlgButtonChecked(hwndDlg, IDC_N_REPOSTS) == BST_CHECKED;
ppro->setByte("NotificationFilterReposts", ppro->m_bNotificationFilterReposts);
- ppro->m_bNotificationFilterMentions = IsDlgButtonChecked(hwndDlg, IDC_N_REPOSTS) == BST_CHECKED;
+ ppro->m_bNotificationFilterMentions = IsDlgButtonChecked(hwndDlg, IDC_N_MENTIONS) == BST_CHECKED;
ppro->setByte("NotificationFilterMentions", ppro->m_bNotificationFilterMentions);
+ ppro->m_bNotificationFilterInvites = IsDlgButtonChecked(hwndDlg, IDC_N_INVITES) == BST_CHECKED;
+ ppro->setByte("NotificationFilterInvites", ppro->m_bNotificationFilterInvites);
+
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 b2465541dd..33cb2da12e 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -114,12 +114,15 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNotificationFilterLikes = getBool("NotificationFilterLikes", true);
m_bNotificationFilterReposts = getBool("NotificationFilterReposts", true);
m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true);
+ m_bNotificationFilterInvites = getBool("NotificationFilterInvites", true);
m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true);
m_iInvisibleInterval = getDword("InvisibleInterval", 10);
m_bSetBroadcast = false;
m_bNeedSendOnline = false;
+ delSetting("InviteGroupIds");
+
// 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 cb85df89a7..a00a08466e 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -197,7 +197,7 @@ struct CVkUserInfo : public MZeroedObject { bool m_bIsGroup;
};
-enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy };
+enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy, vkInvite };
struct CVKNotification {
TCHAR *ptszType;
@@ -356,6 +356,7 @@ struct CVkProto : public PROTO<CVkProto> CVKNewsItem* GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost = false);
+ CVKNewsItem* GetVkGroupInvates(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers);
CVKNewsItem* GetVkNotificationsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers);
CMString GetVkFeedback(JSONNODE *pFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser);
CVKNewsItem* GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TCHAR *ptszReplyText = NULL, TCHAR *ptszReplyLink = NULL);
@@ -582,6 +583,7 @@ private: m_bNotificationFilterLikes,
m_bNotificationFilterReposts,
m_bNotificationFilterMentions,
+ m_bNotificationFilterInvites,
m_bUseBBCOnAttacmentsAsNews,
m_bUseNonStandardUrlEncode,
m_bSetBroadcast;
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 64b9bc7c47..aed8f64e50 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -95,6 +95,17 @@ void CVkProto::WorkerThread(void*) debugLogA("CVkProto::WorkerThread: entering");
m_bTerminated = m_prevError = false;
m_szAccessToken = getStringA("AccessToken");
+
+ char Score[] = "friends,photos,audio,docs,video,wall,messages,offline,status,notifications,groups";
+
+ CMStringA szAccessScore = ptrA(getStringA("AccessScore"));
+ if (szAccessScore != Score) {
+ setString("AccessScore", Score);
+ delSetting("AccessToken");
+ m_szAccessToken = NULL;
+ }
+
+
if (m_szAccessToken != NULL)
// try to receive a response from server
RetrieveMyInfo();
@@ -103,7 +114,7 @@ void CVkProto::WorkerThread(void*) extern char szBlankUrl[];
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "https://oauth.vk.com/authorize", false, &CVkProto::OnOAuthAuthorize)
<< INT_PARAM("client_id", VK_APP_ID)
- << CHAR_PARAM("scope", "friends,photos,audio,docs,video,wall,messages,offline,status,notifications")
+ << CHAR_PARAM("scope", Score)
<< CHAR_PARAM("redirect_uri", szBlankUrl)
<< CHAR_PARAM("display", "mobile")
<< CHAR_PARAM("response_type", "token")
|