mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Update API scheme on layer 135.
This commit is contained in:
parent
7d89952541
commit
4f7c728632
19 changed files with 141 additions and 104 deletions
|
@ -222,7 +222,7 @@ inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags
|
|||
|
||||
peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
|
||||
|
||||
peerSettings#733f2961 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int = PeerSettings;
|
||||
peerSettings#a8228d2e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int request_chat:flags.9?Peer request_chat_date:flags.9?int = PeerSettings;
|
||||
|
||||
wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
|
||||
wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;
|
||||
|
@ -236,7 +236,7 @@ inputReportReasonCopyright#9b89f93a = ReportReason;
|
|||
inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
|
||||
inputReportReasonFake#f5ddd6e7 = ReportReason;
|
||||
|
||||
userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;
|
||||
userFull#cf366521 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true id:long about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string = UserFull;
|
||||
|
||||
contact#145ade0b user_id:long mutual:Bool = Contact;
|
||||
|
||||
|
@ -568,6 +568,7 @@ inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
|
|||
stickerSet#d7df217a flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int count:int hash:int = StickerSet;
|
||||
|
||||
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
|
||||
messages.stickerSetNotModified#d3f924eb = messages.StickerSet;
|
||||
|
||||
botCommand#c27ac8c7 command:string description:string = BotCommand;
|
||||
|
||||
|
@ -1292,6 +1293,10 @@ messages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResult
|
|||
|
||||
channels.sendAsPeers#8356cda9 peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;
|
||||
|
||||
users.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull;
|
||||
|
||||
messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Vector<User> = messages.PeerSettings;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
|
@ -1397,7 +1402,7 @@ account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool;
|
|||
account.changeAuthorizationSettings#432910d5 hash:long encrypted_requests_disabled:Bool = Bool;
|
||||
|
||||
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
|
||||
users.getFullUser#ca30a5b1 id:InputUser = UserFull;
|
||||
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
|
||||
users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
|
||||
|
||||
contacts.getContactIDs#7adc669d hash:long = Vector<int>;
|
||||
|
@ -1434,7 +1439,7 @@ messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true
|
|||
messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.forwardMessages#cc30290b flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.reportSpam#cf1592db peer:InputPeer = Bool;
|
||||
messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
|
||||
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
|
||||
messages.report#8953ab4e peer:InputPeer id:Vector<int> reason:ReportReason message:string = Bool;
|
||||
messages.getChats#49e9528f id:Vector<long> = messages.Chats;
|
||||
messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull;
|
||||
|
@ -1461,7 +1466,7 @@ messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vect
|
|||
messages.exportChatInvite#a02ce5d5 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string = ExportedChatInvite;
|
||||
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
|
||||
messages.importChatInvite#6c50051c hash:string = Updates;
|
||||
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
|
||||
messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet;
|
||||
messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;
|
||||
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
|
||||
messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
|
||||
|
@ -1614,8 +1619,7 @@ help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;
|
|||
|
||||
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
||||
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
||||
channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
|
||||
channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
|
||||
channels.reportSpam#f44a8315 channel:InputChannel participant:InputPeer id:Vector<int> = Bool;
|
||||
channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;
|
||||
channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants;
|
||||
channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;
|
||||
|
@ -1651,6 +1655,7 @@ channels.convertToGigagroup#b290c69 channel:InputChannel = Updates;
|
|||
channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool;
|
||||
channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages;
|
||||
channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers;
|
||||
channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory;
|
||||
|
||||
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||
|
|
|
@ -2214,7 +2214,11 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
////// Cloud sticker sets
|
||||
case mtpc_updateNewStickerSet: {
|
||||
const auto &d = update.c_updateNewStickerSet();
|
||||
session().data().stickers().newSetReceived(d.vstickerset());
|
||||
d.vstickerset().match([&](const MTPDmessages_stickerSet &data) {
|
||||
session().data().stickers().newSetReceived(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
} break;
|
||||
|
||||
case mtpc_updateStickerSetsOrder: {
|
||||
|
|
|
@ -1040,7 +1040,11 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
|
|||
}
|
||||
return request(MTPusers_GetFullUser(
|
||||
user->inputUser
|
||||
)).done([=](const MTPUserFull &result, mtpRequestId requestId) {
|
||||
)).done([=](const MTPusers_UserFull &result, mtpRequestId requestId) {
|
||||
result.match([&](const MTPDusers_userFull &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
_session->data().processChats(data.vchats());
|
||||
});
|
||||
gotUserFull(user, result, requestId);
|
||||
}).fail(failHandler).send();
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
|
@ -1072,12 +1076,6 @@ void ApiWrap::processFullPeer(
|
|||
gotChatFull(peer, result, mtpRequestId(0));
|
||||
}
|
||||
|
||||
void ApiWrap::processFullPeer(
|
||||
not_null<UserData*> user,
|
||||
const MTPUserFull &result) {
|
||||
gotUserFull(user, result, mtpRequestId(0));
|
||||
}
|
||||
|
||||
void ApiWrap::gotChatFull(
|
||||
not_null<PeerData*> peer,
|
||||
const MTPmessages_ChatFull &result,
|
||||
|
@ -1117,18 +1115,20 @@ void ApiWrap::gotChatFull(
|
|||
|
||||
void ApiWrap::gotUserFull(
|
||||
not_null<UserData*> user,
|
||||
const MTPUserFull &result,
|
||||
const MTPusers_UserFull &result,
|
||||
mtpRequestId req) {
|
||||
const auto &d = result.c_userFull();
|
||||
if (user == _session->user() && !_session->validateSelf(d.vuser())) {
|
||||
constexpr auto kRequestUserAgainTimeout = crl::time(10000);
|
||||
base::call_delayed(kRequestUserAgainTimeout, _session, [=] {
|
||||
requestFullPeer(user);
|
||||
result.match([&](const MTPDusers_userFull &data) {
|
||||
data.vfull_user().match([&](const MTPDuserFull &fields) {
|
||||
if (user == _session->user() && !_session->validateSelf(fields.vid().v)) {
|
||||
constexpr auto kRequestUserAgainTimeout = crl::time(10000);
|
||||
base::call_delayed(kRequestUserAgainTimeout, _session, [=] {
|
||||
requestFullPeer(user);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Data::ApplyUserUpdate(user, fields);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Data::ApplyUserUpdate(user, d);
|
||||
|
||||
});
|
||||
if (req) {
|
||||
const auto i = _fullPeerRequests.find(user);
|
||||
if (i != _fullPeerRequests.cend() && i.value() == req) {
|
||||
|
@ -1184,9 +1184,13 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
|||
}
|
||||
request(MTPmessages_GetPeerSettings(
|
||||
peer->input
|
||||
)).done([=](const MTPPeerSettings &result) {
|
||||
peer->setSettings(result);
|
||||
_requestedPeerSettings.erase(peer);
|
||||
)).done([=](const MTPmessages_PeerSettings &result) {
|
||||
result.match([&](const MTPDmessages_peerSettings &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
_session->data().processChats(data.vchats());
|
||||
peer->setSettings(data.vsettings());
|
||||
_requestedPeerSettings.erase(peer);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestedPeerSettings.erase(peer);
|
||||
}).send();
|
||||
|
@ -1775,9 +1779,9 @@ void ApiWrap::deleteAllFromUser(
|
|||
void ApiWrap::deleteAllFromUserSend(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> from) {
|
||||
request(MTPchannels_DeleteUserHistory(
|
||||
request(MTPchannels_DeleteParticipantHistory(
|
||||
channel->inputChannel,
|
||||
from->inputUser
|
||||
from->input
|
||||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
||||
const auto offset = applyAffectedHistory(channel, result);
|
||||
if (offset > 0) {
|
||||
|
@ -1834,7 +1838,8 @@ void ApiWrap::requestStickerSets() {
|
|||
MTP_long(i.key()),
|
||||
MTP_long(i.value().first));
|
||||
i.value().second = request(MTPmessages_GetStickerSet(
|
||||
id
|
||||
id,
|
||||
MTP_int(0) // hash
|
||||
)).done([=, setId = i.key()](const MTPmessages_StickerSet &result) {
|
||||
gotStickerSet(setId, result);
|
||||
}).fail([=, setId = i.key()](const MTP::Error &error) {
|
||||
|
@ -2589,7 +2594,11 @@ void ApiWrap::applyNotifySettings(
|
|||
|
||||
void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) {
|
||||
_stickerSetRequests.remove(setId);
|
||||
_session->data().stickers().feedSetFull(result);
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
_session->data().stickers().feedSetFull(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}
|
||||
|
||||
void ApiWrap::requestWebPageDelayed(WebPageData *page) {
|
||||
|
@ -2846,7 +2855,8 @@ void ApiWrap::refreshFileReference(
|
|||
request(MTPmessages_GetStickerSet(
|
||||
MTP_inputStickerSetID(
|
||||
MTP_long(data.setId),
|
||||
MTP_long(data.accessHash))),
|
||||
MTP_long(data.accessHash)),
|
||||
MTP_int(0)), // hash
|
||||
[=] { crl::on_main(_session, [=] {
|
||||
local().writeInstalledStickers();
|
||||
local().writeRecentStickers();
|
||||
|
|
|
@ -210,9 +210,6 @@ public:
|
|||
void processFullPeer(
|
||||
not_null<PeerData*> peer,
|
||||
const MTPmessages_ChatFull &result);
|
||||
void processFullPeer(
|
||||
not_null<UserData*> user,
|
||||
const MTPUserFull &result);
|
||||
|
||||
void migrateChat(
|
||||
not_null<ChatData*> chat,
|
||||
|
@ -459,7 +456,7 @@ private:
|
|||
mtpRequestId req);
|
||||
void gotUserFull(
|
||||
not_null<UserData*> user,
|
||||
const MTPUserFull &result,
|
||||
const MTPusers_UserFull &result,
|
||||
mtpRequestId req);
|
||||
void applyLastParticipantsList(
|
||||
not_null<ChannelData*> channel,
|
||||
|
|
|
@ -487,7 +487,7 @@ void DeleteMessagesBox::deleteAndClear() {
|
|||
_moderateInChannel->session().api().request(
|
||||
MTPchannels_ReportSpam(
|
||||
_moderateInChannel->inputChannel,
|
||||
_moderateFrom->inputUser,
|
||||
_moderateFrom->input,
|
||||
MTP_vector<MTPint>(1, MTP_int(_ids[0].msg)))
|
||||
).send();
|
||||
}
|
||||
|
|
|
@ -367,7 +367,8 @@ StickerSetBox::Inner::Inner(
|
|||
, _input(set)
|
||||
, _previewTimer([=] { showPreview(); }) {
|
||||
_api.request(MTPmessages_GetStickerSet(
|
||||
Data::InputStickerSet(_input)
|
||||
Data::InputStickerSet(_input),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
gotSet(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
|
@ -463,6 +464,8 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) {
|
|||
set->setThumbnail(_setThumbnail);
|
||||
}
|
||||
});
|
||||
}, [&](const MTPDmessages_stickerSetNotModified &data) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
|
||||
if (_pack.isEmpty()) {
|
||||
|
|
|
@ -1887,11 +1887,16 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
|
|||
}
|
||||
} else if (!_megagroupSetRequestId) {
|
||||
_megagroupSetRequestId = _api.request(MTPmessages_GetStickerSet(
|
||||
MTP_inputStickerSetShortName(MTP_string(text))
|
||||
MTP_inputStickerSetShortName(MTP_string(text)),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
_megagroupSetRequestId = 0;
|
||||
auto set = session().data().stickers().feedSetFull(result);
|
||||
setMegagroupSelectedSet(set->identifier());
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
const auto set = session().data().stickers().feedSetFull(data);
|
||||
setMegagroupSelectedSet(set->identifier());
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_megagroupSetRequestId = 0;
|
||||
setMegagroupSelectedSet({});
|
||||
|
|
|
@ -47,10 +47,13 @@ void DicePack::load() {
|
|||
return;
|
||||
}
|
||||
_requestId = _session->api().request(MTPmessages_GetStickerSet(
|
||||
MTP_inputStickerSetDice(MTP_string(_emoji))
|
||||
MTP_inputStickerSetDice(MTP_string(_emoji)),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
applySet(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
|
|
|
@ -231,12 +231,15 @@ void EmojiPack::refresh() {
|
|||
return;
|
||||
}
|
||||
_requestId = _session->api().request(MTPmessages_GetStickerSet(
|
||||
MTP_inputStickerSetAnimatedEmoji()
|
||||
MTP_inputStickerSetAnimatedEmoji(),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
_requestId = 0;
|
||||
refreshAnimations();
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
applySet(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
|
@ -249,12 +252,15 @@ void EmojiPack::refreshAnimations() {
|
|||
return;
|
||||
}
|
||||
_animationsRequestId = _session->api().request(MTPmessages_GetStickerSet(
|
||||
MTP_inputStickerSetAnimatedEmojiAnimations()
|
||||
MTP_inputStickerSetAnimatedEmojiAnimations(),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
_animationsRequestId = 0;
|
||||
refreshDelayed();
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
applyAnimationsSet(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_animationsRequestId = 0;
|
||||
|
|
|
@ -2778,16 +2778,21 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
|
|||
}
|
||||
_megagroupSetIdRequested = set.id;
|
||||
_api.request(MTPmessages_GetStickerSet(
|
||||
Data::InputStickerSet(set)
|
||||
Data::InputStickerSet(set),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
if (const auto set = session().data().stickers().feedSetFull(result)) {
|
||||
refreshStickers();
|
||||
if (set->id == _megagroupSetIdRequested) {
|
||||
_megagroupSetIdRequested = 0;
|
||||
} else {
|
||||
LOG(("API Error: Got different set."));
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
if (const auto set = session().data().stickers().feedSetFull(data)) {
|
||||
refreshStickers();
|
||||
if (set->id == _megagroupSetIdRequested) {
|
||||
_megagroupSetIdRequested = 0;
|
||||
} else {
|
||||
LOG(("API Error: Got different set."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -3117,9 +3122,14 @@ void StickersListWidget::installSet(uint64 setId) {
|
|||
const auto input = set->mtpInput();
|
||||
if ((set->flags & SetFlag::NotLoaded) || set->stickers.empty()) {
|
||||
_api.request(MTPmessages_GetStickerSet(
|
||||
input
|
||||
input,
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
session().data().stickers().feedSetFull(result);
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
session().data().stickers().feedSetFull(data);
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
sendInstallRequest(setId, input);
|
||||
}).send();
|
||||
} else {
|
||||
|
|
|
@ -140,6 +140,7 @@ struct FileReferenceAccumulator {
|
|||
void push(const MTPmessages_StickerSet &data) {
|
||||
data.match([&](const MTPDmessages_stickerSet &data) {
|
||||
push(data.vdocuments());
|
||||
}, [](const MTPDmessages_stickerSetNotModified &data) {
|
||||
});
|
||||
}
|
||||
void push(const MTPmessages_SavedGifs &data) {
|
||||
|
|
|
@ -188,7 +188,6 @@ bool UserData::hasCalls() const {
|
|||
namespace Data {
|
||||
|
||||
void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
|
||||
user->owner().processUser(update.vuser());
|
||||
if (const auto photo = update.vprofile_photo()) {
|
||||
user->owner().processPhoto(*photo);
|
||||
}
|
||||
|
|
|
@ -518,25 +518,27 @@ void Stickers::requestSetToPushFaved(not_null<DocumentData*> document) {
|
|||
setIsFaved(document, std::move(list));
|
||||
};
|
||||
session().api().request(MTPmessages_GetStickerSet(
|
||||
Data::InputStickerSet(document->sticker()->set)
|
||||
Data::InputStickerSet(document->sticker()->set),
|
||||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
Expects(result.type() == mtpc_messages_stickerSet);
|
||||
|
||||
auto list = std::vector<not_null<EmojiPtr>>();
|
||||
auto &d = result.c_messages_stickerSet();
|
||||
list.reserve(d.vpacks().v.size());
|
||||
for (const auto &mtpPack : d.vpacks().v) {
|
||||
auto &pack = mtpPack.c_stickerPack();
|
||||
for (const auto &documentId : pack.vdocuments().v) {
|
||||
if (documentId.v == document->id) {
|
||||
if (const auto emoji = Ui::Emoji::Find(qs(mtpPack.c_stickerPack().vemoticon()))) {
|
||||
list.emplace_back(emoji);
|
||||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
auto list = std::vector<not_null<EmojiPtr>>();
|
||||
list.reserve(data.vpacks().v.size());
|
||||
for (const auto &mtpPack : data.vpacks().v) {
|
||||
auto &pack = mtpPack.c_stickerPack();
|
||||
for (const auto &documentId : pack.vdocuments().v) {
|
||||
if (documentId.v == document->id) {
|
||||
if (const auto emoji = Ui::Emoji::Find(qs(mtpPack.c_stickerPack().vemoticon()))) {
|
||||
list.emplace_back(emoji);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
addAnyway(std::move(list));
|
||||
addAnyway(std::move(list));
|
||||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
// Perhaps this is a deleted sticker pack. Add anyway.
|
||||
addAnyway({});
|
||||
|
@ -1230,11 +1232,9 @@ StickersSet *Stickers::feedSet(const MTPDstickerSet &data) {
|
|||
return it->second.get();
|
||||
}
|
||||
|
||||
StickersSet *Stickers::feedSetFull(const MTPmessages_StickerSet &data) {
|
||||
Expects(data.type() == mtpc_messages_stickerSet);
|
||||
Expects(data.c_messages_stickerSet().vset().type() == mtpc_stickerSet);
|
||||
StickersSet *Stickers::feedSetFull(const MTPDmessages_stickerSet &d) {
|
||||
Expects(d.vset().type() == mtpc_stickerSet);
|
||||
|
||||
const auto &d = data.c_messages_stickerSet();
|
||||
const auto &s = d.vset().c_stickerSet();
|
||||
|
||||
auto &sets = setsRef();
|
||||
|
@ -1353,8 +1353,7 @@ StickersSet *Stickers::feedSetFull(const MTPmessages_StickerSet &data) {
|
|||
return set;
|
||||
}
|
||||
|
||||
void Stickers::newSetReceived(const MTPmessages_StickerSet &data) {
|
||||
const auto &set = data.c_messages_stickerSet();
|
||||
void Stickers::newSetReceived(const MTPDmessages_stickerSet &set) {
|
||||
const auto &s = set.vset().c_stickerSet();
|
||||
if (!s.vinstalled_date()) {
|
||||
LOG(("API Error: "
|
||||
|
@ -1374,7 +1373,7 @@ void Stickers::newSetReceived(const MTPmessages_StickerSet &data) {
|
|||
order.insert(insertAtIndex, s.vid().v);
|
||||
}
|
||||
|
||||
feedSetFull(data);
|
||||
feedSetFull(set);
|
||||
}
|
||||
|
||||
QString Stickers::getSetTitle(const MTPDstickerSet &s) {
|
||||
|
|
|
@ -198,8 +198,8 @@ public:
|
|||
not_null<DocumentData*> document);
|
||||
|
||||
StickersSet *feedSet(const MTPDstickerSet &data);
|
||||
StickersSet *feedSetFull(const MTPmessages_StickerSet &data);
|
||||
void newSetReceived(const MTPmessages_StickerSet &data);
|
||||
StickersSet *feedSetFull(const MTPDmessages_stickerSet &d);
|
||||
void newSetReceived(const MTPDmessages_stickerSet &set);
|
||||
|
||||
QString getSetTitle(const MTPDstickerSet &s);
|
||||
|
||||
|
|
|
@ -1283,15 +1283,14 @@ std::map<MessageId, Message> ParseMessagesList(
|
|||
return result;
|
||||
}
|
||||
|
||||
PersonalInfo ParsePersonalInfo(const MTPUserFull &data) {
|
||||
Expects(data.type() == mtpc_userFull);
|
||||
|
||||
const auto &fields = data.c_userFull();
|
||||
PersonalInfo ParsePersonalInfo(const MTPDusers_userFull &data) {
|
||||
auto result = PersonalInfo();
|
||||
result.user = ParseUser(fields.vuser());
|
||||
if (const auto about = fields.vabout()) {
|
||||
result.bio = ParseString(*about);
|
||||
}
|
||||
result.user = ParseUser(data.vusers().v[0]);
|
||||
data.vfull_user().match([&](const MTPDuserFull &data) {
|
||||
if (const auto about = data.vabout()) {
|
||||
result.bio = ParseString(*about);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ struct PersonalInfo {
|
|||
Utf8String bio;
|
||||
};
|
||||
|
||||
PersonalInfo ParsePersonalInfo(const MTPUserFull &data);
|
||||
PersonalInfo ParsePersonalInfo(const MTPDusers_userFull &data);
|
||||
|
||||
struct TopPeer {
|
||||
Peer peer;
|
||||
|
|
|
@ -674,15 +674,14 @@ void ApiWrap::startMainSession(FnMut<void()> done) {
|
|||
void ApiWrap::requestPersonalInfo(FnMut<void(Data::PersonalInfo&&)> done) {
|
||||
mainRequest(MTPusers_GetFullUser(
|
||||
_user
|
||||
)).done([=, done = std::move(done)](const MTPUserFull &result) mutable {
|
||||
Expects(result.type() == mtpc_userFull);
|
||||
|
||||
const auto &full = result.c_userFull();
|
||||
if (full.vuser().type() == mtpc_user) {
|
||||
done(Data::ParsePersonalInfo(result));
|
||||
} else {
|
||||
error("Bad user type.");
|
||||
}
|
||||
)).done([=, done = std::move(done)](const MTPusers_UserFull &result) mutable {
|
||||
result.match([&](const MTPDusers_userFull &data) {
|
||||
if (!data.vusers().v.empty()) {
|
||||
done(Data::ParsePersonalInfo(data));
|
||||
} else {
|
||||
error("Bad user type.");
|
||||
}
|
||||
});
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
|
|
@ -220,11 +220,8 @@ PeerId Session::userPeerId() const {
|
|||
return _user->id;
|
||||
}
|
||||
|
||||
bool Session::validateSelf(const MTPUser &user) {
|
||||
if (user.type() != mtpc_user || !user.c_user().is_self()) {
|
||||
LOG(("API Error: bad self user received."));
|
||||
return false;
|
||||
} else if (UserId(user.c_user().vid()) != userId()) {
|
||||
bool Session::validateSelf(UserId id) {
|
||||
if (id != userId()) {
|
||||
LOG(("Auth Error: wrong self user received."));
|
||||
crl::on_main(this, [=] { _account->logOut(); });
|
||||
return false;
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
[[nodiscard]] not_null<UserData*> user() const {
|
||||
return _user;
|
||||
}
|
||||
bool validateSelf(const MTPUser &user);
|
||||
bool validateSelf(UserId id);
|
||||
|
||||
[[nodiscard]] Data::Changes &changes() const {
|
||||
return *_changes;
|
||||
|
|
Loading…
Add table
Reference in a new issue