From 4f258796441a53b02dcf60daf13d0c6bd3cb2cdd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 6 Oct 2024 16:47:34 +0300 Subject: =?UTF-8?q?fixes=20#4712=20(Telegram:=20=D0=BE=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=8C=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=20=D1=81=D1=81=D1=8B=D0=BB?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BA=D0=B0=D0=BA=20=D1=86=D0=B8=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D1=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/utils.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index c1a648e35b..0db0a430cd 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -746,8 +746,13 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg ret = GetFormattedText(pText->text_); if (auto *pWeb = pText->link_preview_.get()) { - if (!pWeb->display_url_.empty() && m_bUrlPreview) - ret.AppendFormat("\r\n[url]%s[/url]", pWeb->display_url_.c_str()); + 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->type_->get_id() == TD::linkPreviewTypePhoto::ID) { auto *pPhoto = ((TD::linkPreviewTypePhoto *)pWeb->type_.get())->photo_.get(); @@ -760,11 +765,14 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg pSize = pPhoto->sizes_[0].get(); if (auto szText = GetMessagePreview(pSize->photo_.get())) - ret.AppendFormat("\r\n[img=%s][/img]", szText.c_str()); + szDescr.AppendFormat("[img=%s][/img]\r\n", szText.c_str()); } if (auto szText = GetFormattedText(pWeb->description_)) - ret.AppendFormat("\r\n%s", szText.c_str()); + szDescr.AppendFormat("%s\r\n", szText.c_str()); + + if (!szDescr.IsEmpty()) + ret += "\r\n[quote]" + szDescr.Trim() + "[/quote]"; } } break; -- cgit v1.2.3