summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/NewStory/src/history_menus.cpp15
-rw-r--r--protocols/Telegram/src/server.cpp5
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_);