mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-23 11:47:57 +00:00
Allow MTP_flags(0) and MTP_flags(single_flag).
This commit is contained in:
parent
2e6c15ff9d
commit
d41372dccd
@ -719,8 +719,7 @@ void ApiWrap::saveStickerSets(const Stickers::Order &localOrder, const Stickers:
|
||||
writeRecent = true;
|
||||
}
|
||||
|
||||
MTPmessages_ClearRecentStickers::Flags flags = 0;
|
||||
_stickersClearRecentRequestId = MTP::send(MTPmessages_ClearRecentStickers(MTP_flags(flags)), rpcDone(&ApiWrap::stickersClearRecentDone), rpcFail(&ApiWrap::stickersClearRecentFail));
|
||||
_stickersClearRecentRequestId = MTP::send(MTPmessages_ClearRecentStickers(MTP_flags(0)), rpcDone(&ApiWrap::stickersClearRecentDone), rpcFail(&ApiWrap::stickersClearRecentFail));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1069,7 +1068,7 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
}
|
||||
cloudDraft = history->createCloudDraft(localDraft);
|
||||
|
||||
MTPmessages_SaveDraft::Flags flags = 0;
|
||||
auto flags = MTPmessages_SaveDraft::Flags(0);
|
||||
auto &textWithTags = cloudDraft->textWithTags;
|
||||
if (cloudDraft->previewCancelled) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_no_webpage;
|
||||
@ -1445,8 +1444,7 @@ void ApiWrap::stickersSaveOrder() {
|
||||
mtpOrder.push_back(MTP_long(setId));
|
||||
}
|
||||
|
||||
MTPmessages_ReorderStickerSets::Flags flags = 0;
|
||||
_stickersReorderRequestId = MTP::send(MTPmessages_ReorderStickerSets(MTP_flags(flags), MTP_vector<MTPlong>(mtpOrder)), rpcDone(&ApiWrap::stickersReorderDone), rpcFail(&ApiWrap::stickersReorderFail));
|
||||
_stickersReorderRequestId = MTP::send(MTPmessages_ReorderStickerSets(MTP_flags(0), MTP_vector<MTPlong>(mtpOrder)), rpcDone(&ApiWrap::stickersReorderDone), rpcFail(&ApiWrap::stickersReorderFail));
|
||||
} else {
|
||||
stickersReorderDone(MTP_boolTrue());
|
||||
}
|
||||
|
@ -1919,8 +1919,7 @@ namespace {
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("a"), uphoto.vphoto_small, MTP_int(160), MTP_int(160), MTP_int(0)));
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("c"), uphoto.vphoto_big, MTP_int(640), MTP_int(640), MTP_int(0)));
|
||||
|
||||
MTPDphoto::Flags photoFlags = 0;
|
||||
return MTP_photo(MTP_flags(photoFlags), uphoto.vphoto_id, MTP_long(0), date, MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
return MTP_photo(MTP_flags(0), uphoto.vphoto_id, MTP_long(0), date, MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
}
|
||||
return MTP_photoEmpty(MTP_long(0));
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void GroupInfoBox::onNext() {
|
||||
Ui::show(Box<ContactsBox>(title, _photoImage), KeepOtherLayers);
|
||||
} else {
|
||||
bool mega = false;
|
||||
MTPchannels_CreateChannel::Flags flags = mega ? MTPchannels_CreateChannel::Flag::f_megagroup : MTPchannels_CreateChannel::Flag::f_broadcast;
|
||||
auto flags = mega ? MTPchannels_CreateChannel::Flag::f_megagroup : MTPchannels_CreateChannel::Flag::f_broadcast;
|
||||
_creationRequestId = MTP::send(MTPchannels_CreateChannel(MTP_flags(flags), MTP_string(title), MTP_string(description)), rpcDone(&GroupInfoBox::creationDone), rpcFail(&GroupInfoBox::creationFail));
|
||||
}
|
||||
}
|
||||
@ -852,7 +852,7 @@ void EditNameTitleBox::onSave() {
|
||||
}
|
||||
_sentName = first;
|
||||
if (_peer == App::self()) {
|
||||
MTPaccount_UpdateProfile::Flags flags = MTPaccount_UpdateProfile::Flag::f_first_name | MTPaccount_UpdateProfile::Flag::f_last_name;
|
||||
auto flags = MTPaccount_UpdateProfile::Flag::f_first_name | MTPaccount_UpdateProfile::Flag::f_last_name;
|
||||
_requestId = MTP::send(MTPaccount_UpdateProfile(MTP_flags(flags), MTP_string(first), MTP_string(last), MTPstring()), rpcDone(&EditNameTitleBox::onSaveSelfDone), rpcFail(&EditNameTitleBox::onSaveSelfFail));
|
||||
} else if (_peer->isChat()) {
|
||||
_requestId = MTP::send(MTPmessages_EditChatTitle(_peer->asChat()->inputChat, MTP_string(first)), rpcDone(&EditNameTitleBox::onSaveChatDone), rpcFail(&EditNameTitleBox::onSaveChatFail));
|
||||
|
@ -139,8 +139,7 @@ void ChangePhoneBox::EnterPhone::submit() {
|
||||
hideError();
|
||||
|
||||
auto phoneNumber = _phone->getLastText().trimmed();
|
||||
auto flags = MTPaccount_SendChangePhoneCode::Flags(0);
|
||||
_requestId = MTP::send(MTPaccount_SendChangePhoneCode(MTP_flags(flags), MTP_string(phoneNumber), MTP_bool(false)), rpcDone(base::lambda_guarded(this, [this, phoneNumber](const MTPauth_SentCode &result) {
|
||||
_requestId = MTP::send(MTPaccount_SendChangePhoneCode(MTP_flags(0), MTP_string(phoneNumber), MTP_bool(false)), rpcDone(base::lambda_guarded(this, [this, phoneNumber](const MTPauth_SentCode &result) {
|
||||
return sendPhoneDone(phoneNumber, result);
|
||||
})), rpcFail(base::lambda_guarded(this, [this, phoneNumber](const RPCError &error) {
|
||||
return sendPhoneFail(phoneNumber, error);
|
||||
|
@ -390,7 +390,7 @@ void PinMessageBox::keyPressEvent(QKeyEvent *e) {
|
||||
void PinMessageBox::pinMessage() {
|
||||
if (_requestId) return;
|
||||
|
||||
MTPchannels_UpdatePinnedMessage::Flags flags = 0;
|
||||
auto flags = MTPchannels_UpdatePinnedMessage::Flags(0);
|
||||
if (!_notify->checked()) {
|
||||
flags |= MTPchannels_UpdatePinnedMessage::Flag::f_silent;
|
||||
}
|
||||
|
@ -154,8 +154,7 @@ void ConfirmPhoneBox::checkPhoneAndHash() {
|
||||
if (_sendCodeRequestId) {
|
||||
return;
|
||||
}
|
||||
MTPaccount_SendConfirmPhoneCode::Flags flags = 0;
|
||||
_sendCodeRequestId = MTP::send(MTPaccount_SendConfirmPhoneCode(MTP_flags(flags), MTP_string(_hash), MTPBool()), rpcDone(&ConfirmPhoneBox::sendCodeDone), rpcFail(&ConfirmPhoneBox::sendCodeFail));
|
||||
_sendCodeRequestId = MTP::send(MTPaccount_SendConfirmPhoneCode(MTP_flags(0), MTP_string(_hash), MTPBool()), rpcDone(&ConfirmPhoneBox::sendCodeDone), rpcFail(&ConfirmPhoneBox::sendCodeFail));
|
||||
}
|
||||
|
||||
void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) {
|
||||
|
@ -708,12 +708,10 @@ void ContactsBox::Inner::onPeerNameChanged(PeerData *peer, const PeerData::Names
|
||||
void ContactsBox::Inner::addBot() {
|
||||
if (auto &info = _bot->botInfo) {
|
||||
if (!info->shareGameShortName.isEmpty()) {
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
|
||||
auto history = App::historyLoaded(_addToPeer);
|
||||
auto afterRequestId = history ? history->sendRequestId : 0;
|
||||
auto randomId = rand_value<uint64>();
|
||||
auto requestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), _addToPeer->input, MTP_int(0), MTP_inputMediaGame(MTP_inputGameShortName(_bot->inputUser, MTP_string(info->shareGameShortName))), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, afterRequestId);
|
||||
auto requestId = MTP::send(MTPmessages_SendMedia(MTP_flags(0), _addToPeer->input, MTP_int(0), MTP_inputMediaGame(MTP_inputGameShortName(_bot->inputUser, MTP_string(info->shareGameShortName))), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, afterRequestId);
|
||||
if (history) {
|
||||
history->sendRequestId = requestId;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void PasscodeBox::onSave(bool force) {
|
||||
if (!_oldPasscode->isHidden()) {
|
||||
hashSha256(oldPasswordData.constData(), oldPasswordData.size(), oldPasswordHash.data());
|
||||
}
|
||||
MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_new_salt | MTPDaccount_passwordInputSettings::Flag::f_new_password_hash | MTPDaccount_passwordInputSettings::Flag::f_hint;
|
||||
auto flags = MTPDaccount_passwordInputSettings::Flag::f_new_salt | MTPDaccount_passwordInputSettings::Flag::f_new_password_hash | MTPDaccount_passwordInputSettings::Flag::f_hint;
|
||||
if (_oldPasscode->isHidden() || _newPasscode->isHidden()) {
|
||||
flags |= MTPDaccount_passwordInputSettings::Flag::f_email;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ void EditCaptionBox::onSave(bool ctrlShiftEnter) {
|
||||
return;
|
||||
}
|
||||
|
||||
MTPmessages_EditMessage::Flags flags = MTPmessages_EditMessage::Flag::f_message;
|
||||
auto flags = qFlags(MTPmessages_EditMessage::Flag::f_message);
|
||||
if (_previewCancelled) {
|
||||
flags |= MTPmessages_EditMessage::Flag::f_no_webpage;
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ void shareGameScoreFromItem(HistoryItem *item) {
|
||||
}
|
||||
};
|
||||
|
||||
MTPmessages_ForwardMessages::Flags sendFlags = MTPmessages_ForwardMessages::Flag::f_with_my_score;
|
||||
auto sendFlags = MTPmessages_ForwardMessages::Flag::f_with_my_score;
|
||||
MTPVector<MTPint> msgIds = MTP_vector<MTPint>(1, MTP_int(data->msgId.msg));
|
||||
if (auto main = App::main()) {
|
||||
if (auto item = App::histItemById(data->msgId)) {
|
||||
|
@ -320,8 +320,7 @@ void StickersBox::loadMoreArchived() {
|
||||
}
|
||||
}
|
||||
}
|
||||
MTPmessages_GetArchivedStickers::Flags flags = 0;
|
||||
_archivedRequestId = MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(flags), MTP_long(lastId), MTP_int(kArchivedLimitPerPage)), rpcDone(&StickersBox::getArchivedDone, lastId));
|
||||
_archivedRequestId = MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(0), MTP_long(lastId), MTP_int(kArchivedLimitPerPage)), rpcDone(&StickersBox::getArchivedDone, lastId));
|
||||
}
|
||||
|
||||
void StickersBox::paintEvent(QPaintEvent *e) {
|
||||
@ -471,8 +470,7 @@ bool StickersBox::installFail(uint64 setId, const RPCError &error) {
|
||||
|
||||
void StickersBox::preloadArchivedSets() {
|
||||
if (!_archivedRequestId) {
|
||||
MTPmessages_GetArchivedStickers::Flags flags = 0;
|
||||
_archivedRequestId = MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(flags), MTP_long(0), MTP_int(kArchivedLimitFirstRequest)), rpcDone(&StickersBox::getArchivedDone, 0ULL));
|
||||
_archivedRequestId = MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(0), MTP_long(0), MTP_int(kArchivedLimitFirstRequest)), rpcDone(&StickersBox::getArchivedDone, 0ULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2643,8 +2643,7 @@ bool DialogsWidget::onSearchMessages(bool searchCache) {
|
||||
_searchFull = _searchFullMigrated = false;
|
||||
MTP::cancel(base::take(_searchRequest));
|
||||
if (_searchInPeer) {
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart));
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart));
|
||||
} else {
|
||||
_searchRequest = MTP::send(MTPmessages_SearchGlobal(MTP_string(_searchQuery), MTP_int(0), MTP_inputPeerEmpty(), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart));
|
||||
}
|
||||
@ -2702,12 +2701,11 @@ void DialogsWidget::searchMessages(const QString &query, PeerData *inPeer) {
|
||||
void DialogsWidget::onSearchMore() {
|
||||
if (!_searchRequest) {
|
||||
if (!_searchFull) {
|
||||
int32 offsetDate = _inner->lastSearchDate();
|
||||
PeerData *offsetPeer = _inner->lastSearchPeer();
|
||||
MsgId offsetId = _inner->lastSearchId();
|
||||
auto offsetDate = _inner->lastSearchDate();
|
||||
auto offsetPeer = _inner->lastSearchPeer();
|
||||
auto offsetId = _inner->lastSearchId();
|
||||
if (_searchInPeer) {
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart));
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart));
|
||||
} else {
|
||||
_searchRequest = MTP::send(MTPmessages_SearchGlobal(MTP_string(_searchQuery), MTP_int(offsetDate), offsetPeer ? offsetPeer->input : MTP_inputPeerEmpty(), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart));
|
||||
}
|
||||
@ -2715,9 +2713,8 @@ void DialogsWidget::onSearchMore() {
|
||||
_searchQueries.insert(_searchRequest, _searchQuery);
|
||||
}
|
||||
} else if (_searchInMigrated && !_searchFullMigrated) {
|
||||
MsgId offsetMigratedId = _inner->lastSearchMigratedId();
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInMigrated->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetMigratedId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart), rpcFail(&DialogsWidget::searchFailed, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart));
|
||||
auto offsetMigratedId = _inner->lastSearchMigratedId();
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _searchInMigrated->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetMigratedId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart), rpcFail(&DialogsWidget::searchFailed, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2731,7 +2728,7 @@ void DialogsWidget::loadDialogs() {
|
||||
|
||||
auto firstLoad = !_dialogsOffsetDate;
|
||||
auto loadCount = firstLoad ? DialogsFirstLoad : DialogsPerPage;
|
||||
auto flags = qFlags(MTPmessages_GetDialogs::Flag::f_exclude_pinned);
|
||||
auto flags = MTPmessages_GetDialogs::Flag::f_exclude_pinned;
|
||||
_dialogsRequestId = MTP::send(MTPmessages_GetDialogs(MTP_flags(flags), MTP_int(_dialogsOffsetDate), MTP_int(_dialogsOffsetId), _dialogsOffsetPeer ? _dialogsOffsetPeer->input : MTP_inputPeerEmpty(), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed));
|
||||
if (!_pinnedDialogsReceived) {
|
||||
loadPinnedDialogs();
|
||||
|
@ -393,8 +393,8 @@ void ChannelHistory::getRangeDifferenceNext(int32 pts) {
|
||||
|
||||
int limit = _rangeDifferenceToId + 1 - _rangeDifferenceFromId;
|
||||
|
||||
auto filter = MTP_channelMessagesFilter(MTP_flags(MTPDchannelMessagesFilter::Flags(0)), MTP_vector<MTPMessageRange>(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId))));
|
||||
MTPupdates_GetChannelDifference::Flags flags = MTPupdates_GetChannelDifference::Flag::f_force;
|
||||
auto filter = MTP_channelMessagesFilter(MTP_flags(0), MTP_vector<MTPMessageRange>(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId))));
|
||||
auto flags = MTPupdates_GetChannelDifference::Flag::f_force;
|
||||
_rangeDifferenceRequestId = MTP::send(MTPupdates_GetChannelDifference(MTP_flags(flags), peer->asChannel()->inputChannel, filter, MTP_int(pts), MTP_int(limit)), App::main()->rpcDone(&MainWidget::gotRangeDifference, peer->asChannel()));
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ void Histories::savePinnedToServer() const {
|
||||
peers.push_back(history->peer->input);
|
||||
}
|
||||
auto flags = MTPmessages_ReorderPinnedDialogs::Flag::f_force;
|
||||
MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(qFlags(flags)), MTP_vector(peers)));
|
||||
MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(flags), MTP_vector(peers)));
|
||||
}
|
||||
|
||||
HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem) {
|
||||
|
@ -3701,8 +3701,7 @@ void HistoryWidget::updateStickers() {
|
||||
}
|
||||
if (!Global::LastRecentStickersUpdate() || now >= Global::LastRecentStickersUpdate() + StickersUpdateTimeout) {
|
||||
if (!_recentStickersUpdateRequest) {
|
||||
MTPmessages_GetRecentStickers::Flags flags = 0;
|
||||
_recentStickersUpdateRequest = MTP::send(MTPmessages_GetRecentStickers(MTP_flags(flags), MTP_int(Local::countRecentStickersHash())), rpcDone(&HistoryWidget::recentStickersGot), rpcFail(&HistoryWidget::recentStickersFailed));
|
||||
_recentStickersUpdateRequest = MTP::send(MTPmessages_GetRecentStickers(MTP_flags(0), MTP_int(Local::countRecentStickersHash())), rpcDone(&HistoryWidget::recentStickersGot), rpcFail(&HistoryWidget::recentStickersFailed));
|
||||
}
|
||||
}
|
||||
if (!Global::LastFeaturedStickersUpdate() || now >= Global::LastFeaturedStickersUpdate() + StickersUpdateTimeout) {
|
||||
@ -5317,7 +5316,7 @@ void HistoryWidget::saveEditMsg() {
|
||||
return;
|
||||
}
|
||||
|
||||
MTPmessages_EditMessage::Flags sendFlags = MTPmessages_EditMessage::Flag::f_message;
|
||||
auto sendFlags = qFlags(MTPmessages_EditMessage::Flag::f_message);
|
||||
if (webPageId == CancelledWebPageId) {
|
||||
sendFlags |= MTPmessages_EditMessage::Flag::f_no_webpage;
|
||||
}
|
||||
@ -5524,11 +5523,11 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
|
||||
fastShowAtEnd(history);
|
||||
|
||||
PeerData *p = App::peer(peer);
|
||||
MTPDmessage::Flags flags = newMessageFlags(p) | MTPDmessage::Flag::f_media; // unread, out
|
||||
auto flags = newMessageFlags(p) | MTPDmessage::Flag::f_media; // unread, out
|
||||
|
||||
bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(peerToChannel(peer), replyTo));
|
||||
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyTo) {
|
||||
flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
@ -5890,12 +5889,12 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button
|
||||
|
||||
using ButtonType = HistoryMessageReplyMarkup::Button::Type;
|
||||
BotCallbackInfo info = { bot, msg->fullId(), row, col, (button->type == ButtonType::Game) };
|
||||
MTPmessages_GetBotCallbackAnswer::Flags flags = 0;
|
||||
auto flags = MTPmessages_GetBotCallbackAnswer::Flags(0);
|
||||
QByteArray sendData;
|
||||
if (info.game) {
|
||||
flags = MTPmessages_GetBotCallbackAnswer::Flag::f_game;
|
||||
flags |= MTPmessages_GetBotCallbackAnswer::Flag::f_game;
|
||||
} else if (button->type == ButtonType::Callback) {
|
||||
flags = MTPmessages_GetBotCallbackAnswer::Flag::f_data;
|
||||
flags |= MTPmessages_GetBotCallbackAnswer::Flag::f_data;
|
||||
sendData = button->data;
|
||||
}
|
||||
button->requestId = MTP::send(MTPmessages_GetBotCallbackAnswer(MTP_flags(flags), _peer->input, MTP_int(msg->id), MTP_bytes(sendData)), rpcDone(&HistoryWidget::botCallbackDone, info), rpcFail(&HistoryWidget::botCallbackFail, info));
|
||||
@ -6838,7 +6837,7 @@ void HistoryWidget::sendFileConfirmed(const FileLoadResultPtr &file) {
|
||||
|
||||
fastShowAtEnd(h);
|
||||
|
||||
MTPDmessage::Flags flags = newMessageFlags(h->peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
auto flags = newMessageFlags(h->peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
if (file->to.replyTo) flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
bool channelPost = h->peer->isChannel() && !h->peer->isMegagroup();
|
||||
bool showFromName = !channelPost || h->peer->asChannel()->addsSignature();
|
||||
@ -6880,7 +6879,7 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, bool silent, const M
|
||||
App::historyRegRandom(randomId, newId);
|
||||
History *hist = item->history();
|
||||
MsgId replyTo = item->replyToId();
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
}
|
||||
@ -6891,8 +6890,7 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, bool silent, const M
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
|
||||
}
|
||||
auto caption = item->getMedia() ? item->getMedia()->getCaption() : TextWithEntities();
|
||||
MTPDinputMediaUploadedPhoto::Flags mediaFlags = 0;
|
||||
auto media = MTP_inputMediaUploadedPhoto(MTP_flags(mediaFlags), file, MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
auto media = MTP_inputMediaUploadedPhoto(MTP_flags(0), file, MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||
}
|
||||
}
|
||||
@ -6911,12 +6909,13 @@ namespace {
|
||||
if (document->type == AnimatedDocument) {
|
||||
attributes.push_back(MTP_documentAttributeAnimated());
|
||||
} else if (document->type == StickerDocument && document->sticker()) {
|
||||
MTPDdocumentAttributeSticker::Flags stickerFlags = 0;
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(document->sticker()->alt), document->sticker()->set, MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(document->sticker()->alt), document->sticker()->set, MTPMaskCoords()));
|
||||
} else if (document->type == SongDocument && document->song()) {
|
||||
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring()));
|
||||
auto flags = MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer;
|
||||
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(flags), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring()));
|
||||
} else if (document->type == VoiceDocument && document->voice()) {
|
||||
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(document->voice()->waveform))));
|
||||
auto flags = MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform;
|
||||
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(flags), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(document->voice()->waveform))));
|
||||
}
|
||||
return MTP_vector<MTPDocumentAttribute>(attributes);
|
||||
}
|
||||
@ -6926,11 +6925,11 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, bool silent, cons
|
||||
if (auto item = dynamic_cast<HistoryMessage*>(App::histItemById(newId))) {
|
||||
auto media = item->getMedia();
|
||||
if (auto document = media ? media->getDocument() : nullptr) {
|
||||
uint64 randomId = rand_value<uint64>();
|
||||
auto randomId = rand_value<uint64>();
|
||||
App::historyRegRandom(randomId, newId);
|
||||
History *hist = item->history();
|
||||
MsgId replyTo = item->replyToId();
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto hist = item->history();
|
||||
auto replyTo = item->replyToId();
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
}
|
||||
@ -6941,8 +6940,7 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, bool silent, cons
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
|
||||
}
|
||||
auto caption = item->getMedia() ? item->getMedia()->getCaption() : TextWithEntities();
|
||||
MTPDinputMediaUploadedDocument::Flags mediaFlags = 0;
|
||||
auto media = MTP_inputMediaUploadedDocument(MTP_flags(mediaFlags), file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
auto media = MTP_inputMediaUploadedDocument(MTP_flags(0), file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||
}
|
||||
}
|
||||
@ -6952,11 +6950,11 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, bool silent,
|
||||
if (auto item = dynamic_cast<HistoryMessage*>(App::histItemById(newId))) {
|
||||
auto media = item->getMedia();
|
||||
if (auto document = media ? media->getDocument() : nullptr) {
|
||||
uint64 randomId = rand_value<uint64>();
|
||||
auto randomId = rand_value<uint64>();
|
||||
App::historyRegRandom(randomId, newId);
|
||||
History *hist = item->history();
|
||||
MsgId replyTo = item->replyToId();
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto hist = item->history();
|
||||
auto replyTo = item->replyToId();
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
}
|
||||
@ -6967,8 +6965,7 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, bool silent,
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
|
||||
}
|
||||
auto caption = media ? media->getCaption() : TextWithEntities();
|
||||
MTPDinputMediaUploadedThumbDocument::Flags mediaFlags = 0;
|
||||
auto media = MTP_inputMediaUploadedThumbDocument(MTP_flags(mediaFlags), file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
auto media = MTP_inputMediaUploadedThumbDocument(MTP_flags(0), file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption.text), MTPVector<MTPInputDocument>());
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||
}
|
||||
}
|
||||
@ -7666,8 +7663,8 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
|
||||
bool lastKeyboardUsed = lastForceReplyReplied();
|
||||
|
||||
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
|
||||
MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
MTPmessages_SendInlineBotResult::Flags sendFlags = MTPmessages_SendInlineBotResult::Flag::f_clear_draft;
|
||||
auto flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
auto sendFlags = qFlags(MTPmessages_SendInlineBotResult::Flag::f_clear_draft);
|
||||
if (replyToId()) {
|
||||
flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_reply_to_msg_id;
|
||||
@ -7846,8 +7843,8 @@ bool HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti
|
||||
bool lastKeyboardUsed = lastForceReplyReplied();
|
||||
|
||||
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
|
||||
MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyToId()) {
|
||||
flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
@ -7902,8 +7899,8 @@ void HistoryWidget::sendExistingPhoto(PhotoData *photo, const QString &caption)
|
||||
bool lastKeyboardUsed = lastForceReplyReplied();
|
||||
|
||||
bool out = !_peer->isSelf(), unread = !_peer->isSelf();
|
||||
MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
MTPmessages_SendMedia::Flags sendFlags = 0;
|
||||
auto flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (replyToId()) {
|
||||
flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
@ -8078,8 +8075,7 @@ void HistoryWidget::onUnpinMessage() {
|
||||
}
|
||||
|
||||
Ui::hideLayer();
|
||||
MTPchannels_UpdatePinnedMessage::Flags flags = 0;
|
||||
MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(flags), _peer->asChannel()->inputChannel, MTP_int(0)), rpcDone(&HistoryWidget::unpinDone));
|
||||
MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(0), _peer->asChannel()->inputChannel, MTP_int(0)), rpcDone(&HistoryWidget::unpinDone));
|
||||
})));
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ void Result::createDocument() {
|
||||
} else if (_type == Type::Video) {
|
||||
attributes.push_back(MTP_documentAttributeVideo(MTP_int(_duration), MTP_int(_width), MTP_int(_height)));
|
||||
} else if (_type == Type::Audio) {
|
||||
MTPDdocumentAttributeAudio::Flags flags = 0;
|
||||
auto flags = MTPDdocumentAttributeAudio::Flags(0);
|
||||
if (mime == qstr("audio/ogg")) {
|
||||
flags |= MTPDdocumentAttributeAudio::Flag::f_voice;
|
||||
} else {
|
||||
|
@ -160,8 +160,7 @@ void PhoneWidget::phoneCheckDone(const MTPauth_CheckedPhone &result) {
|
||||
|
||||
_checkRequest->start(1000);
|
||||
|
||||
MTPauth_SendCode::Flags flags = 0;
|
||||
_sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail));
|
||||
_sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(0), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail));
|
||||
} else {
|
||||
showSignup();
|
||||
_sentRequest = 0;
|
||||
@ -197,8 +196,7 @@ void PhoneWidget::toSignUp() {
|
||||
|
||||
_checkRequest->start(1000);
|
||||
|
||||
MTPauth_SendCode::Flags flags = 0;
|
||||
_sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail));
|
||||
_sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(0), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail));
|
||||
}
|
||||
|
||||
bool PhoneWidget::phoneSubmitFail(const RPCError &error) {
|
||||
|
@ -355,8 +355,8 @@ void MainWidget::finishForwarding(History *history, bool silent) {
|
||||
PeerData *forwardFrom = 0;
|
||||
App::main()->readServerHistory(history);
|
||||
|
||||
MTPDmessage::Flags flags = 0;
|
||||
MTPmessages_ForwardMessages::Flags sendFlags = 0;
|
||||
auto flags = MTPDmessage::Flags(0);
|
||||
auto sendFlags = MTPmessages_ForwardMessages::Flags(0);
|
||||
bool channelPost = history->peer->isChannel() && !history->peer->isMegagroup();
|
||||
bool showFromName = !channelPost || history->peer->asChannel()->addsSignature();
|
||||
bool silentPost = channelPost && silent;
|
||||
@ -818,7 +818,7 @@ void MainWidget::deleteHistoryPart(DeleteHistoryRequest request, const MTPmessag
|
||||
return;
|
||||
}
|
||||
|
||||
MTPmessages_DeleteHistory::Flags flags = 0;
|
||||
auto flags = MTPmessages_DeleteHistory::Flags(0);
|
||||
if (request.justClearHistory) {
|
||||
flags |= MTPmessages_DeleteHistory::Flag::f_just_clear;
|
||||
}
|
||||
@ -872,8 +872,7 @@ void MainWidget::deleteConversation(PeerData *peer, bool deleteHistory) {
|
||||
}
|
||||
if (deleteHistory) {
|
||||
DeleteHistoryRequest request = { peer, false };
|
||||
MTPmessages_DeleteHistory::Flags flags = 0;
|
||||
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
||||
MTP::send(MTPmessages_DeleteHistory(MTP_flags(0), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
||||
}
|
||||
}
|
||||
|
||||
@ -927,7 +926,7 @@ void MainWidget::clearHistory(PeerData *peer) {
|
||||
h->clear();
|
||||
h->newLoaded = h->oldLoaded = true;
|
||||
}
|
||||
MTPmessages_DeleteHistory::Flags flags = MTPmessages_DeleteHistory::Flag::f_just_clear;
|
||||
auto flags = MTPmessages_DeleteHistory::Flag::f_just_clear;
|
||||
DeleteHistoryRequest request = { peer, true };
|
||||
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
||||
}
|
||||
@ -1221,8 +1220,8 @@ void MainWidget::sendMessage(const MessageToSend &message) {
|
||||
App::historyRegSentData(randomId, history->peer->id, sendingText);
|
||||
|
||||
MTPstring msgText(MTP_string(sendingText));
|
||||
MTPDmessage::Flags flags = newMessageFlags(history->peer) | MTPDmessage::Flag::f_entities; // unread, out
|
||||
MTPmessages_SendMessage::Flags sendFlags = 0;
|
||||
auto flags = newMessageFlags(history->peer) | MTPDmessage::Flag::f_entities; // unread, out
|
||||
auto sendFlags = MTPmessages_SendMessage::Flags(0);
|
||||
if (replyTo) {
|
||||
flags |= MTPDmessage::Flag::f_reply_to_msg_id;
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_reply_to_msg_id;
|
||||
@ -1368,8 +1367,7 @@ bool MainWidget::preloadOverview(PeerData *peer, MediaOverviewType type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_overviewPreload[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(flags), peer->input, MTP_string(""), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::overviewPreloaded, peer), rpcFail(&MainWidget::overviewFailed, peer), 0, 10));
|
||||
_overviewPreload[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(0), peer->input, MTP_string(""), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::overviewPreloaded, peer), rpcFail(&MainWidget::overviewFailed, peer), 0, 10));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1478,8 +1476,7 @@ void MainWidget::loadMediaBack(PeerData *peer, MediaOverviewType type, bool many
|
||||
MTPMessagesFilter filter = typeToMediaFilter(type);
|
||||
if (type == OverviewCount) return;
|
||||
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_overviewLoad[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(flags), peer->input, MTPstring(), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(minId), MTP_int(limit)), rpcDone(&MainWidget::overviewLoaded, history)));
|
||||
_overviewLoad[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(0), peer->input, MTPstring(), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(minId), MTP_int(limit)), rpcDone(&MainWidget::overviewLoaded, history)));
|
||||
}
|
||||
|
||||
void MainWidget::checkLastUpdate(bool afterSleep) {
|
||||
@ -1807,7 +1804,7 @@ void MainWidget::dialogsCancelled() {
|
||||
}
|
||||
|
||||
void MainWidget::serviceNotification(const TextWithEntities &message, const MTPMessageMedia &media, int32 date) {
|
||||
MTPDmessage::Flags flags = MTPDmessage::Flag::f_entities | MTPDmessage::Flag::f_from_id | MTPDmessage_ClientFlag::f_clientside_unread;
|
||||
auto flags = MTPDmessage::Flag::f_entities | MTPDmessage::Flag::f_from_id | MTPDmessage_ClientFlag::f_clientside_unread;
|
||||
QString sendingText, leftText = message.text;
|
||||
EntitiesInText sendingEntities, leftEntities = message.entities;
|
||||
HistoryItem *item = nullptr;
|
||||
@ -3782,8 +3779,7 @@ void MainWidget::getDifference() {
|
||||
|
||||
_ptsWaiter.setRequesting(true);
|
||||
|
||||
MTPupdates_GetDifference::Flags flags = 0;
|
||||
MTP::send(MTPupdates_GetDifference(MTP_flags(flags), MTP_int(_ptsWaiter.current()), MTPint(), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference));
|
||||
MTP::send(MTPupdates_GetDifference(MTP_flags(0), MTP_int(_ptsWaiter.current()), MTPint(), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference));
|
||||
}
|
||||
|
||||
void MainWidget::getChannelDifference(ChannelData *channel, ChannelDifferenceRequest from) {
|
||||
@ -3802,7 +3798,7 @@ void MainWidget::getChannelDifference(ChannelData *channel, ChannelDifferenceReq
|
||||
channel->ptsSetRequesting(true);
|
||||
|
||||
auto filter = MTP_channelMessagesFilterEmpty();
|
||||
MTPupdates_GetChannelDifference::Flags flags = MTPupdates_GetChannelDifference::Flag::f_force;
|
||||
auto flags = qFlags(MTPupdates_GetChannelDifference::Flag::f_force);
|
||||
if (from != ChannelDifferenceRequest::PtsGapOrShortPoll) {
|
||||
if (!channel->ptsWaitingForSkipped()) {
|
||||
flags = 0; // No force flag when requesting for short poll.
|
||||
@ -4649,7 +4645,7 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||
}
|
||||
|
||||
// update before applying skipped
|
||||
MTPDmessage::Flags flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id;
|
||||
auto flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id;
|
||||
auto item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), d.vid, d.is_out() ? MTP_int(AuthSession::CurrentUserId()) : d.vuser_id, MTP_peerUser(d.is_out() ? d.vuser_id : MTP_int(AuthSession::CurrentUserId())), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread);
|
||||
if (item) {
|
||||
_history->peerMessagesUpdated(item->history()->peer->id);
|
||||
@ -4677,7 +4673,7 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||
}
|
||||
|
||||
// update before applying skipped
|
||||
MTPDmessage::Flags flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id;
|
||||
auto flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id;
|
||||
auto item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), d.vid, d.vfrom_id, MTP_peerChat(d.vchat_id), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread);
|
||||
if (item) {
|
||||
_history->peerMessagesUpdated(item->history()->peer->id);
|
||||
|
@ -336,7 +336,7 @@ void MainWindow::sendServiceHistoryRequest() {
|
||||
|
||||
UserData *user = App::userLoaded(ServiceUserId);
|
||||
if (!user) {
|
||||
MTPDuser::Flags userFlags = MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_phone | MTPDuser::Flag::f_status | MTPDuser::Flag::f_verified;
|
||||
auto userFlags = MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_phone | MTPDuser::Flag::f_status | MTPDuser::Flag::f_verified;
|
||||
user = App::feedUsers(MTP_vector<MTPUser>(1, MTP_user(MTP_flags(userFlags), MTP_int(ServiceUserId), MTPlong(), MTP_string("Telegram"), MTPstring(), MTPstring(), MTP_string("42777"), MTP_userProfilePhotoEmpty(), MTP_userStatusRecently(), MTPint(), 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));
|
||||
|
@ -617,8 +617,7 @@ void Messenger::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId) {
|
||||
|
||||
PhotoId id = rand_value<PhotoId>();
|
||||
|
||||
MTPDphoto::Flags photoFlags = 0;
|
||||
auto photo = MTP_photo(MTP_flags(photoFlags), MTP_long(id), MTP_long(0), MTP_int(unixtime()), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
auto photo = MTP_photo(MTP_flags(0), MTP_long(id), MTP_long(0), MTP_int(unixtime()), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
|
||||
QString file, filename;
|
||||
int32 filesize = 0;
|
||||
|
@ -395,6 +395,13 @@ inline MTPint MTP_int(int32 v) {
|
||||
}
|
||||
using MTPInt = MTPBoxed<MTPint>;
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct ZeroFlagsHelper {
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template <typename Flags>
|
||||
class MTPflags {
|
||||
public:
|
||||
@ -402,6 +409,8 @@ public:
|
||||
static_assert(sizeof(Flags) == sizeof(int32), "MTPflags are allowed only wrapping int32 flag types!");
|
||||
|
||||
MTPflags() = default;
|
||||
MTPflags(internal::ZeroFlagsHelper helper) {
|
||||
}
|
||||
|
||||
uint32 innerLength() const {
|
||||
return sizeof(Flags);
|
||||
@ -423,12 +432,25 @@ private:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
friend MTPflags<T> MTP_flags(T v);
|
||||
friend MTPflags<QFlags<T>> MTP_flags(QFlags<T> v);
|
||||
|
||||
template <typename T, typename>
|
||||
friend MTPflags<QFlags<T>> MTP_flags(T v);
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline MTPflags<T> MTP_flags(T v) {
|
||||
return MTPflags<T>(v);
|
||||
inline MTPflags<QFlags<T>> MTP_flags(QFlags<T> v) {
|
||||
return MTPflags<QFlags<T>>(v);
|
||||
}
|
||||
|
||||
template <typename T, typename = std::enable_if_t<!std::is_same<T, int>::value>>
|
||||
inline MTPflags<QFlags<T>> MTP_flags(T v) {
|
||||
return MTPflags<QFlags<T>>(v);
|
||||
}
|
||||
|
||||
inline internal::ZeroFlagsHelper MTP_flags(void(internal::ZeroFlagsHelper::*)()) {
|
||||
return internal::ZeroFlagsHelper();
|
||||
}
|
||||
|
||||
template <typename Flags>
|
||||
|
@ -742,14 +742,12 @@ void OverviewInner::preloadMore() {
|
||||
if (!_searchRequest) {
|
||||
MTPmessagesFilter filter = (_type == OverviewLinks) ? MTP_inputMessagesFilterUrl() : MTP_inputMessagesFilterDocument();
|
||||
if (!_searchFull) {
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchId ? SearchFromOffset : SearchFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchId ? SearchFromOffset : SearchFromStart));
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchId ? SearchFromOffset : SearchFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchId ? SearchFromOffset : SearchFromStart));
|
||||
if (!_lastSearchId) {
|
||||
_searchQueries.insert(_searchRequest, _searchQuery);
|
||||
}
|
||||
} else if (_migrated && !_searchFullMigrated) {
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _migrated->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchMigratedId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart));
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _migrated->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchMigratedId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart));
|
||||
}
|
||||
}
|
||||
} else if (App::main()) {
|
||||
@ -1468,9 +1466,8 @@ bool OverviewInner::onSearchMessages(bool searchCache) {
|
||||
} else if (_searchQuery != q) {
|
||||
_searchQuery = q;
|
||||
_searchFull = _searchFullMigrated = false;
|
||||
MTPmessages_Search::Flags flags = 0;
|
||||
MTPmessagesFilter filter = (_type == OverviewLinks) ? MTP_inputMessagesFilterUrl() : MTP_inputMessagesFilterDocument();
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, SearchFromStart), rpcFail(&OverviewInner::searchFailed, SearchFromStart));
|
||||
auto filter = (_type == OverviewLinks) ? MTP_inputMessagesFilterUrl() : MTP_inputMessagesFilterDocument();
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_flags(0), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, SearchFromStart), rpcFail(&OverviewInner::searchFailed, SearchFromStart));
|
||||
_searchQueries.insert(_searchRequest, _searchQuery);
|
||||
}
|
||||
return false;
|
||||
|
@ -90,7 +90,7 @@ void CloudPasswordState::onTurnOff() {
|
||||
if (_curPasswordSalt.isEmpty()) {
|
||||
_turnOff->hide();
|
||||
|
||||
MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_email;
|
||||
auto flags = MTPDaccount_passwordInputSettings::Flag::f_email;
|
||||
MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_bytes(QByteArray()), MTP_bytes(QByteArray()), MTP_string(QString()), MTP_string(QString())));
|
||||
MTP::send(MTPaccount_UpdatePasswordSettings(MTP_bytes(QByteArray()), settings), rpcDone(&CloudPasswordState::offPasswordDone), rpcFail(&CloudPasswordState::offPasswordFail));
|
||||
} else {
|
||||
|
@ -3887,8 +3887,7 @@ void EmojiPan::onInlineRequest() {
|
||||
if (nextOffset.isEmpty()) return;
|
||||
}
|
||||
Notify::inlineBotRequesting(true);
|
||||
MTPmessages_GetInlineBotResults::Flags flags = 0;
|
||||
_inlineRequestId = MTP::send(MTPmessages_GetInlineBotResults(MTP_flags(flags), _inlineBot->inputUser, _inlineQueryPeer->input, MTPInputGeoPoint(), MTP_string(_inlineQuery), MTP_string(nextOffset)), rpcDone(&EmojiPan::inlineResultsDone), rpcFail(&EmojiPan::inlineResultsFail));
|
||||
_inlineRequestId = MTP::send(MTPmessages_GetInlineBotResults(MTP_flags(0), _inlineBot->inputUser, _inlineQueryPeer->input, MTPInputGeoPoint(), MTP_string(_inlineQuery), MTP_string(nextOffset)), rpcDone(&EmojiPan::inlineResultsDone), rpcFail(&EmojiPan::inlineResultsFail));
|
||||
}
|
||||
|
||||
void EmojiPan::onEmptyInlineRows() {
|
||||
|
@ -503,8 +503,7 @@ void FileLoadTask::process() {
|
||||
full.save(&buffer, "JPG", 87);
|
||||
}
|
||||
|
||||
MTPDphoto::Flags photoFlags = 0;
|
||||
photo = MTP_photo(MTP_flags(photoFlags), MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
photo = MTP_photo(MTP_flags(0), MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
|
||||
if (filesize < 0) {
|
||||
filesize = _result->filesize = filedata.size();
|
||||
@ -514,8 +513,7 @@ void FileLoadTask::process() {
|
||||
QByteArray thumbFormat = "JPG";
|
||||
int32 thumbQuality = 87;
|
||||
if (!isAnimation && filemime == stickerMime && w > 0 && h > 0 && w <= StickerMaxSize && h <= StickerMaxSize && filesize < StickerInMemory) {
|
||||
MTPDdocumentAttributeSticker::Flags stickerFlags = 0;
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(""), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(""), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
thumbFormat = "webp";
|
||||
thumbname = qsl("thumb.webp");
|
||||
}
|
||||
@ -535,7 +533,8 @@ void FileLoadTask::process() {
|
||||
}
|
||||
|
||||
if (isVoice) {
|
||||
attributes[0] = MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(_duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(_waveform)));
|
||||
auto flags = MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform;
|
||||
attributes[0] = MTP_documentAttributeAudio(MTP_flags(flags), MTP_int(_duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(_waveform)));
|
||||
attributes.resize(1);
|
||||
document = MTP_document(MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_string(filemime), MTP_int(filesize), thumbSize, MTP_int(MTP::maindc()), MTP_int(0), MTP_vector<MTPDocumentAttribute>(attributes));
|
||||
} else if (_type != SendMediaType::Photo) {
|
||||
|
@ -3457,8 +3457,7 @@ void importOldRecentStickers() {
|
||||
if (type == AnimatedDocument) {
|
||||
attributes.push_back(MTP_documentAttributeAnimated());
|
||||
} else if (type == StickerDocument) {
|
||||
MTPDdocumentAttributeSticker::Flags stickerFlags = 0;
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
}
|
||||
if (width > 0 && height > 0) {
|
||||
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(width), MTP_int(height)));
|
||||
|
@ -89,9 +89,8 @@ DocumentData *Document::readFromStreamHelper(int streamAppVersion, QDataStream &
|
||||
|
||||
thumb = readStorageImageLocation(stream);
|
||||
|
||||
MTPDdocumentAttributeSticker::Flags stickerFlags = 0;
|
||||
if (typeOfSet == StickerSetTypeEmpty) {
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
} else if (info) {
|
||||
if (info->setId == Stickers::DefaultSetId || info->setId == Stickers::CloudRecentSetId || info->setId == Stickers::CustomSetId) {
|
||||
typeOfSet = StickerSetTypeEmpty;
|
||||
@ -99,14 +98,14 @@ DocumentData *Document::readFromStreamHelper(int streamAppVersion, QDataStream &
|
||||
|
||||
switch (typeOfSet) {
|
||||
case StickerSetTypeID: {
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(alt), MTP_inputStickerSetID(MTP_long(info->setId), MTP_long(info->accessHash)), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(alt), MTP_inputStickerSetID(MTP_long(info->setId), MTP_long(info->accessHash)), MTPMaskCoords()));
|
||||
} break;
|
||||
case StickerSetTypeShortName: {
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(alt), MTP_inputStickerSetShortName(MTP_string(info->shortName)), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(alt), MTP_inputStickerSetShortName(MTP_string(info->shortName)), MTPMaskCoords()));
|
||||
} break;
|
||||
case StickerSetTypeEmpty:
|
||||
default: {
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(stickerFlags), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
attributes.push_back(MTP_documentAttributeSticker(MTP_flags(0), MTP_string(alt), MTP_inputStickerSetEmpty(), MTPMaskCoords()));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user