diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-02-02 09:12:46 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-02-02 09:12:46 +0000 |
commit | 4b3935850e8e30e1d2a2d9d7c13296efc83db3de (patch) | |
tree | d52d7525612dd81e592b18ca3f7efa8d5729f5ea | |
parent | 2c8efde364e6dc3e3ad2da9e99b667c1b56c1585 (diff) |
VKontakte:
add ‘Mark messages as read’contact menuitem
add copy_history processing in wall attachment type
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@16211 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/VKontakte/res/resource.rc | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 25 | ||||
-rw-r--r-- | protocols/VKontakte/src/resource.h | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 9 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 3 |
7 files changed, 46 insertions, 2 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 861be3ab3c..e3b426487f 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -37,6 +37,7 @@ IDI_KEYS ICON "key.ico" IDI_BROADCAST ICON "broadcast.ico"
IDI_STATUS ICON "status.ico"
IDI_WALL ICON "wall.ico"
+IDI_MARKMESSAGESASREAD ICON "markread.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 8298b8de2c..eaf5ba5e44 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -69,7 +69,8 @@ static IconItem iconList[] = { LPGEN("Ban user icon"), "ban", IDI_BAN },
{ LPGEN("Broadcast icon"), "broadcast", IDI_BROADCAST },
{ LPGEN("Status icon"), "status", IDI_STATUS },
- { LPGEN("Wall message icon"), "wall", IDI_WALL }
+ { LPGEN("Wall message icon"), "wall", IDI_WALL },
+ { LPGEN("Mark messages as read icon"), "markread", IDI_MARKMESSAGESASREAD }
};
void InitIcons()
@@ -981,6 +982,28 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport res.AppendFormat(_T("%s: %s"),
SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszUrl),
tszText.IsEmpty() ? _T(" ") : tszText);
+
+ const JSONNode &jnCopyHystory = jnWall["copy_history"];
+ for (auto aCHit = jnCopyHystory.begin(); aCHit != jnCopyHystory.end(); ++aCHit) {
+ const JSONNode &jnCopyHystoryItem = (*aCHit);
+
+ CMString tszCHText(jnCopyHystoryItem["text"].as_mstring());
+ int iCHid = jnCopyHystoryItem["id"].as_int();
+ int iCHfromID = jnCopyHystoryItem["from_id"].as_int();
+ CMString tszCHUrl(FORMAT, _T("http://vk.com/wall%d_%d"), iCHfromID, iCHid);
+ tszCHText.Replace(_T("\n"), _T("\n\t\t"));
+ res.AppendFormat(_T("\n\t\t%s: %s"),
+ SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszCHUrl),
+ tszCHText.IsEmpty() ? _T(" ") : tszCHText);
+
+ const JSONNode &jnSubAttachments = jnCopyHystoryItem["attachments"];
+ if (jnSubAttachments) {
+ debugLogA("CVkProto::GetAttachmentDescr SubAttachments");
+ CMString tszAttachmentDescr = GetAttachmentDescr(jnSubAttachments, iBBC);
+ tszAttachmentDescr.Replace(_T("\n"), _T("\n\t\t"));
+ res += _T("\n\t\t") + tszAttachmentDescr;
+ }
+ }
const JSONNode &jnSubAttachments = jnWall["attachments"];
if (jnSubAttachments) {
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index d08a099670..ea71a9574b 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -22,6 +22,7 @@ #define IDI_STATUS 119
#define IDD_WALLPOST 120
#define IDI_WALL 121
+#define IDI_MARKMESSAGESASREAD 122
#define IDI_KEYS 203
#define IDC_LOGIN 1001
#define IDC_PASSWORD 1002
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index efb9fd6997..613d6cab93 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 1
-#define __BUILD_NUM 21
+#define __BUILD_NUM 22
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 4cd91154e2..55eedb5a70 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -146,6 +146,13 @@ int CVkProto::OnDbEventRead(WPARAM, LPARAM hDbEvent) return 0;
}
+INT_PTR CVkProto::SvcMarkMessagesAsRead(WPARAM hContact, LPARAM)
+{
+ MarkDialogAsRead(hContact);
+ MarkMessagesRead(hContact);
+ return 0;
+}
+
void CVkProto::MarkMessagesRead(const CMStringA &mids)
{
debugLogA("CVkProto::MarkMessagesRead (mids)");
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 4c2e0d3e5c..47dbcfa572 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -212,6 +212,7 @@ void CVkProto::InitMenus() CreateProtoService(PS_WIPENONFRIENDS, &CVkProto::SvcWipeNonFriendContacts);
CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
CreateProtoService(PS_WALLPOST, &CVkProto::SvcWallPost);
+ CreateProtoService(PS_MARKMESSAGESASREAD, &CVkProto::SvcMarkMessagesAsRead);
CMenuItem mi;
mi.root = Menu_GetProtocolRoot(this);
@@ -268,6 +269,13 @@ void CVkProto::InitMenus() mi.name.t = LPGENT("Visit profile");
SET_UID(mi, 0x828cc50e, 0x398d, 0x43a2, 0xbf, 0xd3, 0xa9, 0x96, 0x47, 0x9d, 0x52, 0xff);
g_hContactMenuItems[CMI_VISITPROFILE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+
+ mi.pszService = PS_MARKMESSAGESASREAD;
+ mi.position = -200001000 + CMI_MARKMESSAGESASREAD;
+ mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_MARKMESSAGESASREAD));
+ mi.name.t = LPGENT("Mark messages as read");
+ SET_UID(mi, 0x2587a649, 0xe5d5, 0x4e90, 0x8b, 0x35, 0x81, 0x4c, 0xb1, 0x5, 0x94, 0x7);
+ g_hContactMenuItems[CMI_MARKMESSAGESASREAD] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_WALLPOST;
mi.position = -200001000 + CMI_WALLPOST;
@@ -384,6 +392,7 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) bool bisFriend = (getBool(hContact, "Auth", true) == 0);
bool bisBroadcast = !(IsEmpty(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
Menu_ShowItem(g_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
+ Menu_ShowItem(g_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
Menu_ShowItem(g_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
Menu_ShowItem(g_hContactMenuItems[CMI_ADDASFRIEND], !bisFriend && !isChatRoom(hContact) && userID != VK_FEED_USER);
Menu_ShowItem(g_hContactMenuItems[CMI_DELETEFRIEND], bisFriend && userID != VK_FEED_USER);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index e2dc15a43e..0f8c17e1a2 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -37,6 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PS_OPENBROADCAST "/OpenBroadcast"
#define PS_SETSTATUSMSG "/SetStatusMsg"
#define PS_WALLPOST "/WallPost"
+#define PS_MARKMESSAGESASREAD "/MarkMessagesAsRead"
#define MAXHISTORYMIDSPERONE 100
#define MAX_RETRIES 10
@@ -102,6 +103,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcDestroyKickChat(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcOpenBroadcast(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcWallPost(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl SvcMarkMessagesAsRead(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcSetStatusMsg(WPARAM, LPARAM);
//==== History Menus ==================================================================
@@ -287,6 +289,7 @@ private: enum CLMenuIndexes {
CMI_VISITPROFILE,
+ CMI_MARKMESSAGESASREAD,
CMI_WALLPOST,
CMI_ADDASFRIEND,
CMI_DELETEFRIEND,
|