From 664d32a0cea975db58eda84aa6b6e943657bc7fa Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Fri, 17 Oct 2014 15:44:37 +0000 Subject: VKontakte: more broadcast option (path by alitor) version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@10814 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/res/resource.rc | 10 ++++++---- protocols/VKontakte/src/resource.h | 1 + protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk_options.cpp | 5 +++++ protocols/VKontakte/src/vk_proto.cpp | 1 + protocols/VKontakte/src/vk_proto.h | 3 ++- protocols/VKontakte/src/vk_thread.cpp | 30 ++++++++++++++++++++---------- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index c22183240c..d9b251687d 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -128,16 +128,18 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,278,10 CONTROL "Add [img] bbc for graphical attachments",IDC_ADD_IMG_BBC, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,41,278,10 + CONTROL "Process stickers as smileys",IDC_STICKERS_AS_SMYLES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,52,278,10 CONTROL "Force online status upon user activity",IDC_FORCE_ONLINE_ON_ACT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,63,278,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,63,278,10 + CONTROL "Broadcast music with VK audio status only", IDC_AUDIO_STATUS_ONLY, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 12, 74, 278, 10 GROUPBOX "When I ban user...",IDC_STATIC,4,91,293,33 CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,101,129,10 CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,112,129,10 CONTROL "Remove from friend list",IDC_REMOVE_FROM_FRENDLIST, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,101,129,10 - CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,112,129,10 - CONTROL "Process stickers as smileys",IDC_STICKERS_AS_SMYLES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,52,278,10 + CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,112,129,10 END IDD_OPT_MAIN DIALOGEX 0, 0, 304, 188 diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 83b0ee499d..c0418f3012 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -50,6 +50,7 @@ #define IDC_ONREPLY 1041 #define IDC_ONTYPING 1042 #define IDC_STATIC_MARK_AS_READ 1043 +#define IDC_AUDIO_STATUS_ONLY 1044 // Next default values for new objects // diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 52b96e62a7..2b0ab6011b 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 23 +#define __BUILD_NUM 24 #include diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 084ca326ff..082078188e 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -229,6 +229,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_ADD_IMG_BBC, ppro->m_bAddImgBbc); CheckDlgButton(hwndDlg, IDC_STICKERS_AS_SMYLES, ppro->m_bStikersAsSmyles); CheckDlgButton(hwndDlg, IDC_FORCE_ONLINE_ON_ACT, ppro->m_bUserForceOnlineOnActivity); + CheckDlgButton(hwndDlg, IDC_AUDIO_STATUS_ONLY, ppro->m_bAudioStatusOnly); CheckDlgButton(hwndDlg, IDC_REPORT_ABUSE, ppro->m_bReportAbuse); CheckDlgButton(hwndDlg, IDC_CLEAR_SERVER_HISTORY, ppro->m_bClearServerHistory); @@ -244,6 +245,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam case IDC_ADD_IMG_BBC: case IDC_FORCE_ONLINE_ON_ACT: case IDC_STICKERS_AS_SMYLES: + case IDC_AUDIO_STATUS_ONLY: case IDC_REPORT_ABUSE: case IDC_CLEAR_SERVER_HISTORY: case IDC_REMOVE_FROM_FRENDLIST: @@ -271,6 +273,9 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam ppro->m_bUserForceOnlineOnActivity = IsDlgButtonChecked(hwndDlg, IDC_FORCE_ONLINE_ON_ACT) == BST_CHECKED; ppro->setByte("UserForceOnlineOnActivity", ppro->m_bUserForceOnlineOnActivity); + ppro->m_bAudioStatusOnly = IsDlgButtonChecked(hwndDlg, IDC_AUDIO_STATUS_ONLY) == BST_CHECKED; + ppro->setByte("AudioStatusOnly", ppro->m_bAudioStatusOnly); + ppro->m_bReportAbuse = IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) == BST_CHECKED; ppro->setByte("ReportAbuseOnBanUser", ppro->m_bReportAbuse); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index be7ecce320..45b0f3c0f9 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -76,6 +76,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bAddImgBbc = getBool("AddImgBbc", false); m_bStikersAsSmyles = getBool("StikersAsSmyles", false); m_bUserForceOnlineOnActivity = getBool("UserForceOnlineOnActivity", false); + m_bAudioStatusOnly = getBool("AudioStatusOnly", false); // 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 de595211a8..e05ba0bb2b 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -414,7 +414,8 @@ private: m_bPopUpSyncHistory, m_bAddImgBbc, m_bStikersAsSmyles, - m_bUserForceOnlineOnActivity; + m_bUserForceOnlineOnActivity, + m_bAudioStatusOnly; enum MarkMsgReadOn{ markOnRead, markOnReceive, markOnReply, markOnTyping }; int m_iMarkMessageReadOn; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 5d526189e5..d4c1b8f2fc 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -843,20 +843,30 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) CMString code; CMString oldStatusMsg = db_get_tsa(0, m_szModuleName, "OldStatusMsg"); if (StatusMsg.IsEmpty()){ - if (oldStatusMsg.IsEmpty()) - code = "API.status.set();return null;"; + if (oldStatusMsg.IsEmpty() || m_bAudioStatusOnly) + code = "API.audio.setBroadcast();return null;"; else{ - CMString codeformat("API.status.set({text:\"%s\"});return null;"); - code.AppendFormat(codeformat, oldStatusMsg); + CMString codeformat("API.status.set({text:\"%s\"});return null;"); + code.AppendFormat(codeformat, oldStatusMsg); } } else { - CMString codeformat("var userID=%d;var StatusMsg=\"%s\";var oldStatus=API.status.get({\"user_id\":userID});" - "var Track=API.audio.search({\"q\":StatusMsg,\"count\":1});if(Track.count==0){API.status.set({\"text\":StatusMsg});" - "return oldStatus;}else{var owner=Track.items[0].owner_id;var trackID=Track.items[0].id;var audioTxt=owner+\"_\"+trackID;" - "var ids=API.audio.setBroadcast({\"audio\":audioTxt});if(userID==ids[0]){return null;}else{" - "API.status.set({\"text\":StatusMsg });return oldStatus;};};"); - code.AppendFormat(codeformat, m_myUserId, StatusMsg); + if (m_bAudioStatusOnly){ + CMString codeformat("var StatusMsg=\"%s\";" + "var Track=API.audio.search({\"q\":StatusMsg,\"count\":1});" + "if(Track.count==0){API.audio.setBroadcast();}" + "else{var owner=Track.items[0].owner_id;var trackID=Track.items[0].id;var audioTxt=owner+\"_\"+trackID;" + "var ids=API.audio.setBroadcast({\"audio\":audioTxt});};return null;"); + code.AppendFormat(codeformat, StatusMsg); + } + else{ + CMString codeformat("var StatusMsg=\"%s\";" + "var Track=API.audio.search({\"q\":StatusMsg,\"count\":1});" + "if(Track.count==0){API.status.set({\"text\":StatusMsg});return null;}" + "else{var owner=Track.items[0].owner_id;var trackID=Track.items[0].id;var audioTxt=owner+\"_\"+trackID;" + "var ids=API.audio.setBroadcast({\"audio\":audioTxt});return null;};"); + code.AppendFormat(codeformat, StatusMsg); + } } Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth) << TCHAR_PARAM("code", code) -- cgit v1.2.3