diff options
Diffstat (limited to 'protocols/VKontakte/src/vk_proto.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 38 |
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 |