Static create_text_message_content.
GitOrigin-RevId: 9def379214c944dce0d42c2fcf08198a49ea1db5
This commit is contained in:
parent
c061da558b
commit
d5683ee224
@ -10168,7 +10168,7 @@ void MessagesManager::start_up() {
|
|||||||
m->random_y = get_random_y(message_id);
|
m->random_y = get_random_y(message_id);
|
||||||
m->message_id = message_id;
|
m->message_id = message_id;
|
||||||
m->date = G()->unix_time();
|
m->date = G()->unix_time();
|
||||||
m->content = make_unique<MessageText>(FormattedText{"text", vector<MessageEntity>()}, WebPageId());
|
m->content = create_text_message_content("text", {}, {});
|
||||||
|
|
||||||
m->have_previous = have_previous;
|
m->have_previous = have_previous;
|
||||||
m->have_next = have_next;
|
m->have_next = have_next;
|
||||||
@ -17110,6 +17110,11 @@ Result<InputMessageContent> MessagesManager::process_input_message_content(
|
|||||||
return std::move(content);
|
return std::move(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unique_ptr<MessageContent> MessagesManager::create_text_message_content(string text, vector<MessageEntity> entities,
|
||||||
|
WebPageId web_page_id) {
|
||||||
|
return make_unique<MessageText>(FormattedText{std::move(text), std::move(entities)}, web_page_id);
|
||||||
|
}
|
||||||
|
|
||||||
Result<InputMessageContent> MessagesManager::create_input_message_content(
|
Result<InputMessageContent> MessagesManager::create_input_message_content(
|
||||||
DialogId dialog_id, tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Td *td,
|
DialogId dialog_id, tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Td *td,
|
||||||
FormattedText caption, FileId file_id, PhotoSize thumbnail, vector<FileId> sticker_file_ids) {
|
FormattedText caption, FileId file_id, PhotoSize thumbnail, vector<FileId> sticker_file_ids) {
|
||||||
@ -18013,13 +18018,11 @@ Result<MessageId> MessagesManager::send_bot_start_message(UserId bot_user_id, Di
|
|||||||
text += bot_data.username;
|
text += bot_data.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<MessageEntity> text_entities;
|
||||||
|
text_entities.emplace_back(MessageEntity::Type::BotCommand, 0, narrow_cast<int32>(text.size()));
|
||||||
bool need_update_dialog_pos = false;
|
bool need_update_dialog_pos = false;
|
||||||
Message *m = get_message_to_send(
|
Message *m = get_message_to_send(d, MessageId(), false, false,
|
||||||
d, MessageId(), false, false,
|
create_text_message_content(text, std::move(text_entities), WebPageId()),
|
||||||
make_unique<MessageText>(
|
|
||||||
FormattedText{text, vector<MessageEntity>{MessageEntity(MessageEntity::Type::BotCommand, 0,
|
|
||||||
narrow_cast<int32>(text.size()))}},
|
|
||||||
WebPageId()),
|
|
||||||
&need_update_dialog_pos);
|
&need_update_dialog_pos);
|
||||||
|
|
||||||
send_update_new_message(d, m, true);
|
send_update_new_message(d, m, true);
|
||||||
@ -22633,7 +22636,7 @@ unique_ptr<MessageContent> MessagesManager::get_secret_message_content(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (media == nullptr) {
|
if (media == nullptr) {
|
||||||
return make_unique<MessageText>(FormattedText{std::move(message_text), std::move(entities)}, WebPageId());
|
return create_text_message_content(std::move(message_text), std::move(entities), WebPageId());
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 constructor_id = media->get_id();
|
int32 constructor_id = media->get_id();
|
||||||
@ -22641,7 +22644,7 @@ unique_ptr<MessageContent> MessagesManager::get_secret_message_content(
|
|||||||
if (constructor_id != secret_api::decryptedMessageMediaEmpty::ID) {
|
if (constructor_id != secret_api::decryptedMessageMediaEmpty::ID) {
|
||||||
LOG(INFO) << "Receive non-empty message text and media";
|
LOG(INFO) << "Receive non-empty message text and media";
|
||||||
} else {
|
} else {
|
||||||
return make_unique<MessageText>(FormattedText{std::move(message_text), std::move(entities)}, WebPageId());
|
return create_text_message_content(std::move(message_text), std::move(entities), WebPageId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22757,7 +22760,7 @@ unique_ptr<MessageContent> MessagesManager::get_secret_message_content(
|
|||||||
is_media_empty = true;
|
is_media_empty = true;
|
||||||
}
|
}
|
||||||
if (is_media_empty) {
|
if (is_media_empty) {
|
||||||
return make_unique<MessageText>(FormattedText{std::move(message_text), std::move(entities)}, WebPageId());
|
return create_text_message_content(std::move(message_text), std::move(entities), WebPageId());
|
||||||
}
|
}
|
||||||
switch (constructor_id) {
|
switch (constructor_id) {
|
||||||
case secret_api::decryptedMessageMediaPhoto::ID: {
|
case secret_api::decryptedMessageMediaPhoto::ID: {
|
||||||
|
@ -1984,6 +1984,9 @@ class MessagesManager : public Actor {
|
|||||||
FullMessageId on_get_message(MessageInfo &&message_info, bool from_update, bool is_channel_message,
|
FullMessageId on_get_message(MessageInfo &&message_info, bool from_update, bool is_channel_message,
|
||||||
bool have_previous, bool have_next, const char *source);
|
bool have_previous, bool have_next, const char *source);
|
||||||
|
|
||||||
|
static unique_ptr<MessageContent> create_text_message_content(string text, vector<MessageEntity> entities,
|
||||||
|
WebPageId web_page_id);
|
||||||
|
|
||||||
Result<InputMessageContent> process_input_message_content(
|
Result<InputMessageContent> process_input_message_content(
|
||||||
DialogId dialog_id, tl_object_ptr<td_api::InputMessageContent> &&input_message_content) const;
|
DialogId dialog_id, tl_object_ptr<td_api::InputMessageContent> &&input_message_content) const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user