summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-10-12 21:40:16 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-10-12 21:40:16 +0300
commitc93680973f803dde52de0669d05671ea4afe0cb3 (patch)
tree846bc35100e34b98227d19726289fbaa6d4329aa
parent70cf96fdda918321f2f90ffb9271d690cd55d011 (diff)
fixes #4727 (Telegram: предпросмотр ссылок содержит лишнюю информацию и не содержит более полезную)
-rw-r--r--protocols/Telegram/src/utils.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index 9ef0809d38..b0a71e8fcb 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -773,12 +773,15 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg
if (auto *pWeb = pText->link_preview_.get()) {
CMStringA szDescr;
- if (!pWeb->display_url_.empty())
- szDescr.AppendFormat("[b]%s[/b]\r\n", pWeb->display_url_.c_str());
-
if (!pWeb->site_name_.empty())
szDescr.AppendFormat("%s\r\n", pWeb->site_name_.c_str());
+ if (!pWeb->title_.empty())
+ szDescr.AppendFormat("[b]%s[/b]\r\n", pWeb->title_.c_str());
+
+ if (auto szText = GetFormattedText(pWeb->description_))
+ szDescr.AppendFormat("%s\r\n", szText.c_str());
+
if (pWeb->type_->get_id() == TD::linkPreviewTypePhoto::ID) {
auto *pPhoto = ((TD::linkPreviewTypePhoto *)pWeb->type_.get())->photo_.get();
const TD::photoSize *pSize = nullptr;
@@ -793,9 +796,6 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg
szDescr.AppendFormat("[img=%s][/img]\r\n", szText.c_str());
}
- if (auto szText = GetFormattedText(pWeb->description_))
- szDescr.AppendFormat("%s\r\n", szText.c_str());
-
if (!szDescr.IsEmpty())
ret += "\r\n[quote]" + szDescr.Trim() + "[/quote]";
}