summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/resource.h1
-rw-r--r--protocols/VKontakte/src/version.h2
-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.h3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp30
6 files changed, 30 insertions, 12 deletions
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 <stdver.h>
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)