diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-11 13:40:24 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-11 13:40:24 +0000 |
commit | e8cfaff4970726c7f15c0241e0c6b210ead2f0bd (patch) | |
tree | 6ddda89e8756ba7af349a46c9a6f689b68cfb8d9 /protocols/VKontakte/src/vk_chats.cpp | |
parent | 16836ea77582da49b82c9b95332762f7135c76ea (diff) |
VKontakte:
fix for leave chat menuitem on clist contact’s menu
fix for mark messages as read for chat messages
git-svn-id: http://svn.miranda-ng.org/main/trunk@10764 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_chats.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 8ddfaa201a..d559450383 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -465,6 +465,35 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) }
}
+INT_PTR __cdecl CVkProto::OnLeaveChat(WPARAM hContact, LPARAM)
+{
+ debugLogA("CVkProto::OnLeaveChat");
+ ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ if (tszChatID == NULL)
+ return 1;
+
+ CVkChatInfo *cc = GetChatById(tszChatID);
+ if (cc == NULL)
+ return 1;
+
+ if (IDYES == MessageBox(NULL,
+ TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"),
+ TranslateT("Warning"), MB_YESNOCANCEL | MB_ICONQUESTION))
+ {
+ CMStringA code;
+ code.Format("var Hist = API.messages.getHistory({\"chat_id\":%d, \"count\":200});"
+ "var countMsg = Hist.count;var itemsMsg = Hist.items@.id; "
+ "while (countMsg > 1) { API.messages.delete({\"message_ids\":itemsMsg});"
+ "Hist=API.messages.getHistory({\"chat_id\":%d, \"count\":200});"
+ "countMsg = Hist.count;itemsMsg = Hist.items@.id;}; return 1;", cc->m_chatid, cc->m_chatid);
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnChatDestroy)
+ << CHAR_PARAM("code", code)
+ << VER_API)->pUserInfo = cc;
+ return 0;
+ }
+ return 1;
+}
+
void CVkProto::OnChatDestroy(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnChatDestroy %d", reply->resultCode);
|