summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_proto.cpp
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2017-09-19 13:44:36 +0500
committerElzorFox <elzorfox@ya.ru>2017-09-19 13:45:19 +0500
commit73b122d495760172d7f380d783d17e1b36212282 (patch)
treecd4634fe9da43e16aef01ef1b615274a9fec542f /protocols/VKontakte/src/vk_proto.cpp
parent7b91e481c58fdc8bca6619e3665bc1ded40b0200 (diff)
VKontakte:
add removing from friendlist and clear server history on delete from Miranda clist version bump
Diffstat (limited to 'protocols/VKontakte/src/vk_proto.cpp')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index dec31de534..60131a3586 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -547,6 +547,9 @@ int CVkProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
case EV_PROTO_ONOPTIONS:
return OnOptionsInit(wParam, lParam);
+
+ case EV_PROTO_ONCONTACTDELETED:
+ return OnContactDeleted(wParam, lParam);
}
return 1;
@@ -679,4 +682,39 @@ int CVkProto::GetInfo(MCONTACT hContact, int)
return 1;
RetrieveUserInfo(userID);
return 0;
+}
+
+int CVkProto::OnContactDeleted(WPARAM hContact, LPARAM)
+{
+ ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
+ debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick);
+
+ if (getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact))
+ return 0;
+
+ LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
+ if (userID == VK_INVALID_USER || userID == VK_FEED_USER)
+ return 0;
+
+ CONTACTDELETE_FORM_PARAMS *param = new CONTACTDELETE_FORM_PARAMS(pwszNick, true, !getBool(hContact, "Auth", true), true);
+ CVkContactDeleteForm dlg(this, param);
+ dlg.DoModal();
+
+ debugLogW(L"CVkProto::OnContactDeleted %s DeleteDialog=%d DeleteFromFriendlist=%d", pwszNick, param->bDeleteDialog, param->bDeleteFromFriendlist);
+ if (param->bDeleteDialog || param->bDeleteFromFriendlist)
+ return 0;
+
+ CMStringA code(FORMAT, "var userID=\"%d\";", userID);
+ if (param->bDeleteDialog)
+ code += "API.messages.deleteDialog({\"user_id\":userID,count:10000});";
+
+ if (param->bDeleteFromFriendlist)
+ code += "API.friends.delete({\"user_id\":userID});";
+
+ code += "return 1;";
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
+ << CHAR_PARAM("code", code));
+
+ return 0;
} \ No newline at end of file