Disallow accidental failing forwarding.

This commit is contained in:
John Preston 2019-07-17 17:46:12 +02:00
parent c50ade565a
commit 234b0ffcf0
2 changed files with 12 additions and 1 deletions

View file

@ -3224,7 +3224,11 @@ void HistoryWidget::stopRecording(bool send) {
}
void HistoryWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) { // replyTo != 0 from ReplyKeyboardMarkup, == 0 from cmd links
if (!_peer || _peer != peer) return;
if (!_peer || _peer != peer) {
return;
} else if (showSlowmodeError()) {
return;
}
bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, replyTo));

View file

@ -681,6 +681,13 @@ void MainWidget::cancelForwarding(not_null<History*> history) {
void MainWidget::finishForwarding(not_null<History*> history) {
auto toForward = history->validateForwardDraft();
if (!toForward.empty()) {
if (history->peer->slowmodeSecondsLeft()
|| (history->peer->slowmodeApplied()
&& (toForward.size() > 1
|| history->latestSendingMessage() != nullptr))) {
return;
}
auto options = ApiWrap::SendOptions(history);
session().api().forwardMessages(std::move(toForward), options);
cancelForwarding(history);