summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-09-08 04:22:07 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-09-08 04:22:07 +0000
commit57fb5a039ebb74fd276d7bd0224406f29f9d18b9 (patch)
tree8c4876131542a2d3047acc97ca7c9acf9da8a0cd /protocols/VKontakte
parenta8b306403955d9904cb97f8670e9ff583b0b2a00 (diff)
VKontakte:
PF4_GROUPCHATFILES support version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15304 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp11
-rw-r--r--protocols/VKontakte/src/vk_files.cpp46
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
4 files changed, 48 insertions, 13 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 590fb86f7c..e9fb9515a4 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 1
-#define __BUILD_NUM 14
+#define __BUILD_NUM 15
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 1d3c56d273..d5b58469e2 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -527,9 +527,20 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
void CVkProto::OnSendChatMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnSendChatMsg %d", reply->resultCode);
+ int iResult = ACKRESULT_FAILED;
if (reply->resultCode == 200) {
JSONNode jnRoot;
CheckJsonResponse(pReq, reply, jnRoot);
+ iResult = ACKRESULT_SUCCESS;
+ }
+ if (!pReq->pUserInfo)
+ return;
+
+ CVkFileUploadParam *fup = (CVkFileUploadParam *)pReq->pUserInfo;
+ ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, iResult, (HANDLE)(fup));
+ if (!pReq->bNeedsRestart || m_bTerminated) {
+ delete fup;
+ pReq->pUserInfo = NULL;
}
}
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp
index 932841f050..2423899ddb 100644
--- a/protocols/VKontakte/src/vk_files.cpp
+++ b/protocols/VKontakte/src/vk_files.cpp
@@ -20,8 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
HANDLE CVkProto::SendFile(MCONTACT hContact, const TCHAR *desc, TCHAR **files)
{
debugLogA("CVkProto::SendFile");
+ isChatRoom(hContact);
LONG userID = getDword(hContact, "ID", -1);
- if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
+ if (!IsOnline() || ((userID == -1 || userID == VK_FEED_USER) && !isChatRoom(hContact)))
return (HANDLE)0;
CVkFileUploadParam *fup = new CVkFileUploadParam(hContact, desc, files);
@@ -352,20 +353,43 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR
SendFileFiled(fup, VKERR_FTYPE_NOT_SUPPORTED);
return;
}
+
+ AsyncHttpRequest *pMsgReq;
- LONG userID = getDword(fup->hContact, "ID", -1);
- if (userID == -1 || userID == VK_FEED_USER) {
- SendFileFiled(fup, VKERR_INVALID_USER);
- return;
+ if (isChatRoom(fup->hContact)) {
+
+ ptrT tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
+ if (!tszChatID) {
+ SendFileFiled(fup, VKERR_INVALID_USER);
+ return;
+ }
+
+ CVkChatInfo *cc = GetChatById(tszChatID);
+ if (cc == NULL) {
+ SendFileFiled(fup, VKERR_INVALID_USER);
+ return;
+ }
+
+ pMsgReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg, AsyncHttpRequest::rpHigh)
+ << INT_PARAM("chat_id", cc->m_chatid);
+ pMsgReq->pUserInfo = pReq->pUserInfo;
+
+ }
+ else {
+ LONG userID = getDword(fup->hContact, "ID", -1);
+ if (userID == -1 || userID == VK_FEED_USER) {
+ SendFileFiled(fup, VKERR_INVALID_USER);
+ return;
+ }
+
+ pMsgReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh)
+ << INT_PARAM("user_id", userID);
+ pMsgReq->pUserInfo = new CVkSendMsgParam(fup->hContact, fup);
+
}
- AsyncHttpRequest *pMsgReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh)
- << INT_PARAM("user_id", userID)
- << TCHAR_PARAM("message", fup->Desc)
- << TCHAR_PARAM("attachment", Attachment)
- << VER_API;
+ pMsgReq << TCHAR_PARAM("message", fup->Desc) << TCHAR_PARAM("attachment", Attachment) << VER_API;
pMsgReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
- pMsgReq->pUserInfo = new CVkSendMsgParam(fup->hContact, fup);
Push(pMsgReq);
} \ No newline at end of file
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index d334c71cbc..c0ea47c99c 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -468,7 +468,7 @@ DWORD_PTR CVkProto::GetCaps(int type, MCONTACT)
return PF2_ONLINE;
case PFLAGNUM_4:
- return PF4_AVATARS | PF4_SUPPORTTYPING | PF4_NOAUTHDENYREASON | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES | PF4_READNOTIFY;
+ return PF4_AVATARS | PF4_SUPPORTTYPING | PF4_NOAUTHDENYREASON | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES | PF4_READNOTIFY | PF4_GROUPCHATFILES;
case PFLAGNUM_5:
return PF2_ONTHEPHONE;