From 64f73bebff3496ba0be306b6950f178c3d46404e Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 23 Dec 2019 19:01:47 +0300 Subject: [PATCH] Better message entities debug. GitOrigin-RevId: 05fea435da021773ca6fbb76e81680e4913cde51 --- td/telegram/MessageEntity.cpp | 7 +++++-- td/telegram/MessagesManager.cpp | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index cb0db377..953768c7 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -2670,11 +2670,14 @@ FormattedText get_message_text(const ContactsManager *contacts_manager, string m vector> &&server_entities, bool skip_new_entities, int32 send_date, const char *source) { auto entities = get_message_entities(contacts_manager, std::move(server_entities), source); + auto debug_message_text = message_text; + auto debug_entities = entities; auto status = fix_formatted_text(message_text, entities, true, skip_new_entities, true, false); if (status.is_error()) { if (send_date == 0 || send_date > 1497000000) { // approximate fix date - LOG(ERROR) << "Receive error " << status << " while parsing message from " << source << " with content \"" - << message_text << "\" sent at " << send_date << " with entities " << format::as_array(entities); + LOG(ERROR) << "Receive error " << status << " while parsing message text from " << source << " with content \"" + << debug_message_text << "\" -> \"" << message_text << "\" sent at " << send_date << " with entities " + << format::as_array(debug_entities) << " -> " << format::as_array(entities); } if (!clean_input_string(message_text)) { message_text.clear(); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0be87bae..0620beac 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -10954,11 +10954,13 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message( if (is_scheduled) { is_content_read = false; } + auto new_source = PSTRING() << FullMessageId(message_info.dialog_id, message_info.message_id) << " from " + << source; message_info.content = get_message_content( td_, get_message_text(td_->contacts_manager_.get(), std::move(message->message_), std::move(message->entities_), true, message_info.forward_header ? message_info.forward_header->date_ : message_info.date, - "parse_telegram_api_message"), + new_source.c_str()), std::move(message->media_), message_info.dialog_id, is_content_read, message_info.via_bot_user_id, &message_info.ttl); message_info.reply_markup =