Skip to content

Commit

Permalink
Minimal layer 72 support
Browse files Browse the repository at this point in the history
Compile fixes.

Based on upstream commit telegramdesktop/tdesktop@6ca105a
Closes #114.
  • Loading branch information
leha-bot committed Sep 14, 2018
1 parent 26b5a56 commit bcb8072
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/apiwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void ApiWrap::requestLastParticipants(ChannelData *channel, bool fromStart) {
auto requestId =
request(MTPchannels_GetParticipants(channel->inputChannel, MTP_channelParticipantsRecent(),
MTP_int(fromStart ? 0 : channel->mgInfo->lastParticipants.size()),
MTP_int(Global::ChatSizeMax())))
MTP_int(Global::ChatSizeMax()), MTP_int(0)))
.done([this, channel](const MTPchannels_ChannelParticipants &result, mtpRequestId requestId) {
lastParticipantsDone(channel, result, requestId);
})
Expand All @@ -605,7 +605,7 @@ void ApiWrap::requestBots(ChannelData *channel) {
}

auto requestId = request(MTPchannels_GetParticipants(channel->inputChannel, MTP_channelParticipantsBots(),
MTP_int(0), MTP_int(Global::ChatSizeMax())))
MTP_int(0), MTP_int(Global::ChatSizeMax()), MTP_int(0)))
.done([this, channel](const MTPchannels_ChannelParticipants &result, mtpRequestId requestId) {
lastParticipantsDone(channel, result, requestId);
})
Expand Down Expand Up @@ -1858,7 +1858,7 @@ void ApiWrap::jumpToDate(not_null<PeerData *> peer, const QDate &date) {
auto add_offset = -1;
auto limit = 1;
request(MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(offset_date), MTP_int(add_offset), MTP_int(limit),
MTP_int(0), MTP_int(0)))
MTP_int(0), MTP_int(0), MTP_int(0)))
.done([peer](const MTPmessages_Messages &result) {
auto getMessagesList = [&result, peer]() -> const QVector<MTPMessage> * {
auto handleMessages = [](auto &messages) {
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/send_files_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ void EditCaptionBox::onSave(bool ctrlShiftEnter) {
auto text = TextUtilities::PrepareForSending(_field->getLastText(), TextUtilities::PrepareTextOption::CheckLinks);
_saveRequestId =
MTP::send(MTPmessages_EditMessage(MTP_flags(flags), item->history()->peer->input, MTP_int(item->id),
MTP_string(text), MTPnullMarkup, sentEntities),
MTP_string(text), MTPnullMarkup, sentEntities, MTP_inputGeoPointEmpty()),
rpcDone(&EditCaptionBox::saveDone), rpcFail(&EditCaptionBox::saveFail));
}

Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/history/history_admin_log_inner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,9 @@ void InnerWidget::applySearch(const QString &query) {
}

void InnerWidget::requestAdmins() {
auto participantsHash = 0;
request(MTPchannels_GetParticipants(_channel->inputChannel, MTP_channelParticipantsAdmins(), MTP_int(0),
MTP_int(kMaxChannelAdmins)))
MTP_int(kMaxChannelAdmins), MTP_int(participantsHash)))
.done([this](const MTPchannels_ChannelParticipants &result) {
Expects(result.type() == mtpc_channels_channelParticipants);
auto &participants = result.c_channels_channelParticipants();
Expand Down
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/history/history_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ void HistoryWidget::firstLoadMessages() {

_firstLoadRequest =
MTP::send(MTPmessages_GetHistory(from->input, MTP_int(offset_id), MTP_int(0), MTP_int(offset),
MTP_int(loadCount), MTP_int(0), MTP_int(0)),
MTP_int(loadCount), MTP_int(0), MTP_int(0), MTP_int(0)),
rpcDone(&HistoryWidget::messagesReceived, from), rpcFail(&HistoryWidget::messagesFailed));
}

Expand All @@ -2629,7 +2629,7 @@ void HistoryWidget::loadMessages() {

_preloadRequest =
MTP::send(MTPmessages_GetHistory(from->peer->input, MTP_int(offset_id), MTP_int(0), MTP_int(offset),
MTP_int(loadCount), MTP_int(0), MTP_int(0)),
MTP_int(loadCount), MTP_int(0), MTP_int(0), MTP_int(0)),
rpcDone(&HistoryWidget::messagesReceived, from->peer), rpcFail(&HistoryWidget::messagesFailed));
}

Expand Down Expand Up @@ -2658,7 +2658,7 @@ void HistoryWidget::loadMessagesDown() {

_preloadDownRequest =
MTP::send(MTPmessages_GetHistory(from->peer->input, MTP_int(offset_id + 1), MTP_int(0), MTP_int(offset),
MTP_int(loadCount), MTP_int(0), MTP_int(0)),
MTP_int(loadCount), MTP_int(0), MTP_int(0), MTP_int(0)),
rpcDone(&HistoryWidget::messagesReceived, from->peer), rpcFail(&HistoryWidget::messagesFailed));
}

Expand Down Expand Up @@ -2698,7 +2698,7 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) {

_delayedShowAtRequest =
MTP::send(MTPmessages_GetHistory(from->input, MTP_int(offset_id), MTP_int(0), MTP_int(offset),
MTP_int(loadCount), MTP_int(0), MTP_int(0)),
MTP_int(loadCount), MTP_int(0), MTP_int(0), MTP_int(0)),
rpcDone(&HistoryWidget::messagesReceived, from), rpcFail(&HistoryWidget::messagesFailed));
}

