From 48696c608103ad2a5adac0e6280d96fa281d726e Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Sat, 31 Jan 2015 08:07:06 +0000 Subject: VKontakte: upgrade VK API version to 5.28 (friends.delete change) delete unneeded code UseNonStandardUrlEncode=true by default version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11964 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk.h | 2 +- protocols/VKontakte/src/vk_proto.cpp | 6 ++---- protocols/VKontakte/src/vk_thread.cpp | 33 ++++++++++++++++++--------------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 57af18735a..dd4a9a2ed0 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 0 -#define __BUILD_NUM 43 +#define __BUILD_NUM 44 #include diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 61addafec7..8f0a871185 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -65,7 +65,7 @@ along with this program. If not, see . #define VKERR_INVALID_FILENAME 301 // Invalid filename #define VKERR_INVALID_FILESIZE 302 // Invalid filesize -#define VK_API_VER "5.27" +#define VK_API_VER "5.28" #define VER_API CHAR_PARAM("v", VK_API_VER) #define VK_FEED_USER 2147483647L diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 11b87229fd..1ab60f23fa 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -107,7 +107,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNotificationFilterReposts = getBool("NotificationFilterComments", true); m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true); - m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", false); + m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true); // Set all contacts offline -- in case we crashed SetAllContactStatuses(ID_STATUS_OFFLINE); vk_Instances.insert(this); @@ -492,9 +492,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg) pReq << CHAR_PARAM("message", szMsg); pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded"); - do - pReq->pUserInfo = new CVkSendMsgParam(hContact, msgId); - while (pReq->pUserInfo == NULL && pReq->m_iRetry-- > 0); + pReq->pUserInfo = new CVkSendMsgParam(hContact, msgId); Push(pReq); if (!m_bServerDelivery) diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 0517840911..e59beeab19 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -1127,22 +1127,25 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST* reply, AsyncHttpRequest* if (tszNick.IsEmpty()) tszNick = TranslateT("(Unknown contact)"); CMString msgformat, msg; - int iRet = json_as_int(pResponse); - switch (iRet) { - case 1: - msgformat = TranslateT("User %s was deleted from your friend list"); - break; - case 2: - msgformat = TranslateT("Friend request from the user %s declined"); - break; - case 3: - msgformat = TranslateT("Friend request suggestion for the user %s deleted"); - break; - } - msg.AppendFormat(msgformat, tszNick); - MsgPopup(param->hContact, msg.GetBuffer(), tszNick.GetBuffer()); - setByte(param->hContact, "Auth", 1); + if (json_as_int(json_get(pResponse, "success"))) { + if (json_as_int(json_get(pResponse, "friend_deleted"))) + msgformat = TranslateT("User %s was deleted from your friend list"); + else if (json_as_int(json_get(pResponse, "out_request_deleted"))) + msgformat = TranslateT("Your request to the user %s was deleted"); + else if (json_as_int(json_get(pResponse, "in_request_deleted"))) + msgformat = TranslateT("Friend request from the user %s declined"); + else if (json_as_int(json_get(pResponse, "suggestion_deleted"))) + msgformat = TranslateT("Friend request suggestion for the user %s deleted"); + + msg.AppendFormat(msgformat, tszNick); + MsgPopup(param->hContact, msg.GetBuffer(), tszNick.GetBuffer()); + setByte(param->hContact, "Auth", 1); + } + else { + msg = TranslateT("User or request was not deleted"); + MsgPopup(param->hContact, msg.GetBuffer(), tszNick.GetBuffer()); + } } } delete param; -- cgit v1.2.3