From 8934ae2caa8cdc2cc70baf0047a8812b0538963f Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Wed, 28 Oct 2015 05:22:20 +0000 Subject: =?UTF-8?q?VKontakte:=20add=20=E2=80=98Message=20for=20return=20to?= =?UTF-8?q?=20chat=E2=80=99=20option=20add=20=E2=80=98Use=20non-standard?= =?UTF-8?q?=20popups=20for=20news=20and=20event=20notifications=E2=80=99?= =?UTF-8?q?=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.miranda-ng.org/main/trunk@15628 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/res/resource.rc | 33 +++++++++++++++++++-------------- protocols/VKontakte/src/resource.h | 5 ++++- protocols/VKontakte/src/vk_chats.cpp | 3 +-- protocols/VKontakte/src/vk_feed.cpp | 8 ++++++-- protocols/VKontakte/src/vk_options.cpp | 21 +++++++++++++++++++++ protocols/VKontakte/src/vk_proto.cpp | 6 ++++++ protocols/VKontakte/src/vk_proto.h | 4 +++- 7 files changed, 60 insertions(+), 20 deletions(-) diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index c779ad6bc6..b7386c4a38 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -73,7 +73,7 @@ BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 297 TOPMARGIN, 7 - BOTTOMMARGIN, 187 + BOTTOMMARGIN, 226 END IDD_OPT_MAIN, DIALOG @@ -204,15 +204,15 @@ BEGIN CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,0,49,174,12 END -IDD_OPT_ADV DIALOGEX 0, 0, 304, 197 +IDD_OPT_ADV DIALOGEX 0, 0, 304, 236 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Advanced",IDC_STATIC,4,8,293,83 + GROUPBOX "Advanced",IDC_STATIC,4,8,293,94 CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,19,278,10 CONTROL "Sync read message status from server",IDC_SYNC_MSG_STATUS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,268,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,268,10 CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,41,278,10 CONTROL "Force invisible status upon user activity",IDC_FORCE_ONLINE_ON_ACT, @@ -222,18 +222,23 @@ BEGIN CONTROL "",IDC_SPIN_INT_INVIS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,244,63,14,14 CONTROL "Use non-standard urlEncode for sent messages (less traffic)",IDC_USENOSTDURLENCODE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,278,10 - GROUPBOX "When I ban user...",IDC_STATIC,4,92,293,33 - CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,102,129,10 - CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,113,129,10 + CONTROL "Use non-standard popups for news and event notifications",IDC_USENOSTDPOPUPS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,89,278,10 + GROUPBOX "When I ban user...",IDC_STATIC,4,102,293,33 + CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,112,129,10 + CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,123,129,10 CONTROL "Remove from friend list",IDC_REMOVE_FROM_FRENDLIST, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,102,141,10 - CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,113,141,10 - GROUPBOX "Broadcast music...",IDC_STATIC_SEND_MUSIC_METOD,4,128,293,58,WS_GROUP - CONTROL "off",IDC_SEND_MUSIC_NONE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,139,278,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,112,141,10 + CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,123,141,10 + GROUPBOX "Broadcast music...",IDC_STATIC_SEND_MUSIC_METOD,4,138,293,58,WS_GROUP + CONTROL "off",IDC_SEND_MUSIC_NONE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,149,278,10 CONTROL "as regular status for unknown music and audio status otherwise",IDC_SEND_MUSIC_BROADCAST_AND_STATUS, - "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,150,278,10 - CONTROL "as audio status only",IDC_SEND_MUSIC_BROADCAST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,161,278,10 - CONTROL "as regular status only",IDC_SEND_MUSIC_STATUS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,172,278,10 + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,160,278,10 + CONTROL "as audio status only",IDC_SEND_MUSIC_BROADCAST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,171,278,10 + CONTROL "as regular status only",IDC_SEND_MUSIC_STATUS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,182,278,10 + GROUPBOX "Chats",IDC_STATIC_CHATS,4,195,293,27,WS_GROUP + LTEXT "Message for return to chat:",IDC_STATIC,12,206,120,8 + EDITTEXT IDC_RET_CHAT_MES,134,204,157,12,ES_AUTOHSCROLL END IDD_OPT_MAIN DIALOGEX 0, 0, 304, 213 diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index b02e3d1e88..d08a099670 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -60,6 +60,7 @@ #define IDC_SEND_MUSIC_BROADCAST 1047 #define IDC_SEND_MUSIC_BROADCAST_AND_STATUS 1048 #define IDC_STATIC_SYNC_HISTORY 1049 +#define IDC_STATIC_CHATS 1049 #define IDC_SYNC_OFF 1050 #define IDC_SYNC_AUTO 1051 #define IDC_SYNC_LAST1DAY 1052 @@ -107,6 +108,8 @@ #define IDC_ST_WARNING 1095 #define IDC_NOTIF_MARK_VIEWED 1096 #define IDC_N_INVITES 1097 +#define IDC_USENOSTDPOPUPS 1098 +#define IDC_RET_CHAT_MES 1099 // Next default values for new objects // @@ -115,7 +118,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 122 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1098 +#define _APS_NEXT_CONTROL_VALUE 1100 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 7c13e27038..98274d0f95 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -659,10 +659,9 @@ INT_PTR __cdecl CVkProto::OnJoinChat(WPARAM hContact, LPARAM) if (chat_id == -1) return 1; - CMString tszReturnChatMessage(ptrT(getTStringA("ReturnChatMessage"))); AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg, AsyncHttpRequest::rpHigh) << INT_PARAM("chat_id", chat_id) - << TCHAR_PARAM("message", tszReturnChatMessage.IsEmpty() ? TranslateT("I'm back") : tszReturnChatMessage) + << TCHAR_PARAM("message", m_ReturnChatMessage) << VER_API; pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded"); Push(pReq); diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 87c69bc9b1..7e13131cb0 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -60,9 +60,13 @@ void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem) recv.lParam = 0; recv.pCustomData = NULL; recv.cbCustomDataSize = 0; - recv.flags = PREF_CREATEREAD; + + if (m_bUseNonStandardNotifications) { + recv.flags = PREF_CREATEREAD; + MsgPopup(hContact, vkNewsItem.tszPopupText, vkNewsItem.tszPopupTitle); + } + ProtoChainRecvMsg(hContact, &recv); - MsgPopup(hContact, vkNewsItem.tszPopupText, vkNewsItem.tszPopupTitle); } void CVkProto::AddCListEvent(bool bNews) diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index bcb35b11cf..2e753c4e07 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -250,6 +250,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_FORCE_ONLINE_ON_ACT, ppro->m_bUserForceOnlineOnActivity ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USENOSTDURLENCODE, ppro->m_bUseNonStandardUrlEncode ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USENOSTDPOPUPS, ppro->m_bUseNonStandardNotifications ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_REPORT_ABUSE, ppro->m_bReportAbuse ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CLEAR_SERVER_HISTORY, ppro->m_bClearServerHistory ? BST_CHECKED : BST_UNCHECKED); @@ -264,6 +265,8 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETRANGE, 0, MAKELONG(60, 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETPOS, 0, ppro->m_iInvisibleInterval); + SetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, ppro->m_ReturnChatMessage); + return TRUE; case WM_COMMAND: @@ -280,10 +283,16 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam } break; + case IDC_RET_CHAT_MES: + if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_HIDECHATS: case IDC_MESASUREAD: case IDC_FORCE_ONLINE_ON_ACT: case IDC_USENOSTDURLENCODE: + case IDC_USENOSTDPOPUPS: case IDC_REPORT_ABUSE: case IDC_CLEAR_SERVER_HISTORY: case IDC_REMOVE_FROM_FRENDLIST: @@ -318,6 +327,9 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam ppro->m_bUseNonStandardUrlEncode = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDURLENCODE) == BST_CHECKED; ppro->setByte("UseNonStandardUrlEncode", ppro->m_bUseNonStandardUrlEncode); + ppro->m_bUseNonStandardNotifications = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDPOPUPS) == BST_CHECKED; + ppro->setByte("UseNonStandardNotifications", ppro->m_bUseNonStandardNotifications); + ppro->m_bReportAbuse = IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) == BST_CHECKED; ppro->setByte("ReportAbuseOnBanUser", ppro->m_bReportAbuse); @@ -346,6 +358,15 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam TCHAR buffer[5] = { 0 }; GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, _countof(buffer)); ppro->setDword("InvisibleInterval", ppro->m_iInvisibleInterval = _ttoi(buffer)); + + TCHAR str[4096]; + GetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, str, _countof(str)); + CMString tszReturnChatMessage(str); + if (tszReturnChatMessage != ppro->m_ReturnChatMessage) { + tszReturnChatMessage.Trim(); + ppro->m_ReturnChatMessage = mir_tstrdup(tszReturnChatMessage.IsEmpty() ? TranslateT("I'm back"): tszReturnChatMessage); + ppro->setTString("ReturnChatMessage", ppro->m_ReturnChatMessage); + } } break; diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 011922b230..0d213c09cc 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -114,6 +114,8 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNotificationFilterReposts = getBool("NotificationFilterReposts", true); m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true); m_bNotificationFilterInvites = getBool("NotificationFilterInvites", true); + + m_bUseNonStandardNotifications = getBool("UseNonStandardNotifications", false); m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true); m_iInvisibleInterval = getDword("InvisibleInterval", 10); @@ -129,6 +131,10 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNeedSendOnline = false; delSetting("InviteGroupIds"); + m_ReturnChatMessage = getTStringA("ReturnChatMessage"); + if (m_ReturnChatMessage == NULL) + m_ReturnChatMessage = TranslateT("I'm back"); + // Set all contacts offline -- in case we crashed SetAllContactStatuses(ID_STATUS_OFFLINE); { diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 16f0a2b8c0..d6a7902d6d 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -392,7 +392,8 @@ private: m_bShortenLinksForAudio, m_bSplitFormatFwdMsg, m_bSyncReadMessageStatusFromServer, - m_bLoadFullCList; + m_bLoadFullCList, + m_bUseNonStandardNotifications; int m_iNewsInterval, m_iNotificationsInterval, @@ -417,6 +418,7 @@ private: LONG m_myUserId; ptrT m_defaultGroup; + ptrT m_ReturnChatMessage; ptrA m_pollingServer, -- cgit v1.2.3