Add "always_parse_markdown" option.
GitOrigin-RevId: d2eaef75272af9073fac5f49c37643cd544f43e8
This commit is contained in:
parent
8ca5e11e3f
commit
9c0f2b0b90
@ -6,6 +6,8 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/InputMessageText.h"
|
#include "td/telegram/InputMessageText.h"
|
||||||
|
|
||||||
|
#include "td/telegram/ConfigShared.h"
|
||||||
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/MessageEntity.h"
|
#include "td/telegram/MessageEntity.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
@ -37,10 +39,18 @@ Result<InputMessageText> process_input_message_text(const ContactsManager *conta
|
|||||||
}
|
}
|
||||||
|
|
||||||
TRY_RESULT(entities, get_message_entities(contacts_manager, std::move(input_message_text->text_->entities_)));
|
TRY_RESULT(entities, get_message_entities(contacts_manager, std::move(input_message_text->text_->entities_)));
|
||||||
TRY_STATUS(fix_formatted_text(input_message_text->text_->text_, entities, for_draft, false,
|
auto need_skip_commands = need_skip_bot_commands(contacts_manager, dialog_id, is_bot);
|
||||||
need_skip_bot_commands(contacts_manager, dialog_id, is_bot), for_draft));
|
bool parse_markdown = G()->shared_config().get_option_boolean("always_parse_markdown");
|
||||||
return InputMessageText{FormattedText{std::move(input_message_text->text_->text_), std::move(entities)},
|
TRY_STATUS(fix_formatted_text(input_message_text->text_->text_, entities, for_draft, parse_markdown,
|
||||||
|
need_skip_commands, for_draft));
|
||||||
|
InputMessageText result{FormattedText{std::move(input_message_text->text_->text_), std::move(entities)},
|
||||||
input_message_text->disable_web_page_preview_, input_message_text->clear_draft_};
|
input_message_text->disable_web_page_preview_, input_message_text->clear_draft_};
|
||||||
|
if (G()->shared_config().get_option_boolean("always_parse_markdown")) {
|
||||||
|
result.text = parse_markdown_v3(std::move(result.text));
|
||||||
|
fix_formatted_text(result.text.text, result.text.entities, for_draft, false, need_skip_commands, for_draft)
|
||||||
|
.ensure();
|
||||||
|
}
|
||||||
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object(const InputMessageText &input_message_text) {
|
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object(const InputMessageText &input_message_text) {
|
||||||
|
@ -6707,6 +6707,11 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
|||||||
|
|
||||||
bool is_bot = auth_manager_ != nullptr && auth_manager_->is_authorized() && auth_manager_->is_bot();
|
bool is_bot = auth_manager_ != nullptr && auth_manager_->is_authorized() && auth_manager_->is_bot();
|
||||||
switch (request.name_[0]) {
|
switch (request.name_[0]) {
|
||||||
|
case 'a':
|
||||||
|
if (set_boolean_option("always_parse_markdown")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (!is_bot && set_string_option("connection_parameters", [](Slice value) {
|
if (!is_bot && set_string_option("connection_parameters", [](Slice value) {
|
||||||
string value_copy = value.str();
|
string value_copy = value.str();
|
||||||
|
Loading…
Reference in New Issue
Block a user