2
0
mirror of https://github.com/ars3niy/tdlib-purple synced 2025-08-31 05:55:08 +00:00

Use dedicated function for conversation notification in one final place

This commit is contained in:
Arseniy Lartsev
2020-10-11 19:20:37 +02:00
parent 37dbe0ae3e
commit 2f7915e5d1
3 changed files with 14 additions and 8 deletions

View File

@@ -788,15 +788,12 @@ void notifySendFailed(const td::td_api::updateMessageSendFailed &sendFailed, TdA
if (sendFailed.message_) {
const td::td_api::chat *chat = account.getChat(getChatId(*sendFailed.message_));
if (chat) {
TgMessageInfo messageInfo;
messageInfo.type = TgMessageInfo::Type::Other;
messageInfo.timestamp = sendFailed.message_->date_;
messageInfo.outgoing = true;
std::string errorMessage = formatMessage(errorCodeMessage(), {std::to_string(sendFailed.error_code_),
sendFailed.error_message_});
// TRANSLATOR: In-chat error message, argument will be text.
errorMessage = formatMessage(_("Failed to send message: {}"), errorMessage);
showMessageText(account, *chat, messageInfo, NULL, errorMessage.c_str());
showChatNotification(account, *chat, errorMessage.c_str(), sendFailed.message_->date_,
(PurpleMessageFlags)0);
}
}
}