summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-07 14:42:57 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-07 14:42:57 +0300
commitc4a013eb138c4fe3e181751ca5a5b596e5961dd4 (patch)
treedcd9c18e39aa8c19c049cab4aad7fdd5c21036fe /protocols
parentf45c6111f5b86d327e30b3709c92321248534398 (diff)
since Reply menu item does not depend on a protocol, it's moved to NewStory
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/res/reply.icobin4286 -> 0 bytes
-rw-r--r--protocols/Telegram/res/resource.rc3
-rw-r--r--protocols/Telegram/src/main.cpp1
-rw-r--r--protocols/Telegram/src/menus.cpp21
-rw-r--r--protocols/Telegram/src/proto.cpp2
-rw-r--r--protocols/Telegram/src/proto.h2
-rw-r--r--protocols/Telegram/src/resource.h1
-rw-r--r--protocols/VKontakte/res/reply.icobin4286 -> 0 bytes
-rw-r--r--protocols/VKontakte/res/resource.rc2
-rw-r--r--protocols/VKontakte/src/misc.cpp1
-rw-r--r--protocols/VKontakte/src/resource.h1
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp69
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
13 files changed, 31 insertions, 73 deletions
diff --git a/protocols/Telegram/res/reply.ico b/protocols/Telegram/res/reply.ico
deleted file mode 100644
index 16cbee7a06..0000000000
--- a/protocols/Telegram/res/reply.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Telegram/res/resource.rc b/protocols/Telegram/res/resource.rc
index 2dea61f66b..23ea531835 100644
--- a/protocols/Telegram/res/resource.rc
+++ b/protocols/Telegram/res/resource.rc
@@ -179,9 +179,6 @@ IDI_REACTION ICON "reaction.ico"
IDI_BOT ICON "bot.ico"
-IDI_REPLY ICON "reply.ico"
-
-
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
diff --git a/protocols/Telegram/src/main.cpp b/protocols/Telegram/src/main.cpp
index 348a58e0cd..411a286ffc 100644
--- a/protocols/Telegram/src/main.cpp
+++ b/protocols/Telegram/src/main.cpp
@@ -43,7 +43,6 @@ static IconItem iconList[] =
{ LPGEN("Telegram Premium user"), "premuim", IDI_PREMIUM },
{ LPGEN("Forward"), "forward", IDI_FORWARD },
{ LPGEN("Reaction"), "reaction", IDI_REACTION },
- { LPGEN("Reply"), "reply", IDI_REPLY },
{ LPGEN("Bot"), "bot", IDI_BOT },
};
diff --git a/protocols/Telegram/src/menus.cpp b/protocols/Telegram/src/menus.cpp
index ac87355f29..ded59ff5ed 100644
--- a/protocols/Telegram/src/menus.cpp
+++ b/protocols/Telegram/src/menus.cpp
@@ -30,7 +30,7 @@ void CTelegramProto::InitMenus()
CMenuItem mi(&g_plugin);
mi.pszService = szServiceName;
- mi.position = 10000000;
+ mi.position = NS_PROTO_MENU_POS;
mi.hIcolibItem = g_plugin.getIconHandle(IDI_FORWARD);
mi.name.a = LPGEN("Forward");
hmiForward = Menu_AddNewStoryMenuItem(&mi, 1);
@@ -39,25 +39,16 @@ void CTelegramProto::InitMenus()
mi.hIcolibItem = g_plugin.getIconHandle(IDI_REACTION);
mi.name.a = LPGEN("Reaction");
hmiReaction = Menu_AddNewStoryMenuItem(&mi, 2);
-
- mi.position++;
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_REPLY);
- mi.name.a = LPGEN("Reply");
- hmiReply = Menu_AddNewStoryMenuItem(&mi, 3);
}
-int CTelegramProto::OnPrebuildNSMenu(WPARAM hContact, LPARAM lParam)
+int CTelegramProto::OnPrebuildNSMenu(WPARAM hContact, LPARAM)
{
if (!Proto_IsProtoOnContact(hContact, m_szModuleName)) {
Menu_ShowItem(hmiForward, false);
Menu_ShowItem(hmiReaction, false);
- Menu_ShowItem(hmiReply, false);
}
else {
- auto *pDbei = (DB::EventInfo *)lParam;
-
- Menu_ShowItem(hmiForward, getByte("Protected"));
- Menu_ShowItem(hmiReply, mir_strlen(pDbei->szId) > 0 && !Contact::IsReadonly(hContact));
+ Menu_ShowItem(hmiForward, 0 == getByte(hContact, "Protected"));
auto *pUser = FindUser(GetId(hContact));
Menu_ShowItem(hmiReaction, pUser && pUser->pReactions);
@@ -195,12 +186,6 @@ INT_PTR CTelegramProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle)
if (hCurrentEvent != -1)
CReactionsDlg(this, hCurrentEvent).DoModal();
break;
-
- case 3: // reply
- if (hCurrentEvent != -1)
- if (auto *pDlg = NS_GetSrmm((HANDLE)pHandle))
- pDlg->SetQuoteEvent(hCurrentEvent);
- break;
}
return 0;
}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index d23574b4e3..c7836d4e03 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -330,7 +330,7 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY;
case PFLAGNUM_4:
- return PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_SERVERMSGID;
+ return PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_SERVERMSGID | PF4_REPLY;
case PFLAGNUM_5:
return PF2_SHORTAWAY | PF2_LONGAWAY;
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 172024ccdf..8cf525801a 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -327,7 +327,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
MCONTACT GetRealContact(const TG_USER *pUser);
// Menus
- HGENMENU hmiForward, hmiReaction, hmiReply;
+ HGENMENU hmiForward, hmiReaction;
void InitMenus();
diff --git a/protocols/Telegram/src/resource.h b/protocols/Telegram/src/resource.h
index ed68daa9f4..dd6b5a8f0f 100644
--- a/protocols/Telegram/src/resource.h
+++ b/protocols/Telegram/src/resource.h
@@ -13,7 +13,6 @@
#define IDI_REACTION 108
#define IDD_REACTIONS 109
#define IDI_BOT 110
-#define IDI_REPLY 111
#define IDD_OPTIONS_SESSIONS 112
#define IDC_PHONE 1001
#define IDC_DEFGROUP 1002
diff --git a/protocols/VKontakte/res/reply.ico b/protocols/VKontakte/res/reply.ico
deleted file mode 100644
index 754a6324b3..0000000000
--- a/protocols/VKontakte/res/reply.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index 46b2720f1a..6121a986bf 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -49,8 +49,6 @@ IDI_WALL ICON "wall.ico"
IDI_MARKMESSAGESASREAD ICON "markread.ico"
-IDI_REPLY ICON "reply.ico"
-
IDI_FORWARD ICON "forward.ico"
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<MEVENT> 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<MEVENT> 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
};