summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/res/resource.rc20
-rw-r--r--protocols/VKontakte/src/resource.h4
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_dialogs.cpp39
-rw-r--r--protocols/VKontakte/src/vk_dialogs.h33
-rw-r--r--protocols/VKontakte/src/vk_history.cpp14
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp19
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
8 files changed, 24 insertions, 108 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index 257878d6d6..3256d20381 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -136,15 +136,6 @@ BEGIN
BOTTOMMARGIN, 127
END
- IDD_CONTACTDELETE, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 276
- VERTGUIDE, 29
- TOPMARGIN, 7
- BOTTOMMARGIN, 80
- END
-
IDD_VKUSERFORM, DIALOG
BEGIN
LEFTMARGIN, 4
@@ -375,17 +366,6 @@ BEGIN
CONTROL "Only for friends",IDC_ONLY_FRIENDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,61,98,248,10
END
-IDD_CONTACTDELETE DIALOGEX 0, 0, 283, 87
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,117,66,50,14
- CTEXT "",IDC_STATIC_TXT,7,7,275,18
- CONTROL "",IDC_CH_REMOVE_FROM_FRIEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,33,254,10
- CONTROL "",IDC_CH_CLEARHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,45,253,10
-END
-
IDD_VKUSERFORM DIALOGEX 0, 0, 215, 261
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Mark contacts for forwarding messages"
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index 1d8cd98a68..4f3d4fa917 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -24,7 +24,6 @@
#define IDI_WALL 121
#define IDI_MARKMESSAGESASREAD 122
#define IDD_OPT_MENU 122
-#define IDD_CONTACTDELETE 123
#define IDD_VKUSERFORM 124
#define IDI_FORWARD 126
#define IDI_RELOADMESSAGE 130
@@ -127,13 +126,10 @@
#define IDC_N_FRIENDACCEPTED 1110
#define IDC_SENDVKURLSASATTACH 1111
#define IDC_LOADSENTATTACH 1112
-#define IDC_STATIC_TXT 1113
#define IDC_BBC_NEWSTORY 1114
-#define IDC_CH_CLEARHISTORY 1115
#define IDC_CONTACTLIST 1116
#define IDC_MESSAGE 1117
#define IDC_STATIC_MARKCONTAKTS 1118
-#define IDC_CH_REMOVE_FROM_FRIEND 1119
#define IDC_STATIC_MESSAGE 1120
#define IDC_ADD_MES_LINK_MES_ATT 1121
#define IDC_ADD_ORIG_VER_IN_EDITED_MES 1122
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 0389c1468a..330ff69a06 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 16
-#define __BUILD_NUM 10
+#define __BUILD_NUM 11
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp
index 67396e702e..85590484c0 100644
--- a/protocols/VKontakte/src/vk_dialogs.cpp
+++ b/protocols/VKontakte/src/vk_dialogs.cpp
@@ -248,42 +248,3 @@ void CVkUserListForm::ResetListOptions()
m_clc.SetHideEmptyGroups(true);
m_clc.SetHideOfflineRoot(true);
}
-
-////////////////////////////////// IDD_CONTACTDELETE //////////////////////////////////////
-
-CVkContactDeleteForm::CVkContactDeleteForm(CVkProto *proto, CONTACTDELETE_FORM_PARAMS *param) :
- CVkDlgBase(proto, IDD_CONTACTDELETE),
- m_stText(this, IDC_STATIC_TXT),
- m_cbDeleteFromFriendlist(this, IDC_CH_REMOVE_FROM_FRIEND),
- m_cbDeleteDialog(this, IDC_CH_CLEARHISTORY),
- m_param(param)
-{
-}
-
-bool CVkContactDeleteForm::OnInitDialog()
-{
- CMStringW szText(FORMAT, TranslateT("You delete %s from the contact list.\nWhat needs to be done additionally?"),
- m_param->pwszNick);
- m_stText.SetText(szText.c_str());
-
- szText.Format(TranslateT("Remove %s from your friend list"), m_param->pwszNick);
- m_cbDeleteFromFriendlist.SetText(szText.c_str());
- m_cbDeleteFromFriendlist.SetState(m_param->bDeleteFromFriendlist && m_param->bEnableDeleteFromFriendlist);
- m_cbDeleteFromFriendlist.Enable(m_param->bEnableDeleteFromFriendlist);
-
-
- szText.Format(TranslateT("Clear server history with %s"), m_param->pwszNick);
- m_cbDeleteDialog.SetText(szText.c_str());
- m_cbDeleteDialog.SetState(m_param->bDeleteDialog);
-
- szText.Format(TranslateT("Deleting %s from contact list"), m_param->pwszNick);
- SetCaption(szText.c_str());
- return true;
-}
-
-bool CVkContactDeleteForm::OnApply()
-{
- m_param->bDeleteDialog = m_cbDeleteDialog.GetState() != 0;
- m_param->bDeleteFromFriendlist = m_param->bEnableDeleteFromFriendlist && (m_cbDeleteFromFriendlist.GetState() != 0);
- return true;
-}
diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h
index 39afb1c91a..e921e3ad0d 100644
--- a/protocols/VKontakte/src/vk_dialogs.h
+++ b/protocols/VKontakte/src/vk_dialogs.h
@@ -137,36 +137,3 @@ public:
void FilterList(CCtrlClc*);
void ResetListOptions();
};
-
-////////////////////////////////// IDD_CONTACTDELETE //////////////////////////////////////
-
-struct CONTACTDELETE_FORM_PARAMS
-{
- wchar_t *pwszNick;
- bool bDeleteFromFriendlist;
- bool bEnableDeleteFromFriendlist;
- bool bDeleteDialog;
-
- CONTACTDELETE_FORM_PARAMS(wchar_t *nick, bool _bDeleteFromFriendlist, bool _bEnableDeleteFromFriendlist, bool _bDeleteDialog) :
- pwszNick(nick),
- bDeleteFromFriendlist(_bDeleteFromFriendlist),
- bEnableDeleteFromFriendlist(_bEnableDeleteFromFriendlist),
- bDeleteDialog(_bDeleteDialog)
- {}
-
-};
-
-
-class CVkContactDeleteForm : public CVkDlgBase
-{
- CCtrlBase m_stText;
- CCtrlCheck m_cbDeleteFromFriendlist;
- CCtrlCheck m_cbDeleteDialog;
-
- CONTACTDELETE_FORM_PARAMS *m_param;
-
-public:
- CVkContactDeleteForm(CVkProto *proto, CONTACTDELETE_FORM_PARAMS *param);
- bool OnInitDialog() override;
- bool OnApply() override;
-};
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index b9e4a56967..198c75fec4 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -18,6 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
//////////////////////////// History services ///////////////////////////////////////////
+INT_PTR CVkProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM lParam)
+{
+ debugLogA("CVkProto::SvcEmptyServerHistory was called for %s", Clist_GetContactDisplayName(hContact));
+
+ VKUserID_t iUserId = ReadVKUserID(hContact);
+ if (iUserId == VK_INVALID_USER || !IsOnline() || iUserId == VK_FEED_USER || isChatRoom(hContact))
+ return 1;
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.deleteConversation.json", true, &CVkProto::OnReceiveSmth, AsyncHttpRequest::rpLow)
+ << INT_PARAM("peer_id", iUserId));
+
+ return 0;
+}
+
INT_PTR __cdecl CVkProto::SvcGetAllServerHistoryForContact(WPARAM hContact, LPARAM)
{
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index d2b9d421ca..c89ccf4714 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -53,7 +53,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
CreateProtoService(PS_GETAVATARCAPS, &CVkProto::SvcGetAvatarCaps);
CreateProtoService(PS_GETMYAVATAR, &CVkProto::SvcGetMyAvatar);
CreateProtoService(PS_SET_LISTENINGTO, &CVkProto::SvcSetListeningTo);
-
+
HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
NETLIBUSER nlu = {};
@@ -82,6 +82,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
Chat_Register(&gcr);
CreateProtoService(PS_MENU_LOADHISTORY, &CVkProto::SvcGetAllServerHistoryForContact);
+ CreateProtoService(PS_EMPTY_SRV_HISTORY, &CVkProto::SvcEmptyServerHistory);
CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat);
CreateProtoService(PS_JOINCHAT, &CVkProto::OnJoinChat);
@@ -772,10 +773,10 @@ int CVkProto::GetInfo(MCONTACT hContact, int)
return 0;
}
-bool CVkProto::OnContactDeleted(MCONTACT hContact, uint32_t)
+bool CVkProto::OnContactDeleted(MCONTACT hContact, uint32_t flags)
{
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
- debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick.get());
+ debugLogW(L"CVkProto::OnContactDeleted %s %d", Clist_GetContactDisplayName(hContact), flags);
if (!Contact::OnList(hContact) || getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact))
return true;
@@ -784,20 +785,16 @@ bool CVkProto::OnContactDeleted(MCONTACT hContact, uint32_t)
if (iUserId == VK_INVALID_USER || iUserId == VK_FEED_USER)
return true;
- 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.get(), param->bDeleteDialog, param->bDeleteFromFriendlist);
- if (!(param->bDeleteDialog || param->bDeleteFromFriendlist))
+ if (!(flags & CDF_DEL_HISTORY || flags & CDF_DEL_CONTACT))
return true;
CMStringA code(FORMAT, "var userID=\"%d\";", iUserId);
- if (param->bDeleteDialog)
+ if (flags & CDF_DEL_HISTORY)
code += "API.messages.deleteConversation({\"peer_id\":userID});";
+
- if (param->bDeleteFromFriendlist)
+ if (flags & CDF_DEL_CONTACT && !getBool(hContact, "Auth", true))
code += "API.friends.delete({\"user_id\":userID});";
code += "return 1;";
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 739c82b8b4..4ea1440ed1 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -122,6 +122,7 @@ struct CVkProto : public PROTO<CVkProto>
INT_PTR __cdecl SvcGetAllServerHistoryForContact(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcGetAllServerHistory(WPARAM, LPARAM);
+ INT_PTR __cdecl SvcEmptyServerHistory(WPARAM, LPARAM);
//=====================================================================================