Support invoice receipts in another chats.
This commit is contained in:
parent
9700529085
commit
3f1e91e7f4
@ -1737,13 +1737,13 @@ messageCustomServiceAction text:string = MessageContent;
|
|||||||
//@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score
|
//@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score
|
||||||
messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent;
|
messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent;
|
||||||
|
|
||||||
//@description A payment has been completed @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for the price of the product @total_amount Total price for the product, in the smallest units of the currency
|
//@description A payment has been completed @invoice_chat_id Identifier of the chat, containing the corresponding invoice message; 0 if unknown @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for the price of the product @total_amount Total price for the product, in the smallest units of the currency
|
||||||
messagePaymentSuccessful invoice_message_id:int53 currency:string total_amount:int53 = MessageContent;
|
messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 = MessageContent;
|
||||||
|
|
||||||
//@description A payment has been completed; for bots only @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for price of the product
|
//@description A payment has been completed; for bots only @invoice_chat_id Identifier of the chat, containing the corresponding invoice message; 0 if unknown @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for price of the product
|
||||||
//@total_amount Total price for the product, in the smallest units of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null
|
//@total_amount Total price for the product, in the smallest units of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null
|
||||||
//@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier
|
//@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier
|
||||||
messagePaymentSuccessfulBot invoice_message_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent;
|
messagePaymentSuccessfulBot invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent;
|
||||||
|
|
||||||
//@description A contact has registered with Telegram
|
//@description A contact has registered with Telegram
|
||||||
messageContactRegistered = MessageContent;
|
messageContactRegistered = MessageContent;
|
||||||
@ -3809,7 +3809,7 @@ getMessage chat_id:int53 message_id:int53 = Message;
|
|||||||
//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get
|
//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get
|
||||||
getMessageLocally chat_id:int53 message_id:int53 = Message;
|
getMessageLocally chat_id:int53 message_id:int53 = Message;
|
||||||
|
|
||||||
//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively
|
//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful/messagePaymentSuccessfulBot respectively
|
||||||
//@chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which to get
|
//@chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which to get
|
||||||
getRepliedMessage chat_id:int53 message_id:int53 = Message;
|
getRepliedMessage chat_id:int53 message_id:int53 = Message;
|
||||||
|
|
||||||
|
@ -482,6 +482,7 @@ class MessageInvoice : public MessageContent {
|
|||||||
|
|
||||||
class MessagePaymentSuccessful : public MessageContent {
|
class MessagePaymentSuccessful : public MessageContent {
|
||||||
public:
|
public:
|
||||||
|
DialogId invoice_dialog_id;
|
||||||
MessageId invoice_message_id;
|
MessageId invoice_message_id;
|
||||||
string currency;
|
string currency;
|
||||||
int64 total_amount = 0;
|
int64 total_amount = 0;
|
||||||
@ -494,8 +495,12 @@ class MessagePaymentSuccessful : public MessageContent {
|
|||||||
string provider_payment_charge_id;
|
string provider_payment_charge_id;
|
||||||
|
|
||||||
MessagePaymentSuccessful() = default;
|
MessagePaymentSuccessful() = default;
|
||||||
MessagePaymentSuccessful(MessageId invoice_message_id, string &¤cy, int64 total_amount)
|
MessagePaymentSuccessful(DialogId invoice_dialog_id, MessageId invoice_message_id, string &¤cy,
|
||||||
: invoice_message_id(invoice_message_id), currency(std::move(currency)), total_amount(total_amount) {
|
int64 total_amount)
|
||||||
|
: invoice_dialog_id(invoice_dialog_id)
|
||||||
|
, invoice_message_id(invoice_message_id)
|
||||||
|
, currency(std::move(currency))
|
||||||
|
, total_amount(total_amount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageContentType get_type() const override {
|
MessageContentType get_type() const override {
|
||||||
@ -905,6 +910,7 @@ static void store(const MessageContent *content, StorerT &storer) {
|
|||||||
bool has_provider_payment_charge_id = !m->provider_payment_charge_id.empty();
|
bool has_provider_payment_charge_id = !m->provider_payment_charge_id.empty();
|
||||||
bool has_invoice_message_id = m->invoice_message_id.is_valid();
|
bool has_invoice_message_id = m->invoice_message_id.is_valid();
|
||||||
bool is_correctly_stored = true;
|
bool is_correctly_stored = true;
|
||||||
|
bool has_invoice_dialog_id = m->invoice_dialog_id.is_valid();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(has_payload);
|
STORE_FLAG(has_payload);
|
||||||
STORE_FLAG(has_shipping_option_id);
|
STORE_FLAG(has_shipping_option_id);
|
||||||
@ -913,6 +919,7 @@ static void store(const MessageContent *content, StorerT &storer) {
|
|||||||
STORE_FLAG(has_provider_payment_charge_id);
|
STORE_FLAG(has_provider_payment_charge_id);
|
||||||
STORE_FLAG(has_invoice_message_id);
|
STORE_FLAG(has_invoice_message_id);
|
||||||
STORE_FLAG(is_correctly_stored);
|
STORE_FLAG(is_correctly_stored);
|
||||||
|
STORE_FLAG(has_invoice_dialog_id);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
store(m->currency, storer);
|
store(m->currency, storer);
|
||||||
store(m->total_amount, storer);
|
store(m->total_amount, storer);
|
||||||
@ -934,6 +941,9 @@ static void store(const MessageContent *content, StorerT &storer) {
|
|||||||
if (has_invoice_message_id) {
|
if (has_invoice_message_id) {
|
||||||
store(m->invoice_message_id, storer);
|
store(m->invoice_message_id, storer);
|
||||||
}
|
}
|
||||||
|
if (has_invoice_dialog_id) {
|
||||||
|
store(m->invoice_dialog_id, storer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageContentType::ContactRegistered:
|
case MessageContentType::ContactRegistered:
|
||||||
@ -1267,6 +1277,7 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
|||||||
bool has_provider_payment_charge_id;
|
bool has_provider_payment_charge_id;
|
||||||
bool has_invoice_message_id;
|
bool has_invoice_message_id;
|
||||||
bool is_correctly_stored;
|
bool is_correctly_stored;
|
||||||
|
bool has_invoice_dialog_id;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(has_payload);
|
PARSE_FLAG(has_payload);
|
||||||
PARSE_FLAG(has_shipping_option_id);
|
PARSE_FLAG(has_shipping_option_id);
|
||||||
@ -1275,6 +1286,7 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
|||||||
PARSE_FLAG(has_provider_payment_charge_id);
|
PARSE_FLAG(has_provider_payment_charge_id);
|
||||||
PARSE_FLAG(has_invoice_message_id);
|
PARSE_FLAG(has_invoice_message_id);
|
||||||
PARSE_FLAG(is_correctly_stored);
|
PARSE_FLAG(is_correctly_stored);
|
||||||
|
PARSE_FLAG(has_invoice_dialog_id);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
parse(m->currency, parser);
|
parse(m->currency, parser);
|
||||||
parse(m->total_amount, parser);
|
parse(m->total_amount, parser);
|
||||||
@ -1305,6 +1317,9 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
|||||||
if (has_invoice_message_id) {
|
if (has_invoice_message_id) {
|
||||||
parse(m->invoice_message_id, parser);
|
parse(m->invoice_message_id, parser);
|
||||||
}
|
}
|
||||||
|
if (has_invoice_dialog_id) {
|
||||||
|
parse(m->invoice_dialog_id, parser);
|
||||||
|
}
|
||||||
if (is_correctly_stored) {
|
if (is_correctly_stored) {
|
||||||
content = std::move(m);
|
content = std::move(m);
|
||||||
} else {
|
} else {
|
||||||
@ -2548,16 +2563,19 @@ MessageId get_message_content_pinned_message_id(const MessageContent *content) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageId get_message_content_replied_message_id(const MessageContent *content) {
|
FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content) {
|
||||||
switch (content->get_type()) {
|
switch (content->get_type()) {
|
||||||
case MessageContentType::PinMessage:
|
case MessageContentType::PinMessage:
|
||||||
return static_cast<const MessagePinMessage *>(content)->message_id;
|
return {dialog_id, static_cast<const MessagePinMessage *>(content)->message_id};
|
||||||
case MessageContentType::GameScore:
|
case MessageContentType::GameScore:
|
||||||
return static_cast<const MessageGameScore *>(content)->game_message_id;
|
return {dialog_id, static_cast<const MessageGameScore *>(content)->game_message_id};
|
||||||
case MessageContentType::PaymentSuccessful:
|
case MessageContentType::PaymentSuccessful: {
|
||||||
return static_cast<const MessagePaymentSuccessful *>(content)->invoice_message_id;
|
auto *m = static_cast<const MessagePaymentSuccessful *>(content);
|
||||||
|
auto reply_in_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
|
||||||
|
return {reply_in_dialog_id, m->invoice_message_id};
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return MessageId();
|
return FullMessageId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2705,8 +2723,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
if (old_->text.text != new_->text.text) {
|
if (old_->text.text != new_->text.text) {
|
||||||
if (need_message_changed_warning && need_message_text_changed_warning(old_, new_)) {
|
if (need_message_changed_warning && need_message_text_changed_warning(old_, new_)) {
|
||||||
LOG(ERROR) << "Message text has changed from "
|
LOG(ERROR) << "Message text has changed from "
|
||||||
<< to_string(get_message_content_object(old_content, td, -1, false)) << ". New content is "
|
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false))
|
||||||
<< to_string(get_message_content_object(new_content, td, -1, false));
|
<< ". New content is "
|
||||||
|
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false));
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -2716,8 +2735,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
old_->text.entities.size() <= MAX_CUSTOM_ENTITIES_COUNT &&
|
old_->text.entities.size() <= MAX_CUSTOM_ENTITIES_COUNT &&
|
||||||
need_message_entities_changed_warning(old_->text.entities, new_->text.entities)) {
|
need_message_entities_changed_warning(old_->text.entities, new_->text.entities)) {
|
||||||
LOG(WARNING) << "Entities has changed from "
|
LOG(WARNING) << "Entities has changed from "
|
||||||
<< to_string(get_message_content_object(old_content, td, -1, false)) << ". New content is "
|
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false))
|
||||||
<< to_string(get_message_content_object(new_content, td, -1, false));
|
<< ". New content is "
|
||||||
|
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false));
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3065,9 +3085,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
case MessageContentType::PaymentSuccessful: {
|
case MessageContentType::PaymentSuccessful: {
|
||||||
auto old_ = static_cast<const MessagePaymentSuccessful *>(old_content);
|
auto old_ = static_cast<const MessagePaymentSuccessful *>(old_content);
|
||||||
auto new_ = static_cast<const MessagePaymentSuccessful *>(new_content);
|
auto new_ = static_cast<const MessagePaymentSuccessful *>(new_content);
|
||||||
if (old_->invoice_message_id != new_->invoice_message_id || old_->currency != new_->currency ||
|
if (old_->invoice_dialog_id != new_->invoice_dialog_id || old_->invoice_message_id != new_->invoice_message_id ||
|
||||||
old_->total_amount != new_->total_amount || old_->invoice_payload != new_->invoice_payload ||
|
old_->currency != new_->currency || old_->total_amount != new_->total_amount ||
|
||||||
old_->shipping_option_id != new_->shipping_option_id ||
|
old_->invoice_payload != new_->invoice_payload || old_->shipping_option_id != new_->shipping_option_id ||
|
||||||
old_->telegram_payment_charge_id != new_->telegram_payment_charge_id ||
|
old_->telegram_payment_charge_id != new_->telegram_payment_charge_id ||
|
||||||
old_->provider_payment_charge_id != new_->provider_payment_charge_id ||
|
old_->provider_payment_charge_id != new_->provider_payment_charge_id ||
|
||||||
((old_->order_info != nullptr || new_->order_info != nullptr) &&
|
((old_->order_info != nullptr || new_->order_info != nullptr) &&
|
||||||
@ -4187,7 +4207,8 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<telegram_api::MessageAction> &&action,
|
unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<telegram_api::MessageAction> &&action,
|
||||||
DialogId owner_dialog_id, MessageId reply_to_message_id) {
|
DialogId owner_dialog_id, DialogId reply_in_dialog_id,
|
||||||
|
MessageId reply_to_message_id) {
|
||||||
CHECK(action != nullptr);
|
CHECK(action != nullptr);
|
||||||
|
|
||||||
switch (action->get_id()) {
|
switch (action->get_id()) {
|
||||||
@ -4283,6 +4304,12 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
return td::make_unique<MessageChannelMigrateFrom>(std::move(channel_migrate_from->title_), chat_id);
|
return td::make_unique<MessageChannelMigrateFrom>(std::move(channel_migrate_from->title_), chat_id);
|
||||||
}
|
}
|
||||||
case telegram_api::messageActionPinMessage::ID: {
|
case telegram_api::messageActionPinMessage::ID: {
|
||||||
|
if (reply_in_dialog_id.is_valid() && reply_in_dialog_id != owner_dialog_id) {
|
||||||
|
LOG(ERROR) << "Receive pinned message with " << reply_to_message_id << " in " << owner_dialog_id
|
||||||
|
<< " in another " << reply_in_dialog_id;
|
||||||
|
reply_to_message_id = MessageId();
|
||||||
|
reply_in_dialog_id = DialogId();
|
||||||
|
}
|
||||||
if (!reply_to_message_id.is_valid()) {
|
if (!reply_to_message_id.is_valid()) {
|
||||||
// possible in basic groups
|
// possible in basic groups
|
||||||
LOG(INFO) << "Receive pinned message with " << reply_to_message_id << " in " << owner_dialog_id;
|
LOG(INFO) << "Receive pinned message with " << reply_to_message_id << " in " << owner_dialog_id;
|
||||||
@ -4291,6 +4318,12 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
return make_unique<MessagePinMessage>(reply_to_message_id);
|
return make_unique<MessagePinMessage>(reply_to_message_id);
|
||||||
}
|
}
|
||||||
case telegram_api::messageActionGameScore::ID: {
|
case telegram_api::messageActionGameScore::ID: {
|
||||||
|
if (reply_in_dialog_id.is_valid() && reply_in_dialog_id != owner_dialog_id) {
|
||||||
|
LOG(ERROR) << "Receive game score with " << reply_to_message_id << " in " << owner_dialog_id << " in another "
|
||||||
|
<< reply_in_dialog_id;
|
||||||
|
reply_to_message_id = MessageId();
|
||||||
|
reply_in_dialog_id = DialogId();
|
||||||
|
}
|
||||||
if (!reply_to_message_id.is_valid()) {
|
if (!reply_to_message_id.is_valid()) {
|
||||||
// possible in basic groups
|
// possible in basic groups
|
||||||
LOG(INFO) << "Receive game score with " << reply_to_message_id << " in " << owner_dialog_id;
|
LOG(INFO) << "Receive game score with " << reply_to_message_id << " in " << owner_dialog_id;
|
||||||
@ -4318,8 +4351,8 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
reply_to_message_id = MessageId();
|
reply_to_message_id = MessageId();
|
||||||
}
|
}
|
||||||
auto payment_sent = move_tl_object_as<telegram_api::messageActionPaymentSent>(action);
|
auto payment_sent = move_tl_object_as<telegram_api::messageActionPaymentSent>(action);
|
||||||
return td::make_unique<MessagePaymentSuccessful>(reply_to_message_id, std::move(payment_sent->currency_),
|
return td::make_unique<MessagePaymentSuccessful>(reply_in_dialog_id, reply_to_message_id,
|
||||||
payment_sent->total_amount_);
|
std::move(payment_sent->currency_), payment_sent->total_amount_);
|
||||||
}
|
}
|
||||||
case telegram_api::messageActionPaymentSentMe::ID: {
|
case telegram_api::messageActionPaymentSentMe::ID: {
|
||||||
LOG_IF(ERROR, !td->auth_manager_->is_bot()) << "Receive MessageActionPaymentSentMe in " << owner_dialog_id;
|
LOG_IF(ERROR, !td->auth_manager_->is_bot()) << "Receive MessageActionPaymentSentMe in " << owner_dialog_id;
|
||||||
@ -4328,8 +4361,8 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
reply_to_message_id = MessageId();
|
reply_to_message_id = MessageId();
|
||||||
}
|
}
|
||||||
auto payment_sent = move_tl_object_as<telegram_api::messageActionPaymentSentMe>(action);
|
auto payment_sent = move_tl_object_as<telegram_api::messageActionPaymentSentMe>(action);
|
||||||
auto result = td::make_unique<MessagePaymentSuccessful>(reply_to_message_id, std::move(payment_sent->currency_),
|
auto result = td::make_unique<MessagePaymentSuccessful>(
|
||||||
payment_sent->total_amount_);
|
reply_in_dialog_id, reply_to_message_id, std::move(payment_sent->currency_), payment_sent->total_amount_);
|
||||||
result->invoice_payload = payment_sent->payload_.as_slice().str();
|
result->invoice_payload = payment_sent->payload_.as_slice().str();
|
||||||
result->shipping_option_id = std::move(payment_sent->shipping_option_id_);
|
result->shipping_option_id = std::move(payment_sent->shipping_option_id_);
|
||||||
result->order_info = get_order_info(std::move(payment_sent->info_));
|
result->order_info = get_order_info(std::move(payment_sent->info_));
|
||||||
@ -4425,7 +4458,8 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
||||||
int32 message_date, bool is_content_secret) {
|
DialogId dialog_id, int32 message_date,
|
||||||
|
bool is_content_secret) {
|
||||||
CHECK(content != nullptr);
|
CHECK(content != nullptr);
|
||||||
switch (content->get_type()) {
|
switch (content->get_type()) {
|
||||||
case MessageContentType::Animation: {
|
case MessageContentType::Animation: {
|
||||||
@ -4570,13 +4604,15 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
case MessageContentType::PaymentSuccessful: {
|
case MessageContentType::PaymentSuccessful: {
|
||||||
const MessagePaymentSuccessful *m = static_cast<const MessagePaymentSuccessful *>(content);
|
const MessagePaymentSuccessful *m = static_cast<const MessagePaymentSuccessful *>(content);
|
||||||
|
auto invoice_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
|
||||||
if (td->auth_manager_->is_bot()) {
|
if (td->auth_manager_->is_bot()) {
|
||||||
return make_tl_object<td_api::messagePaymentSuccessfulBot>(
|
return make_tl_object<td_api::messagePaymentSuccessfulBot>(
|
||||||
m->invoice_message_id.get(), m->currency, m->total_amount, m->invoice_payload, m->shipping_option_id,
|
invoice_dialog_id.get(), m->invoice_message_id.get(), m->currency, m->total_amount, m->invoice_payload,
|
||||||
get_order_info_object(m->order_info), m->telegram_payment_charge_id, m->provider_payment_charge_id);
|
m->shipping_option_id, get_order_info_object(m->order_info), m->telegram_payment_charge_id,
|
||||||
|
m->provider_payment_charge_id);
|
||||||
} else {
|
} else {
|
||||||
return make_tl_object<td_api::messagePaymentSuccessful>(m->invoice_message_id.get(), m->currency,
|
return make_tl_object<td_api::messagePaymentSuccessful>(invoice_dialog_id.get(), m->invoice_message_id.get(),
|
||||||
m->total_amount);
|
m->currency, m->total_amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MessageContentType::ContactRegistered:
|
case MessageContentType::ContactRegistered:
|
||||||
@ -5124,8 +5160,11 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
|
|||||||
break;
|
break;
|
||||||
case MessageContentType::Call:
|
case MessageContentType::Call:
|
||||||
break;
|
break;
|
||||||
case MessageContentType::PaymentSuccessful:
|
case MessageContentType::PaymentSuccessful: {
|
||||||
|
auto content = static_cast<const MessagePaymentSuccessful *>(message_content);
|
||||||
|
add_dialog_and_dependencies(dependencies, content->invoice_dialog_id);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MessageContentType::ContactRegistered:
|
case MessageContentType::ContactRegistered:
|
||||||
break;
|
break;
|
||||||
case MessageContentType::ExpiredPhoto:
|
case MessageContentType::ExpiredPhoto:
|
||||||
|
@ -130,7 +130,7 @@ int32 get_message_content_index_mask(const MessageContent *content, const Td *td
|
|||||||
|
|
||||||
MessageId get_message_content_pinned_message_id(const MessageContent *content);
|
MessageId get_message_content_pinned_message_id(const MessageContent *content);
|
||||||
|
|
||||||
MessageId get_message_content_replied_message_id(const MessageContent *content);
|
FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content);
|
||||||
|
|
||||||
vector<UserId> get_message_content_added_user_ids(const MessageContent *content);
|
vector<UserId> get_message_content_added_user_ids(const MessageContent *content);
|
||||||
|
|
||||||
@ -187,10 +187,12 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
|||||||
MessageContentDupType type, MessageCopyOptions &©_options);
|
MessageContentDupType type, MessageCopyOptions &©_options);
|
||||||
|
|
||||||
unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<telegram_api::MessageAction> &&action,
|
unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<telegram_api::MessageAction> &&action,
|
||||||
DialogId owner_dialog_id, MessageId reply_to_message_id);
|
DialogId owner_dialog_id, DialogId reply_in_dialog_id,
|
||||||
|
MessageId reply_to_message_id);
|
||||||
|
|
||||||
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
||||||
int32 message_date, bool is_content_secret);
|
DialogId dialog_id, int32 message_date,
|
||||||
|
bool is_content_secret);
|
||||||
|
|
||||||
const FormattedText *get_message_content_text(const MessageContent *content);
|
const FormattedText *get_message_content_text(const MessageContent *content);
|
||||||
|
|
||||||
|
@ -6653,9 +6653,10 @@ void MessagesManager::on_update_service_notification(tl_object_ptr<telegram_api:
|
|||||||
bool is_content_secret = is_secret_message_content(ttl, content->get_type());
|
bool is_content_secret = is_secret_message_content(ttl, content->get_type());
|
||||||
|
|
||||||
if ((update->flags_ & telegram_api::updateServiceNotification::POPUP_MASK) != 0) {
|
if ((update->flags_ & telegram_api::updateServiceNotification::POPUP_MASK) != 0) {
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(
|
||||||
td_api::make_object<td_api::updateServiceNotification>(
|
G()->td(), &Td::send_update,
|
||||||
update->type_, get_message_content_object(content.get(), td_, date, is_content_secret)));
|
td_api::make_object<td_api::updateServiceNotification>(
|
||||||
|
update->type_, get_message_content_object(content.get(), td_, owner_dialog_id, date, is_content_secret)));
|
||||||
}
|
}
|
||||||
if (has_date && is_user) {
|
if (has_date && is_user) {
|
||||||
Dialog *d = get_service_notifications_dialog();
|
Dialog *d = get_service_notifications_dialog();
|
||||||
@ -13331,10 +13332,23 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
|||||||
message_info.ttl_period = message->ttl_period_;
|
message_info.ttl_period = message->ttl_period_;
|
||||||
}
|
}
|
||||||
message_info.flags = message->flags_;
|
message_info.flags = message->flags_;
|
||||||
auto reply_to_message_id =
|
|
||||||
MessageId(ServerMessageId(message->reply_to_ == nullptr ? 0 : message->reply_to_->reply_to_msg_id_));
|
DialogId reply_in_dialog_id;
|
||||||
message_info.content =
|
MessageId reply_to_message_id;
|
||||||
get_action_message_content(td_, std::move(message->action_), message_info.dialog_id, reply_to_message_id);
|
if (message_info.reply_header != nullptr) {
|
||||||
|
reply_to_message_id = MessageId(ServerMessageId(message_info.reply_header->reply_to_msg_id_));
|
||||||
|
auto reply_to_peer_id = std::move(message_info.reply_header->reply_to_peer_id_);
|
||||||
|
if (reply_to_peer_id != nullptr) {
|
||||||
|
reply_in_dialog_id = DialogId(reply_to_peer_id);
|
||||||
|
if (!reply_in_dialog_id.is_valid()) {
|
||||||
|
LOG(ERROR) << "Receive reply in invalid " << to_string(reply_to_peer_id);
|
||||||
|
reply_to_message_id = MessageId();
|
||||||
|
reply_in_dialog_id = DialogId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message_info.content = get_action_message_content(td_, std::move(message->action_), message_info.dialog_id,
|
||||||
|
reply_in_dialog_id, reply_to_message_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -13437,7 +13451,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageId reply_to_message_id = message_info.reply_to_message_id;
|
MessageId reply_to_message_id = message_info.reply_to_message_id; // for secret messages
|
||||||
DialogId reply_in_dialog_id;
|
DialogId reply_in_dialog_id;
|
||||||
MessageId top_thread_message_id;
|
MessageId top_thread_message_id;
|
||||||
if (message_info.reply_header != nullptr) {
|
if (message_info.reply_header != nullptr) {
|
||||||
@ -13446,12 +13460,16 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
if (reply_to_peer_id != nullptr) {
|
if (reply_to_peer_id != nullptr) {
|
||||||
reply_in_dialog_id = DialogId(reply_to_peer_id);
|
reply_in_dialog_id = DialogId(reply_to_peer_id);
|
||||||
if (!reply_in_dialog_id.is_valid()) {
|
if (!reply_in_dialog_id.is_valid()) {
|
||||||
LOG(ERROR) << " Receive reply in invalid " << to_string(reply_to_peer_id);
|
LOG(ERROR) << "Receive reply in invalid " << to_string(reply_to_peer_id);
|
||||||
reply_to_message_id = MessageId();
|
reply_to_message_id = MessageId();
|
||||||
reply_in_dialog_id = DialogId();
|
reply_in_dialog_id = DialogId();
|
||||||
}
|
}
|
||||||
|
if (reply_in_dialog_id == dialog_id) {
|
||||||
|
reply_in_dialog_id = DialogId(); // just in case
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (reply_to_message_id.is_valid() && !td_->auth_manager_->is_bot() && !message_id.is_scheduled()) {
|
if (reply_to_message_id.is_valid() && !td_->auth_manager_->is_bot() && !message_id.is_scheduled() &&
|
||||||
|
!reply_in_dialog_id.is_valid()) {
|
||||||
if ((message_info.reply_header->flags_ & telegram_api::messageReplyHeader::REPLY_TO_TOP_ID_MASK) != 0) {
|
if ((message_info.reply_header->flags_ & telegram_api::messageReplyHeader::REPLY_TO_TOP_ID_MASK) != 0) {
|
||||||
top_thread_message_id = MessageId(ServerMessageId(message_info.reply_header->reply_to_top_id_));
|
top_thread_message_id = MessageId(ServerMessageId(message_info.reply_header->reply_to_top_id_));
|
||||||
} else if (!is_broadcast_channel(dialog_id)) {
|
} else if (!is_broadcast_channel(dialog_id)) {
|
||||||
@ -13581,8 +13599,8 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
if (!is_allowed_media_group_content(content_type)) {
|
if (!is_allowed_media_group_content(content_type)) {
|
||||||
LOG(ERROR) << "Receive media group identifier " << message_info.media_album_id << " in " << message_id << " from "
|
LOG(ERROR) << "Receive media group identifier " << message_info.media_album_id << " in " << message_id << " from "
|
||||||
<< dialog_id << " with content "
|
<< dialog_id << " with content "
|
||||||
<< oneline(to_string(
|
<< oneline(to_string(get_message_content_object(message->content.get(), td_, dialog_id, message->date,
|
||||||
get_message_content_object(message->content.get(), td_, message->date, is_content_secret)));
|
is_content_secret)));
|
||||||
} else {
|
} else {
|
||||||
message->media_album_id = message_info.media_album_id;
|
message->media_album_id = message_info.media_album_id;
|
||||||
}
|
}
|
||||||
@ -16755,10 +16773,10 @@ MessagesManager::Message *MessagesManager::get_message_force(FullMessageId full_
|
|||||||
}
|
}
|
||||||
|
|
||||||
FullMessageId MessagesManager::get_replied_message_id(DialogId dialog_id, const Message *m) {
|
FullMessageId MessagesManager::get_replied_message_id(DialogId dialog_id, const Message *m) {
|
||||||
auto message_id = get_message_content_replied_message_id(m->content.get());
|
auto full_message_id = get_message_content_replied_message_id(dialog_id, m->content.get());
|
||||||
if (message_id.is_valid()) {
|
if (full_message_id.get_message_id().is_valid()) {
|
||||||
CHECK(!m->reply_to_message_id.is_valid());
|
CHECK(!m->reply_to_message_id.is_valid());
|
||||||
return {dialog_id, message_id};
|
return full_message_id;
|
||||||
}
|
}
|
||||||
if (!m->reply_to_message_id.is_valid()) {
|
if (!m->reply_to_message_id.is_valid()) {
|
||||||
return {};
|
return {};
|
||||||
@ -22870,7 +22888,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
|||||||
get_message_interaction_info_object(dialog_id, m), reply_in_dialog_id.get(), reply_to_message_id,
|
get_message_interaction_info_object(dialog_id, m), reply_in_dialog_id.get(), reply_to_message_id,
|
||||||
top_thread_message_id, ttl, ttl_expires_in, via_bot_user_id, m->author_signature, media_album_id,
|
top_thread_message_id, ttl, ttl_expires_in, via_bot_user_id, m->author_signature, media_album_id,
|
||||||
get_restriction_reason_description(m->restriction_reasons),
|
get_restriction_reason_description(m->restriction_reasons),
|
||||||
get_message_content_object(m->content.get(), td_, live_location_date, m->is_content_secret),
|
get_message_content_object(m->content.get(), td_, dialog_id, live_location_date, m->is_content_secret),
|
||||||
get_reply_markup_object(m->reply_markup));
|
get_reply_markup_object(m->reply_markup));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24233,7 +24251,8 @@ void MessagesManager::do_send_message_group(int64 media_album_id) {
|
|||||||
<< file_view.has_alive_remote_location() << " " << file_view.has_active_upload_remote_location() << " "
|
<< file_view.has_alive_remote_location() << " " << file_view.has_active_upload_remote_location() << " "
|
||||||
<< file_view.has_active_download_remote_location() << " " << file_view.is_encrypted() << " " << is_web
|
<< file_view.has_active_download_remote_location() << " " << file_view.is_encrypted() << " " << is_web
|
||||||
<< " " << file_view.has_url() << " "
|
<< " " << file_view.has_url() << " "
|
||||||
<< to_string(get_message_content_object(m->content.get(), td_, m->date, m->is_content_secret));
|
<< to_string(
|
||||||
|
get_message_content_object(m->content.get(), td_, dialog_id, m->date, m->is_content_secret));
|
||||||
}
|
}
|
||||||
auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group");
|
auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group");
|
||||||
int32 input_single_media_flags = 0;
|
int32 input_single_media_flags = 0;
|
||||||
@ -28293,7 +28312,7 @@ void MessagesManager::send_update_message_content(DialogId dialog_id, MessageId
|
|||||||
LOG(INFO) << "Send updateMessageContent for " << message_id << " in " << dialog_id << " from " << source;
|
LOG(INFO) << "Send updateMessageContent for " << message_id << " in " << dialog_id << " from " << source;
|
||||||
LOG_CHECK(have_dialog(dialog_id)) << "Send updateMessageContent in unknown " << dialog_id << " from " << source
|
LOG_CHECK(have_dialog(dialog_id)) << "Send updateMessageContent in unknown " << dialog_id << " from " << source
|
||||||
<< " with load count " << loaded_dialogs_.count(dialog_id);
|
<< " with load count " << loaded_dialogs_.count(dialog_id);
|
||||||
auto content_object = get_message_content_object(content, td_, message_date, is_content_secret);
|
auto content_object = get_message_content_object(content, td_, dialog_id, message_date, is_content_secret);
|
||||||
send_closure(
|
send_closure(
|
||||||
G()->td(), &Td::send_update,
|
G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateMessageContent>(dialog_id.get(), message_id.get(), std::move(content_object)));
|
td_api::make_object<td_api::updateMessageContent>(dialog_id.get(), message_id.get(), std::move(content_object)));
|
||||||
@ -30572,7 +30591,8 @@ void MessagesManager::on_send_dialog_action_timeout(DialogId dialog_id) {
|
|||||||
auto file_id = get_message_content_upload_file_id(m->content.get());
|
auto file_id = get_message_content_upload_file_id(m->content.get());
|
||||||
if (!file_id.is_valid()) {
|
if (!file_id.is_valid()) {
|
||||||
LOG(ERROR) << "Have no file in "
|
LOG(ERROR) << "Have no file in "
|
||||||
<< to_string(get_message_content_object(m->content.get(), td_, m->date, m->is_content_secret));
|
<< to_string(
|
||||||
|
get_message_content_object(m->content.get(), td_, dialog_id, m->date, m->is_content_secret));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto file_view = td_->file_manager_->get_file_view(file_id);
|
auto file_view = td_->file_manager_->get_file_view(file_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user