From be4940e4efd1ac8a335b411b550568e5f4dff213 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Fri, 27 Feb 2015 10:18:37 +0000 Subject: VKontakte: wall.post support - part 1 git-svn-id: http://svn.miranda-ng.org/main/trunk@12278 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_messages.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'protocols/VKontakte/src/vk_messages.cpp') diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index b54c28fd73..73bb93fa61 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -344,3 +344,32 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) } RetrieveUsersInfo(); } + +INT_PTR __cdecl CVkProto::SvcWallPost(WPARAM hContact, LPARAM) +{ + return 1; +} + +void CVkProto::WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly) +{ + debugLogA("CVkProto::WallPost"); + if (!IsOnline() || (IsEmpty(ptszMsg) && IsEmpty(ptszUrl))) + return; + + LONG userID = hContact ? m_myUserId : getDword(hContact, "ID", -1); + if (userID == -1 || userID == VK_FEED_USER) + return; + + AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/wall.post.json", true, &CVkProto::OnReceiveSmth) + << INT_PARAM("owner_id", userID) + << INT_PARAM("friends_only", bFriendsOnly ? 1 : 0) + << VER_API; + + if (!IsEmpty(ptszMsg)) + pReq << TCHAR_PARAM("message", ptszMsg); + + if (!IsEmpty(ptszUrl)) + pReq << TCHAR_PARAM("attachments", ptszUrl); + + Push(pReq); +} -- cgit v1.2.3