Expand Down Expand Up @@ -2864,7 +2864,7 @@ void HistoryWidget::saveEditMsg() {
}
_saveEditMsgRequestId = MTP::send(
MTPmessages_EditMessage(MTP_flags(sendFlags), _history->peer->input, MTP_int(_editMsgId),
MTP_string(sending.text), MTPnullMarkup, sentEntities),
MTP_string(sending.text), MTPnullMarkup, sentEntities, MTP_inputGeoPointEmpty()),
rpcDone(&HistoryWidget::saveEditMsgDone, _history), rpcFail(&HistoryWidget::saveEditMsgFail, _history));
}

Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/inline_bots/inline_bot_send_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ SendDataCommon::SentMTPMessageFields SendGeo::getSentMessageFields() const {

SendDataCommon::SentMTPMessageFields SendVenue::getSentMessageFields() const {
SentMTPMessageFields result;
QString venueType;
result.media = MTP_messageMediaVenue(_location.toMTP(), MTP_string(_title), MTP_string(_address),
MTP_string(_provider), MTP_string(_venueId));
MTP_string(_provider), MTP_string(_venueId), MTP_string(venueType));
return result;
}

Expand Down
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/mainwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,9 +1262,9 @@ bool MainWidget::kickParticipantFail(ChatData *chat, const RPCError &error) {
}

void MainWidget::checkPeerHistory(PeerData *peer) {
MTP::send(
MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)),
rpcDone(&MainWidget::checkedHistory, peer));
MTP::send(MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0),
MTP_int(0), MTP_int(0)),
rpcDone(&MainWidget::checkedHistory, peer));
}

void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &result) {
Expand Down
7 changes: 4 additions & 3 deletions Telegram/SourceFiles/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ void MainWindow::sendServiceHistoryRequest() {
MTPstring(), MTP_string("42777"), MTP_userProfilePhotoEmpty(), MTP_userStatusRecently(),
MTPint(), MTPstring(), MTPstring(), MTPstring())));
}
_serviceHistoryRequest = MTP::send(
MTPmessages_GetHistory(user->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)),
_main->rpcDone(&MainWidget::serviceHistoryDone), _main->rpcFail(&MainWidget::serviceHistoryFail));
_serviceHistoryRequest =
MTP::send(MTPmessages_GetHistory(user->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0),
MTP_int(0), MTP_int(0)),
_main->rpcDone(&MainWidget::serviceHistoryDone), _main->rpcFail(&MainWidget::serviceHistoryFail));
}

void MainWindow::setupMain(const MTPUser *self) {
Expand Down
33 changes: 17 additions & 16 deletions Telegram/SourceFiles/profile/profile_channel_controllers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ void ParticipantsBoxController::loadMoreRows() {
// First query is small and fast, next loads a lot of rows.
auto perPage = (_offset > 0) ? kParticipantsPerPage : kParticipantsFirstPageCount;
_loadRequestId =
request(MTPchannels_GetParticipants(_channel->inputChannel, filter(), MTP_int(_offset), MTP_int(perPage)))
request(MTPchannels_GetParticipants(_channel->inputChannel, filter(), MTP_int(_offset), MTP_int(perPage),
MTP_int(0)))
.done([this](const MTPchannels_ChannelParticipants &result) {
Expects(result.type() == mtpc_channels_channelParticipants);

Expand Down Expand Up @@ -649,19 +650,19 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
// (because we've waited for search request by timer already,
// so we don't expect it to be fast, but we want to fill cache).
auto perPage = kParticipantsPerPage;
_requestId =
request(MTPchannels_GetParticipants(_channel->inputChannel, filter(), MTP_int(_offset), MTP_int(perPage)))
.done([this, perPage](const MTPchannels_ChannelParticipants &result, mtpRequestId requestId) {
searchDone(requestId, result, perPage);
})
.fail([this](const RPCError &error, mtpRequestId requestId) {
if (_requestId == requestId) {
_requestId = 0;
_allLoaded = true;
delegate()->peerListSearchRefreshRows();
}
})
.send();
_requestId = request(MTPchannels_GetParticipants(_channel->inputChannel, filter(), MTP_int(_offset),
MTP_int(perPage), MTP_int(0)))
.done([this, perPage](const MTPchannels_ChannelParticipants &result, mtpRequestId requestId) {
searchDone(requestId, result, perPage);
})
.fail([this](const RPCError &error, mtpRequestId requestId) {
if (_requestId == requestId) {
_requestId = 0;
_allLoaded = true;
delegate()->peerListSearchRefreshRows();
}
})
.send();

auto entry = Query();
entry.text = _query;
Expand Down Expand Up @@ -763,7 +764,7 @@ void AddParticipantBoxController::loadMoreRows() {
// First query is small and fast, next loads a lot of rows.
auto perPage = (_offset > 0) ? kParticipantsPerPage : kParticipantsFirstPageCount;
_loadRequestId = request(MTPchannels_GetParticipants(_channel->inputChannel, MTP_channelParticipantsRecent(),
MTP_int(_offset), MTP_int(perPage)))
MTP_int(_offset), MTP_int(perPage), MTP_int(0)))
.done([this](const MTPchannels_ChannelParticipants &result) {
Expects(result.type() == mtpc_channels_channelParticipants);

Expand Down Expand Up @@ -1278,7 +1279,7 @@ void AddParticipantBoxSearchController::requestParticipants() {
auto perPage = kParticipantsPerPage;
_requestId =
request(MTPchannels_GetParticipants(_channel->inputChannel, MTP_channelParticipantsSearch(MTP_string(_query)),
MTP_int(_offset), MTP_int(perPage)))
MTP_int(_offset), MTP_int(perPage), MTP_int(0)))
.done([this, perPage](const MTPchannels_ChannelParticipants &result, mtpRequestId requestId) {
searchParticipantsDone(requestId, result, perPage);
})
Expand Down

0 comments on commit bcb8072

Please sign in to comment.