2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Update API scheme.

This commit is contained in:
John Preston
2021-02-12 14:59:51 +04:00
parent 18d62c070d
commit 73ae29ae25
7 changed files with 30 additions and 17 deletions

View File

@@ -143,7 +143,10 @@ void ReportBox::report() {
return;
}
if (_reasonOtherText && _reasonOtherText->getLastText().trimmed().isEmpty()) {
const auto text = _reasonOtherText
? _reasonOtherText->getLastText().trimmed()
: QString();
if (_reasonOtherText && text.isEmpty()) {
_reasonOtherText->showError();
return;
}
@@ -155,7 +158,7 @@ void ReportBox::report() {
case Reason::Violence: return MTP_inputReportReasonViolence();
case Reason::ChildAbuse: return MTP_inputReportReasonChildAbuse();
case Reason::Pornography: return MTP_inputReportReasonPornography();
case Reason::Other: return MTP_inputReportReasonOther(MTP_string(_reasonOtherText->getLastText()));
case Reason::Other: return MTP_inputReportReasonOther();
}
Unexpected("Bad reason group value.");
}();
@@ -167,7 +170,8 @@ void ReportBox::report() {
_requestId = _api.request(MTPmessages_Report(
_peer->input,
MTP_vector<MTPint>(ids),
reason
reason,
MTP_string(text)
)).done([=](const MTPBool &result) {
reportDone(result);
}).fail([=](const RPCError &error) {
@@ -176,7 +180,8 @@ void ReportBox::report() {
} else {
_requestId = _api.request(MTPaccount_ReportPeer(
_peer->input,
reason
reason,
MTP_string(text)
)).done([=](const MTPBool &result) {
reportDone(result);
}).fail([=](const RPCError &error) {

View File

@@ -607,6 +607,7 @@ void Histories::deleteAllMessages(
}).send();
} else if (channel) {
return session().api().request(MTPchannels_DeleteHistory(
MTP_flags(0),
channel->inputChannel,
MTP_int(deleteTillId)
)).done([=](const MTPBool &result) {

View File

@@ -48,7 +48,8 @@ MTPMessage PrepareMessage(const MTPMessage &message, MsgId id) {
data.vpeer_id(),
data.vreply_to() ? *data.vreply_to() : MTPMessageReplyHeader(),
data.vdate(),
data.vaction());
data.vaction(),
MTP_int(data.vttl_period().value_or_empty()));
}, [&](const MTPDmessage &data) {
return MTP_message(
MTP_flags(data.vflags().v | MTPDmessage::Flag::f_from_scheduled),

View File

@@ -68,7 +68,8 @@ MTPMessage PrepareLogMessage(
}, [&](const MTPDmessageService &data) {
const auto removeFlags = MTPDmessageService::Flag::f_out
| MTPDmessageService::Flag::f_post
| MTPDmessageService::Flag::f_reply_to;
| MTPDmessageService::Flag::f_reply_to
| MTPDmessageService::Flag::f_ttl_period;
return MTP_messageService(
MTP_flags(data.vflags().v & ~removeFlags),
MTP_int(newId),
@@ -76,7 +77,8 @@ MTPMessage PrepareLogMessage(
data.vpeer_id(),
MTPMessageReplyHeader(),
MTP_int(newDate),
data.vaction());
data.vaction(),
MTPint()); // ttl_period
}, [&](const MTPDmessage &data) {
const auto removeFlags = MTPDmessage::Flag::f_out
| MTPDmessage::Flag::f_post

View File

@@ -487,7 +487,8 @@ void HistoryItem::applyEditionToHistoryCleared() {
peerToMTP(history()->peer->id),
MTPMessageReplyHeader(),
MTP_int(date()),
MTP_messageActionHistoryClear()
MTP_messageActionHistoryClear(),
MTPint() // ttl_period
).c_messageService());
}

View File

@@ -182,6 +182,7 @@ void AppConfig::dismissSuggestion(const QString &key) {
return;
}
_api->request(MTPhelp_DismissSuggestion(
MTP_inputPeerEmpty(),
MTP_string(key)
)).send();
}