summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_menus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-11-28 20:05:49 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-11-28 20:05:49 +0300
commit585c4d7595173e805523799b737bfd3044468fcd (patch)
tree136d89d55e406c6b154a02c41626cad37eecebd2 /plugins/NewStory/src/history_menus.cpp
parent55ca3854461d0a399b5fbfe7331e8eb5c8f6fbef (diff)
fixes #3975 (Telegram: невозможно просмотреть файл в канале, где копирование файлов запрещено)
Diffstat (limited to 'plugins/NewStory/src/history_menus.cpp')
-rw-r--r--plugins/NewStory/src/history_menus.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp
index e520ee636b..e1801d07f4 100644
--- a/plugins/NewStory/src/history_menus.cpp
+++ b/plugins/NewStory/src/history_menus.cpp
@@ -29,11 +29,18 @@ enum
static int hMenuObject;
static HANDLE hEventPreBuildMenu;
static HGENMENU hmiHistory, hmiOpenFolder, hmiCopyUrl, hmiSaveAs, hmiDownload, hmiQuote;
-static HGENMENU hmiEdit, hmiBookmark, hmiDelete;
+static HGENMENU hmiCopy, hmiCopyText, hmiEdit, hmiBookmark, hmiDelete;
HMENU NSMenu_Build(NewstoryListData *data, ItemData *item)
{
- Menu_ShowItem(hmiQuote, data->pMsgDlg != nullptr);
+ bool bNotProtected = true;
+ if (auto *szProto = Proto_GetBaseAccountName(item->hContact))
+ bNotProtected = db_get_b(item->hContact, szProto, "Protected") == 0;
+
+ Menu_ShowItem(hmiCopy, bNotProtected);
+ Menu_ShowItem(hmiCopyText, bNotProtected);
+
+ Menu_ShowItem(hmiQuote, bNotProtected && data->pMsgDlg != nullptr);
Menu_ShowItem(hmiSaveAs, false);
Menu_ShowItem(hmiCopyUrl, false);
Menu_ShowItem(hmiDownload, false);
@@ -224,11 +231,11 @@ void InitMenus()
mi.position = 100000;
mi.name.a = LPGEN("Copy");
- Menu_AddNewStoryMenuItem(&mi, MENU_COPY);
+ hmiCopy = Menu_AddNewStoryMenuItem(&mi, MENU_COPY);
mi.position++;
mi.name.a = LPGEN("Copy text");
- Menu_AddNewStoryMenuItem(&mi, MENU_COPYTEXT);
+ hmiCopyText = Menu_AddNewStoryMenuItem(&mi, MENU_COPYTEXT);
mi.position++;
mi.name.a = LPGEN("Copy URL");