summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-11-30 13:28:18 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-11-30 13:28:18 +0300
commit0bd330eedee899893ef921284a265d635d027f6b (patch)
treef295c3ca9950ba6cd01ca49439dbb89c745a751d
parent932c6454190cccc4a3dd26b42e439f26104df1dc (diff)
fixes #3991 (NewStory: доработка контекстного меню журнала)
-rw-r--r--plugins/NewStory/src/history_control.cpp22
-rw-r--r--plugins/NewStory/src/history_menus.cpp4
-rw-r--r--protocols/Telegram/src/avatars.cpp13
-rw-r--r--protocols/Telegram/src/proto.h1
4 files changed, 19 insertions, 21 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index d7f1217477..0f7fd29da9 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -436,22 +436,12 @@ CMStringW NewstoryListData::GatherSelected(bool bTextOnly)
if (!p->m_bSelected)
continue;
- if (p->m_bOfflineFile) {
- DB::EventInfo dbei(p->hEvent);
- DB::FILE_BLOB blob(dbei);
- if (p->m_bOfflineDownloaded)
- ret.Append(blob.getLocalName());
- else
- ret.Append(_A2T(blob.getUrl()));
- }
- else {
- if (bTextOnly)
- ret.Append(p->wtext);
- else { // copy text only
- CMStringW wszText(p->formatString());
- RemoveBbcodes(wszText);
- ret.Append(wszText);
- }
+ if (bTextOnly)
+ ret.Append(p->wtext);
+ else { // copy text only
+ CMStringW wszText(p->formatString());
+ RemoveBbcodes(wszText);
+ ret.Append(wszText);
}
ret.Append(L"\r\n");
}
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp
index 2404fa0a6b..607525a4db 100644
--- a/plugins/NewStory/src/history_menus.cpp
+++ b/plugins/NewStory/src/history_menus.cpp
@@ -52,8 +52,8 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item)
if (item->m_bOfflineFile) {
Menu_ModifyItem(hmiCopyUrl, (item->m_bOfflineDownloaded) ? TranslateT("Copy file path") : TranslateT("Copy URL"));
Menu_ShowItem(hmiCopyUrl, true);
- Menu_ShowItem(hmiSaveAs, true);
- Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded);
+ Menu_ShowItem(hmiSaveAs, bNotProtected);
+ Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded && bNotProtected);
Menu_ShowItem(hmiOpenFolder, item->m_bOfflineDownloaded);
}
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp
index e304fd6e0b..9f6e9e6436 100644
--- a/protocols/Telegram/src/avatars.cpp
+++ b/protocols/Telegram/src/avatars.cpp
@@ -97,19 +97,26 @@ void CTelegramProto::OnGetFileInfo(td::ClientManager::Response &response, void *
SendQuery(new TD::downloadFile(pFile->id_, 10, 0, 0, true));
}
+void CTelegramProto::OnGetFileLink(td::ClientManager::Response &response)
+{
+ if (!response.object)
+ return;
+
+}
+
void __cdecl CTelegramProto::OfflineFileThread(void *pParam)
{
auto *ofd = (OFDTHREAD *)pParam;
DB::EventInfo dbei(ofd->hDbEvent);
if (dbei && !strcmp(dbei.szModule, m_szModuleName) && dbei.eventType == EVENTTYPE_FILE) {
- JSONNode root = JSONNode::parse((const char *)dbei.pBlob);
- if (root) {
+ if (!ofd->bCopy) {
auto *ft = new TG_FILE_REQUEST(TG_FILE_REQUEST::FILE, 0, "");
ft->ofd = ofd;
m_arFiles.insert(ft);
- SendQuery(new TD::getRemoteFile(root["u"].as_string(), 0), &CTelegramProto::OnGetFileInfo, ft);
+ DB::FILE_BLOB blob(dbei);
+ SendQuery(new TD::getRemoteFile(blob.getUrl(), 0), &CTelegramProto::OnGetFileInfo, ft);
}
}
else delete ofd;
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index a88e1699b1..32cec7fa60 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -222,6 +222,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
void OnEndSession(td::ClientManager::Response &response);
void OnGetFileInfo(td::ClientManager::Response &response, void *pUserInfo);
+ void OnGetFileLink(td::ClientManager::Response &response);
void OnGetHistory(td::ClientManager::Response &response, void *pUserInfo);
void OnSendFile(td::ClientManager::Response &response, void *pUserInfo);
void OnSendMessage(td::ClientManager::Response &response);