summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-12-16 05:12:06 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-12-16 05:12:06 +0000
commitf5718dda9247abb9e735fbf60e975d6d0662363a (patch)
tree8f4f278a74c66baece5b3fe0f03946468fcdb4b5 /protocols/VKontakte
parentcba46ca020f4bd0336b5a8e32b603190c553599f (diff)
VKontakte:
vk feeds support (wall) – part 2 version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11443 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/res/resource.rc43
-rw-r--r--protocols/VKontakte/src/resource.h8
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp7
-rw-r--r--protocols/VKontakte/src/vk_options.cpp79
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp5
-rw-r--r--protocols/VKontakte/src/vk_proto.h2
7 files changed, 126 insertions, 20 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index 3375a0542a..290e159da7 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -12,11 +12,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Русский (Россия) resources
+// Английский (США) resources
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-#pragma code_page(1251)
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
@@ -35,16 +35,6 @@ IDI_VISITPROFILE ICON "home.ico"
IDI_HISTORY ICON "history.ico"
IDI_KEYS ICON "key.ico"
IDI_BROADCAST ICON "broadcast.ico"
-#endif // Русский (Россия) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Английский (США) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
@@ -54,6 +44,15 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
+ IDD_OPT_FEEDS, DIALOG
+ BEGIN
+ LEFTMARGIN, 4
+ RIGHTMARGIN, 297
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 97
+ HORZGUIDE, 77
+ END
+
IDD_ACCMGRUI, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -106,6 +105,22 @@ END
// Dialog
//
+IDD_OPT_FEEDS DIALOGEX 0, 0, 309, 106
+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,83
+ CTEXT "WARNING: Causes excessive network traffic!!!",IDC_STATIC,12,19,278,8
+ CONTROL "Enable news feeds",IDC_NEWS_ENBL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,278,10
+ CONTROL "Enable event notifications",IDC_NOTIF_ENBL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,12,41,278,10
+ CONTROL "BBCode support on news and event notifications",IDC_BBC_NEWS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,52,278,10
+ LTEXT "Interval for updates (min):",IDC_STATIC,16,67,97,8
+ EDITTEXT IDC_ED_INT,118,63,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_INT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,158,63,14,14
+END
+
IDD_ACCMGRUI DIALOGEX 0, 0, 186, 68
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index f4532a417e..9ce31f0f30 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -8,6 +8,7 @@
#define IDD_INVITE 104
#define IDD_GC_CREATE 105
#define IDD_OPT_ADV 106
+#define IDD_OPT_FEEDS 107
#define IDI_NOTIFICATION 109
#define IDI_FRIENDADD 110
#define IDI_BAN 111
@@ -58,6 +59,11 @@
#define IDC_SYNC_AUTO 1051
#define IDC_SYNC_LAST1DAY 1052
#define IDC_SYNC_LAST3DAY 1053
+#define IDC_NEWS_ENBL 1054
+#define IDC_NOTIF_ENBL 1055
+#define IDC_BBC_NEWS 1056
+#define IDC_ED_INT 1057
+#define IDC_SPIN_INT 1058
// Next default values for new objects
//
@@ -66,7 +72,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1054
+#define _APS_NEXT_CONTROL_VALUE 1059
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index d2776a5e3a..e765d64d4f 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 30
+#define __BUILD_NUM 31
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index d2d22e21bd..791c423d6b 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -22,8 +22,9 @@ static char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_
void CVkProto::AddFeedSpecialUser()
{
- MCONTACT hContact = FindUser(VK_FEED_USER, m_bNewsEnabled);
- if (!m_bNewsEnabled) {
+ bool bSpecialContact = m_bNewsEnabled || m_bNotificationsEnabled;
+ MCONTACT hContact = FindUser(VK_FEED_USER, bSpecialContact);
+ if (!bSpecialContact) {
if (hContact)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
return;
@@ -64,7 +65,7 @@ void CVkProto::AddFeedEvent(CMString& tszBody, time_t tTime)
void CVkProto::RetrieveUnreadNews()
{
debugLogA("CVkProto::RetrieveUnreadNews");
- if (!IsOnline() || !m_bNewsEnabled)
+ if (!IsOnline() || !(m_bNewsEnabled || m_bNotificationsEnabled))
return;
time_t tLastNewsTime = getDword("LastNewsTime", time(NULL) - 24 * 60 * 60);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 380e3a5d3e..19037329f3 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -338,6 +338,79 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
return FALSE;
}
+INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ ppro = (CVkProto*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, 1));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
+
+ 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_BBC_NEWS, ppro->m_bBBCOnNews ? BST_CHECKED : BST_UNCHECKED);
+
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_INT, UDM_SETRANGE, 0, MAKELONG(60*24, 1));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_INT, UDM_SETPOS, 0, ppro->m_iNewsInterval);
+
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ED_INT:
+ if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_NEWS_ENBL:
+ case IDC_NOTIF_ENBL:
+ case IDC_BBC_NEWS:
+ if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == UDN_DELTAPOS)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ ppro->m_bNewsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NEWS_ENBL) == BST_CHECKED;
+ ppro->setByte("NewsEnabled", ppro->m_bNewsEnabled);
+
+ ppro->m_bNotificationsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NOT_ENBL) == BST_CHECKED;
+ ppro->setByte("NotificationsEnabled", ppro->m_bNotificationsEnabled);
+
+ ppro->m_bBBCOnNews = IsDlgButtonChecked(hwndDlg, IDC_BBC_NEWS) == BST_CHECKED;
+ ppro->setByte("BBCOnNews", ppro->m_bBBCOnNews);
+
+ TCHAR buffer[5] = { 0 };
+ GetDlgItemText(hwndDlg, IDC_ED_INT, buffer, SIZEOF(buffer));
+ ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
+
+ }
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case WM_DESTROY:
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
+ break;
+ }
+
+ return FALSE;
+}
+
int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
@@ -358,5 +431,11 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM)
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADV);
odp.pfnDlgProc = &CVkProto::OptionsAdvProc;
Options_AddPage(wParam, &odp);
+
+ odp.ptszTab = LPGENT("News and notifications");
+ odp.position = 3;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FEEDS);
+ odp.pfnDlgProc = &CVkProto::OptionsFeedsProc;
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 6238e399a5..5786d5aa0e 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -79,6 +79,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
szListeningTo += "Enabled";
db_set_b(NULL, "ListeningTo", szListeningTo.GetBuffer(), m_iMusicSendMetod == 0 ? 0 : 1);
m_bNewsEnabled = getBool("NewsEnabled", false);
+ m_bNotificationsEnabled = getBool("NotificationsEnabled", false);
m_bBBCOnNews = getBool("BBCOnNews", false);
m_iNewsInterval = getDword("NewsInterval", 15);
@@ -424,8 +425,10 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
if (!IsOnline())
return 0;
LONG userID = getDword(hContact, "ID", -1);
- if (userID == -1 || userID == VK_FEED_USER)
+ if (userID == -1 || userID == VK_FEED_USER){
+ ForkThread(&CVkProto::SendMsgAck, new TFakeAckParams(hContact, 0));
return 0;
+ }
ptrA szMsg;
if (flags & PREF_UTF)
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 2e906bb011..8167a0b47d 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -476,6 +476,7 @@ private:
m_bStikersAsSmyles,
m_bUserForceOnlineOnActivity,
m_bNewsEnabled,
+ m_bNotificationsEnabled,
m_bBBCOnNews;
int m_iNewsInterval;
@@ -511,6 +512,7 @@ private:
static INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
OBJLIST<CVkChatInfo> m_chats;
CVkChatInfo* AppendChat(int id, JSONNODE *pNode);