diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-29 09:09:40 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-29 09:09:40 +0000 |
commit | 9f8f51ae8bc32ba91d98a2fbd6a652a55241a7d7 (patch) | |
tree | db4f3e5029dfd049e1e832069b701ec7c115f35b /protocols/VKontakte/src/vk_thread.cpp | |
parent | e77a3c5664bf839e5e94d27a9fbc8c8a6e2da51d (diff) |
VKontakte:
replace icons for add/remove frendlist menuitems
fix ‘Add as frend’ menuitem for chats
add ‘Report abuse’ and ‘Ban user’ support
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@10621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 1189768c0f..f23d7ae880 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -948,6 +948,92 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST* reply, AsyncHttpRequest* delete param;
}
+INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM)
+{
+ debugLogA("CVkProto::SvcBanUser");
+ LONG userID = getDword(hContact, "ID", -1);
+ if (!IsOnline() || (userID == -1))
+ return 1;
+
+ CMStringA code;
+ code.AppendFormat("var userID=\"%d\";API.account.banUser({\"user_id\":userID});", userID);
+ CMString tszVarWarning;
+
+ if (m_bReportAbuse){
+ debugLogA("CVkProto::SvcBanUser m_bReportAbuse = true");
+ code += "API.users.report({\"user_id\":userID,type:\"spam\"});";
+ tszVarWarning = TranslateT(" report abuse on him/her");
+ }
+ if (m_bClearServerHistory){
+ debugLogA("CVkProto::SvcBanUser m_bClearServerHistory = true");
+ code += "API.messages.deleteDialog({\"user_id\":userID,count:10000});";
+ if (!tszVarWarning.IsEmpty())
+ tszVarWarning.AppendChar(L',');
+ tszVarWarning += TranslateT(" clear server history with him/her");
+ }
+ if (m_bRemoveFromFrendlist){
+ debugLogA("CVkProto::SvcBanUser m_bRemoveFromFrendlist = true");
+ code += "API.friends.delete({\"user_id\":userID});";
+ if (!tszVarWarning.IsEmpty())
+ tszVarWarning.AppendChar(L',');
+ tszVarWarning += TranslateT(" remove his/her from you frendlist");
+ }
+ if (m_bRemoveFromClist){
+ debugLogA("CVkProto::SvcBanUser m_bRemoveFromClist = true");
+ if (!tszVarWarning.IsEmpty())
+ tszVarWarning.AppendChar(L',');
+ tszVarWarning += TranslateT(" remove his/her from you contact list");
+ }
+
+ if (!tszVarWarning.IsEmpty())
+ tszVarWarning += ".\n";
+ code += "return 1;";
+
+ CMString formatstr = TranslateT("Are you sure to ban %s? %s%sContinue?"),
+ tszNick = db_get_tsa(hContact, m_szModuleName, "Nick"),
+ ptszMsg;
+
+ ptszMsg.AppendFormat(formatstr,
+ tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick.GetBuffer(),
+ tszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
+ tszVarWarning.IsEmpty() ? L"\n" : tszVarWarning.GetBuffer());
+
+ if (IDNO == MessageBox(NULL, ptszMsg.GetBuffer(), TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ return 1;
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
+ << CHAR_PARAM("code", code)
+ << VER_API);
+
+ if (m_bRemoveFromClist)
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+
+ return 0;
+}
+
+INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM)
+{
+ debugLogA("CVkProto::SvcReportAbuse");
+ LONG userID = getDword(hContact, "ID", -1);
+ if (!IsOnline() || (userID == -1))
+ return 1;
+
+ CMString formatstr = TranslateT("Are you sure to report abuse on %s?"),
+ tszNick = db_get_tsa(hContact, m_szModuleName, "Nick"),
+ ptszMsg;
+ ptszMsg.AppendFormat(formatstr, tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick);
+ if (IDNO == MessageBox(NULL, ptszMsg.GetBuffer(), TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ return 1;
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/users.report.json", true, &CVkProto::OnReceiveSmth)
+ << INT_PARAM("user_id", userID)
+ << CHAR_PARAM("type", "spam")
+ << VER_API);
+
+ return 0;
+}
+
+
INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM)
{
LONG userID = getDword(hContact, "ID", -1);
|