diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-28 20:05:49 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-28 20:05:49 +0300 |
commit | 585c4d7595173e805523799b737bfd3044468fcd (patch) | |
tree | 136d89d55e406c6b154a02c41626cad37eecebd2 | |
parent | 55ca3854461d0a399b5fbfe7331e8eb5c8f6fbef (diff) |
fixes #3975 (Telegram: невозможно просмотреть файл в канале, где копирование файлов запрещено)
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 15 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 5 |
2 files changed, 16 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"); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index c3c9bd408c..d75b12792e 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -489,6 +489,11 @@ void CTelegramProto::ProcessChat(TD::updateNewChat *pObj) return;
if (pUser->hContact != INVALID_CONTACT_ID) {
+ if (pChat->has_protected_content_)
+ setByte(pUser->hContact, "Protected", 1);
+ else
+ delSetting(pUser->hContact, "Protected");
+
if (pChat->permissions_)
Contact::Readonly(hContact, !pChat->permissions_->can_send_basic_messages_);
|