Fix dice unqouted forward to opened chat
This commit is contained in:
parent
1488e02ac5
commit
0e0b99e40c
3 changed files with 15 additions and 13 deletions
|
|
@ -229,7 +229,10 @@ void SendExistingPhoto(
|
||||||
forwarding);
|
forwarding);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SendDice(Api::MessageToSend &message, Fn<void()> doneCallback) {
|
bool SendDice(
|
||||||
|
Api::MessageToSend &message,
|
||||||
|
Fn<void()> doneCallback,
|
||||||
|
bool forwarding) {
|
||||||
const auto full = message.textWithTags.text.midRef(0).trimmed();
|
const auto full = message.textWithTags.text.midRef(0).trimmed();
|
||||||
auto length = 0;
|
auto length = 0;
|
||||||
if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length)
|
if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length)
|
||||||
|
|
@ -350,7 +353,9 @@ bool SendDice(Api::MessageToSend &message, Fn<void()> doneCallback) {
|
||||||
).send();
|
).send();
|
||||||
return history->sendRequestId;
|
return history->sendRequestId;
|
||||||
});
|
});
|
||||||
api->finishForwarding(message.action);
|
if (!forwarding) {
|
||||||
|
api->finishForwarding(message.action);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ void SendExistingPhoto(
|
||||||
Fn<void()> doneCallback = nullptr,
|
Fn<void()> doneCallback = nullptr,
|
||||||
bool forwarding = false);
|
bool forwarding = false);
|
||||||
|
|
||||||
bool SendDice(Api::MessageToSend &message, Fn<void()> doneCallback = nullptr);
|
bool SendDice(
|
||||||
|
Api::MessageToSend &message,
|
||||||
|
Fn<void()> doneCallback = nullptr,
|
||||||
|
bool forwarding = false);
|
||||||
|
|
||||||
void FillMessagePostFlags(
|
void FillMessagePostFlags(
|
||||||
const SendAction &action,
|
const SendAction &action,
|
||||||
|
|
|
||||||
|
|
@ -4063,20 +4063,15 @@ void ApiWrap::forwardMessagesUnquoted(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto message = ApiWrap::MessageToSend(history);
|
auto message = ApiWrap::MessageToSend(history);
|
||||||
message.textWithTags = TextWithTags{
|
message.textWithTags.text = dice->emoji();
|
||||||
dice->emoji(),
|
|
||||||
TextWithTags::Tags()
|
|
||||||
};
|
|
||||||
message.action.options = action.options;
|
message.action.options = action.options;
|
||||||
message.action.clearDraft = false;
|
message.action.clearDraft = false;
|
||||||
|
|
||||||
auto doneCallback = [=] () {
|
Api::SendDice(message, [=] {
|
||||||
if (shared && !--shared->requestsLeft) {
|
if (shared && !--shared->requestsLeft) {
|
||||||
shared->callback();
|
shared->callback();
|
||||||
}
|
}
|
||||||
};
|
}, true); // forwarding
|
||||||
|
|
||||||
SendDice(message, std::move(doneCallback));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto forwardMessageUnquoted = [&] (not_null<HistoryItem *> item) {
|
const auto forwardMessageUnquoted = [&] (not_null<HistoryItem *> item) {
|
||||||
|
|
@ -4104,8 +4099,7 @@ void ApiWrap::forwardMessagesUnquoted(
|
||||||
if (shared && !--shared->requestsLeft) {
|
if (shared && !--shared->requestsLeft) {
|
||||||
shared->callback();
|
shared->callback();
|
||||||
}
|
}
|
||||||
},
|
}, true); // forwarding
|
||||||
true); // forwarding
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto sendAccumulated = [&] {
|
const auto sendAccumulated = [&] {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue