diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/res/resource.rc | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/options.cpp | 6 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 8 |
5 files changed, 9 insertions, 13 deletions
diff --git a/protocols/Telegram/res/resource.rc b/protocols/Telegram/res/resource.rc index 748f43f55a..88de0a2305 100644 --- a/protocols/Telegram/res/resource.rc +++ b/protocols/Telegram/res/resource.rc @@ -97,7 +97,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,83,294,10
CONTROL "Compress files on send",IDC_COMPRESS_FILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,96,294,10
PUSHBUTTON "Log out",IDC_LOGOUT,212,168,86,14
- CONTROL "Generate URL previews",IDC_USE_PREVIEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,109,294,10
+ CONTROL "Include URL preview into message text",IDC_USE_PREVIEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,109,294,10
END
IDD_OPTIONS_ADV DIALOGEX 0, 0, 310, 86
diff --git a/protocols/Telegram/src/options.cpp b/protocols/Telegram/src/options.cpp index c89d8518e1..bb27acf95a 100644 --- a/protocols/Telegram/src/options.cpp +++ b/protocols/Telegram/src/options.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class COptionsDlg : public CTelegramDlgBase
{
CCtrlButton btnLogout;
- CCtrlCheck chkHideChats, chkUsePopups, chkCompressFiles, chkGenPreview;
+ CCtrlCheck chkHideChats, chkUsePopups, chkCompressFiles, chkIncludePreviews;
CCtrlCombo cmbCountry;
CCtrlEdit edtGroup, edtPhone, edtDeviceName;
ptrW m_wszOldGroup;
@@ -34,11 +34,11 @@ public: cmbCountry(this, IDC_COUNTRY),
chkUsePopups(this, IDC_POPUPS),
chkHideChats(this, IDC_HIDECHATS),
- chkGenPreview(this, IDC_USE_PREVIEW),
edtPhone(this, IDC_PHONE),
edtGroup(this, IDC_DEFGROUP),
edtDeviceName(this, IDC_DEVICE_NAME),
chkCompressFiles(this, IDC_COMPRESS_FILES),
+ chkIncludePreviews(this, IDC_USE_PREVIEW),
m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup))
{
CreateLink(edtPhone, ppro->m_szOwnPhone);
@@ -48,8 +48,8 @@ public: if (bFullDlg) {
CreateLink(chkUsePopups, ppro->m_bUsePopups);
- CreateLink(chkGenPreview, ppro->m_bUrlPreview);
CreateLink(chkCompressFiles, ppro->m_bCompressFiles);
+ CreateLink(chkIncludePreviews, ppro->m_bIncludePreviews);
}
btnLogout.OnClick = Callback(this, &COptionsDlg::onClick_Logout);
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 17c8e04cb7..403a40f686 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -55,9 +55,9 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : m_wszDeviceName(this, "DeviceName", L"Miranda NG"), m_wszDefaultGroup(this, "DefaultGroup", L"Telegram"), m_bUsePopups(this, "UsePopups", true), - m_bUrlPreview(this, "UrlPreview", true), m_bCompressFiles(this, "CompressFiles", true), - m_bHideGroupchats(this, "HideChats", true) + m_bHideGroupchats(this, "HideChats", true), + m_bIncludePreviews(this, "IncludePreview", true) { m_iOwnId = GetId(0); diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 4d76651b48..a2bebd4b71 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -442,7 +442,7 @@ public: CMOption<wchar_t*> m_wszDeviceName; // how do you see this session in Device List CMOption<bool> m_bHideGroupchats; // do not open chat windows on creation CMOption<bool> m_bUsePopups; - CMOption<bool> m_bUrlPreview; // embrace URLs into [url] tags + CMOption<bool> m_bIncludePreviews; // include URL previews into message text CMOption<bool> m_bCompressFiles; // embed pictures & videos into a message on send CMOption<uint32_t> m_iTimeDiff1; // set this status to m_iStatus1 after this interval of secs CMOption<uint32_t> m_iStatus1; diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 79fce40608..8cbed517a3 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -98,11 +98,6 @@ CMStringA CTelegramProto::GetFormattedText(TD::object_ptr<TD::formattedText> &pT case TD::textEntityTypeUnderline::ID: iCode = 3; break;
case TD::textEntityTypeCode::ID: iCode = 5; break;
case TD::textEntityTypeBlockQuote::ID: iCode = 6; break;
- case TD::textEntityTypeUrl::ID:
- if (!m_bUrlPreview)
- continue;
- iCode = 4;
- break;
default:
continue;
}
@@ -772,7 +767,8 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg if (auto *pText = ((TD::messageText *)pBody)) {
ret = GetFormattedText(pText->text_);
- if (auto *pWeb = pText->link_preview_.get()) {
+ auto *pWeb = pText->link_preview_.get();
+ if (pWeb && m_bIncludePreviews) {
CMStringA szDescr;
if (!pWeb->site_name_.empty())
|