diff --git a/README.md b/README.md index 33bcc531..16176022 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,7 @@ This configuration file holds general application settings. Default content: cache_enabled=1 coredump_enabled=0 downloads_dir= + link_send_preview=1 proxy_host= proxy_pass= proxy_port= @@ -295,6 +296,10 @@ Specifies whether to enable core dumps on application crash. Specifies a custom downloads directory path to save attachments to. If not specified, the default dir is `~/Downloads` if exists, otherwise `~`. +### link_send_preview + +Specifies whether to enable preview for links in messages sent (Telegram only). + ### proxy_ SOCKS5 proxy server details. To enable proxy usage the parameters `host` and diff --git a/lib/common/src/version.h b/lib/common/src/version.h index 72a72c58..09d60e6f 100644 --- a/lib/common/src/version.h +++ b/lib/common/src/version.h @@ -7,4 +7,4 @@ #pragma once -#define NCHAT_VERSION "4.92" +#define NCHAT_VERSION "4.93" diff --git a/lib/ncutil/src/appconfig.cpp b/lib/ncutil/src/appconfig.cpp index 2ea1b171..80b93a16 100644 --- a/lib/ncutil/src/appconfig.cpp +++ b/lib/ncutil/src/appconfig.cpp @@ -1,6 +1,6 @@ // appconfig.cpp // -// Copyright (c) 2021-2023 Kristofer Berggren +// Copyright (c) 2021-2024 Kristofer Berggren // All rights reserved. // // nchat is distributed under the MIT license, see LICENSE for details. @@ -23,6 +23,7 @@ void AppConfig::Init() { "cache_enabled", "1" }, { "coredump_enabled", "0" }, { "downloads_dir", "" }, + { "link_send_preview", "1" }, { "proxy_host", "" }, { "proxy_pass", "" }, { "proxy_port", "" }, diff --git a/lib/tgchat/src/tgchat.cpp b/lib/tgchat/src/tgchat.cpp index 5b97da1d..97deaad1 100644 --- a/lib/tgchat/src/tgchat.cpp +++ b/lib/tgchat/src/tgchat.cpp @@ -2971,6 +2971,12 @@ td::td_api::object_ptr TgChat::Impl::GetFormattedText td::td_api::object_ptr TgChat::Impl::GetMessageText(const std::string& p_Text) { auto message_content = td::td_api::make_object(); + + static const bool linkSendPreview = AppConfig::GetBool("link_send_preview"); + auto link_preview_options = td::td_api::make_object(); + link_preview_options->is_disabled_ = !linkSendPreview; + message_content->link_preview_options_ = std::move(link_preview_options); + message_content->text_ = GetFormattedText(p_Text); return message_content; } diff --git a/src/nchat.1 b/src/nchat.1 index 099fae66..01900211 100644 --- a/src/nchat.1 +++ b/src/nchat.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH NCHAT "1" "June 2024" "nchat v4.92" "User Commands" +.TH NCHAT "1" "June 2024" "nchat v4.93" "User Commands" .SH NAME nchat \- ncurses chat .SH SYNOPSIS