diff options
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 29 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 4 |
2 files changed, 32 insertions, 1 deletions
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);
+}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index e765b3b379..37e70d37cb 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -317,6 +317,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcReportAbuse(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcDestroyKickChat(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcOpenBroadcast(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl SvcWallPost(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcSetStatusMsg(WPARAM, LPARAM);
//==== History Menus ==================================================================
@@ -447,9 +448,10 @@ struct CVkProto : public PROTO<CVkProto> void RetrieveUnreadMessages();
void OnReceiveMessages(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveDlgs(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
+ void WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly = false);
+
void GetServerHistoryLastNDay(MCONTACT hContact, int NDay);
void GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once = false);
void OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq);
|