From 58e977eada0eb95198dbc552d99446c83506a73a Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Thu, 9 Mar 2017 14:51:23 +0500 Subject: VKontakte: move js code to vk stored procedures version bump --- protocols/VKontakte/src/vk_status.cpp | 41 +++++++---------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'protocols/VKontakte/src/vk_status.cpp') diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index d7503923df..e7e335be2a 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -180,10 +180,10 @@ void CVkProto::RetrieveStatusMusic(const CMStringW &StatusMsg) debugLogA("CVkProto::RetrieveStatusMusic"); if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone) return; - - CMStringW code; + CMStringW wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg")); if (StatusMsg.IsEmpty()) { + CMStringW code; if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) code = "API.audio.setBroadcast();return null;"; else { @@ -191,41 +191,16 @@ void CVkProto::RetrieveStatusMusic(const CMStringW &StatusMsg) code.AppendFormat(codeformat, wszOldStatusMsg); } m_bSetBroadcast = false; + Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveStatus) + << WCHAR_PARAM("code", code)); } else { - if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) { - CMStringW codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();" - "var Tracks=API.audio.search({\"q\":StatusMsg,\"count\":CntLmt,\"search_own\":1});" - "var Cnt=Tracks.count;if(Cnt>CntLmt){Cnt=CntLmt;}" - "if(Cnt==0){API.audio.setBroadcast();}" - "else{var i=0;var j=0;var Track=\" \";" - "while(iCntLmt){Cnt=CntLmt;}" - "if(Cnt==0){Track=\"♫ \"+StatusMsg;API.status.set({\"text\":Track});}" - "else{var i=0;var j=-1;" - "while(i