diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 3 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 35 |
5 files changed, 41 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index 0b7db5824d..b1de929d8c 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -60,6 +60,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <m_toptoolbar.h>
#include <m_userinfo.h>
#include <m_utils.h>
+#include <m_proto_listeningto.h>
#include <m_folders.h>
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index e5fba6e23a..391e2c1638 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 13
+#define __BUILD_NUM 14
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 9d0ac6a4b1..69032ef1ef 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -39,6 +39,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : CreateProtoService(PS_CREATEACCMGRUI, &CVkProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETAVATARINFOT, &CVkProto::SvcGetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, &CVkProto::SvcGetAvatarCaps);
+ CreateProtoService(PS_SET_LISTENINGTO, &CVkProto::SetListeningTo);
HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index ba6c0aa8d6..adf1140b74 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -192,6 +192,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAllServerHistory(WPARAM wParam, LPARAM);
+ INT_PTR __cdecl SetListeningTo(WPARAM, LPARAM);
//==== Misc ==========================================================================
@@ -200,6 +201,8 @@ struct CVkProto : public PROTO<CVkProto> void RetrieveMyInfo(void);
void OnReceiveMyInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
+ void RetrieveStatusMusic();
+ void RetrieveStatusMsg(const CMString &StatusMsg);
void RetrieveUserInfo(LONG userId);
void RetrieveUsersInfo(bool flag = false);
void OnReceiveUserInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 6b049b078c..842ad34ce9 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -106,6 +106,7 @@ void CVkProto::SetServerStatus(int iNewStatus) m_iStatus = ID_STATUS_ONLINE;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOnline.json", true, &CVkProto::OnReceiveSmth)
<< VER_API);
+ RetrieveStatusMusic();
}
else m_iStatus = ID_STATUS_INVISIBLE;
@@ -750,6 +751,40 @@ void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * m_hPollingThread = ForkThreadEx(&CVkProto::PollingThread, NULL, NULL);
}
+void CVkProto::RetrieveStatusMusic()
+{
+ CMString wszListeningTo = db_get_tsa(NULL, m_szModuleName, "ListeningTo");
+ RetrieveStatusMsg(wszListeningTo);
+}
+
+void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg)
+{
+ debugLogA("CVkProto::RetrieveStatusMsg");
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/status.set.json", true, &CVkProto::OnReceiveSmth)
+ << TCHAR_PARAM("text", StatusMsg)
+ << VER_API);
+}
+
+INT_PTR __cdecl CVkProto::SetListeningTo(WPARAM wParam, LPARAM lParam)
+{
+ LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
+
+ if (pliInfo == NULL || pliInfo->cbSize != sizeof(LISTENINGTOINFO))
+ db_unset(NULL, m_szModuleName, "ListeningTo");
+ else if (pliInfo->dwFlags & LTI_UNICODE) {
+ CMStringW wszListeningTo;
+ if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
+ wszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%track%. %title% - %artist% - %player%", (LPARAM)pliInfo));
+ else
+ wszListeningTo.Format(L"%s. %s - %s - %s", pliInfo->ptszTrack ? pliInfo->ptszTrack : _T(""), pliInfo->ptszTitle ? pliInfo->ptszTitle : _T(""), pliInfo->ptszArtist ? pliInfo->ptszArtist : _T(""), pliInfo->ptszPlayer ? pliInfo->ptszPlayer : _T(""));
+
+ setTString("ListeningTo", wszListeningTo);
+ }
+ return 0;
+}
+
+
INT_PTR __cdecl CVkProto::SvcGetAllServerHistory(WPARAM hContact, LPARAM)
{
LPCTSTR str = TranslateT("Are you sure to reload all messages from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a long time.\nDo you want to continue?");
|