From c4a013eb138c4fe3e181751ca5a5b596e5961dd4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Dec 2023 14:42:57 +0300 Subject: since Reply menu item does not depend on a protocol, it's moved to NewStory --- protocols/VKontakte/src/misc.cpp | 1 - protocols/VKontakte/src/resource.h | 1 - protocols/VKontakte/src/vk_proto.cpp | 69 ++++++++++++++---------------------- protocols/VKontakte/src/vk_proto.h | 1 - 4 files changed, 26 insertions(+), 46 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 885f270381..eed2b096c8 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -62,7 +62,6 @@ static IconItem iconList[] = { LPGEN("Status icon"), "status", IDI_STATUS }, { LPGEN("Wall message icon"), "wall", IDI_WALL }, { LPGEN("Mark messages as read icon"), "markread", IDI_MARKMESSAGESASREAD }, - { LPGEN("Reply icon"), "reply", IDI_REPLY }, { LPGEN("Forward icon"), "forward", IDI_FORWARD } }; diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 6dcb35d31d..a5f53ada9d 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -26,7 +26,6 @@ #define IDD_OPT_MENU 122 #define IDD_CONTACTDELETE 123 #define IDD_VKUSERFORM 124 -#define IDI_REPLY 125 #define IDI_FORWARD 126 #define IDC_LOGIN 1001 #define IDC_PASSWORD 1002 diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 0fb74bf1d9..9627f12be2 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -219,14 +219,9 @@ void CVkProto::InitMenus() mi.pszService = szServiceName; mi.hIcolibItem = g_plugin.getIconHandle(IDI_FORWARD); - mi.position = 10000000 + NSMI_FORWARD; + mi.position = NS_PROTO_MENU_POS + NSMI_FORWARD; mi.name.a = LPGEN("Forward"); m_hNewStoryMenuItems[NSMI_FORWARD] = Menu_AddNewStoryMenuItem(&mi, NSMI_FORWARD); - - mi.hIcolibItem = g_plugin.getIconHandle(IDI_REPLY); - mi.position = 10000000 + NSMI_REPLY; - mi.name.a = LPGEN("Reply"); - m_hNewStoryMenuItems[NSMI_REPLY] = Menu_AddNewStoryMenuItem(&mi, NSMI_REPLY); }; //Contact Menu Services @@ -423,13 +418,6 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) int CVkProto::OnPrebuildNSMenu(WPARAM hContact, LPARAM lParam) { Menu_ShowItem(m_hNewStoryMenuItems[NSMI_FORWARD], true); - - if (!Proto_IsProtoOnContact(hContact, m_szModuleName)) - Menu_ShowItem(m_hNewStoryMenuItems[NSMI_REPLY], false); - else { - auto* pDbei = (DB::EventInfo *)lParam; - Menu_ShowItem(m_hNewStoryMenuItems[NSMI_REPLY], mir_strlen(pDbei->szId) > 0 && !Contact::IsReadonly(hContact)); - } return 0; } @@ -441,36 +429,31 @@ INT_PTR CVkProto::SvcNSExecMenu(WPARAM iCommand, LPARAM pHandle) switch (iCommand) { case NSMI_FORWARD: - { - std::vector vIds = NS_GetSelection(HANDLE(pHandle)); - wchar_t wszMsg[2048] = L""; - if (auto* pDlg = NS_GetSrmm((HANDLE)pHandle)) - GetWindowText(pDlg->GetInput(), wszMsg, 2048); - - CVkUserListForm dlg( - this, - wszMsg, - TranslateT("Mark contacts for forwarding messages"), - TranslateT("Mark contacts you want to forward messages"), - TranslateT("Enter accompanying messages"), - 0 - ); - - if (!dlg.DoModal()) - break; - - if (!vIds.size()) - vIds.push_back(hCurrentEvent); - T2Utf pszMsg(dlg.wszMessage.c_str()); - for (auto &hContact : dlg.lContacts) - ForwardMsg((UINT_PTR)hContact, vIds, pszMsg); + { + std::vector vIds = NS_GetSelection(HANDLE(pHandle)); + wchar_t wszMsg[2048] = L""; + if (auto *pDlg = NS_GetSrmm((HANDLE)pHandle)) + GetWindowText(pDlg->GetInput(), wszMsg, 2048); + + CVkUserListForm dlg( + this, + wszMsg, + TranslateT("Mark contacts for forwarding messages"), + TranslateT("Mark contacts you want to forward messages"), + TranslateT("Enter accompanying messages"), + 0 + ); + + if (!dlg.DoModal()) + break; - } - break; - case NSMI_REPLY: - if (auto* pDlg = NS_GetSrmm((HANDLE)pHandle)) - pDlg->SetQuoteEvent(hCurrentEvent); - + if (!vIds.size()) + vIds.push_back(hCurrentEvent); + T2Utf pszMsg(dlg.wszMessage.c_str()); + for (auto &hContact : dlg.lContacts) + ForwardMsg((UINT_PTR)hContact, vIds, pszMsg); + + } break; } return 0; @@ -610,7 +593,7 @@ INT_PTR CVkProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4: return PF4_AVATARS | PF4_SUPPORTTYPING | PF4_NOAUTHDENYREASON | PF4_IMSENDOFFLINE - | PF4_OFFLINEFILES | PF4_READNOTIFY | PF4_GROUPCHATFILES | PF4_SERVERMSGID; + | PF4_OFFLINEFILES | PF4_READNOTIFY | PF4_GROUPCHATFILES | PF4_SERVERMSGID | PF4_REPLY; case PFLAG_MAXLENOFMESSAGE: return 4096; diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index d71bf32576..ca061083c6 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -195,7 +195,6 @@ private: enum NewStoryMenuIndexes { NSMI_FORWARD, - NSMI_REPLY, NSMI_COUNT }; -- cgit v1.2.3