mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Update API scheme to layer 82.
This commit is contained in:
parent
941288b58e
commit
ff53404d5b
@ -167,7 +167,7 @@ inputMediaEmpty#9664f57f = InputMedia;
|
||||
inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
|
||||
inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
|
||||
inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia;
|
||||
inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
|
||||
inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
|
||||
inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
|
||||
@ -253,7 +253,7 @@ messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_un
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
||||
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
|
||||
messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia;
|
||||
messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;
|
||||
messageMediaUnsupported#9f84f49e = MessageMedia;
|
||||
messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
|
||||
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
|
||||
@ -285,7 +285,7 @@ messageActionBotAllowed#abe9affe domain:string = MessageAction;
|
||||
messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;
|
||||
messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;
|
||||
|
||||
dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
|
||||
dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
|
||||
|
||||
photoEmpty#2331b22d id:long = Photo;
|
||||
photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo;
|
||||
@ -295,7 +295,7 @@ photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = Phot
|
||||
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
|
||||
|
||||
geoPointEmpty#1117dd5f = GeoPoint;
|
||||
geoPoint#2049d70c long:double lat:double = GeoPoint;
|
||||
geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
|
||||
|
||||
auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone;
|
||||
|
||||
@ -345,6 +345,7 @@ contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Ve
|
||||
|
||||
messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
|
||||
messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
|
||||
messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;
|
||||
|
||||
messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
|
||||
@ -441,6 +442,7 @@ updateFavedStickers#e511996d = Update;
|
||||
updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;
|
||||
updateContactsReset#7084a7be = Update;
|
||||
updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
|
||||
updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
@ -467,7 +469,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes
|
||||
|
||||
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
|
||||
|
||||
config#eb7bb160 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config;
|
||||
config#3213dbba flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@ -694,7 +696,7 @@ inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?
|
||||
inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
|
||||
inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
|
||||
@ -706,7 +708,7 @@ botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vecto
|
||||
botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
|
||||
botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
|
||||
botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
|
||||
@ -749,8 +751,9 @@ topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<To
|
||||
|
||||
contacts.topPeersNotModified#de266ef5 = contacts.TopPeers;
|
||||
contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;
|
||||
contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
|
||||
|
||||
draftMessageEmpty#ba4baec5 = DraftMessage;
|
||||
draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
|
||||
draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
|
||||
|
||||
messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
|
||||
@ -838,12 +841,13 @@ paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string e
|
||||
|
||||
paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;
|
||||
|
||||
webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> dc_id:int = WebDocument;
|
||||
webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
|
||||
webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
|
||||
|
||||
inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;
|
||||
|
||||
inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;
|
||||
inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
|
||||
|
||||
upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
|
||||
|
||||
@ -1106,9 +1110,10 @@ contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.
|
||||
contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool;
|
||||
contacts.resetSaved#879537f1 = Bool;
|
||||
contacts.getSaved#82f1e39f = Vector<SavedContact>;
|
||||
contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
|
||||
|
||||
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
|
||||
messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs;
|
||||
messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;
|
||||
messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
||||
messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
||||
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
|
||||
@ -1204,6 +1209,8 @@ messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?
|
||||
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
|
||||
messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets;
|
||||
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
|
||||
messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;
|
||||
messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
|
||||
@ -1301,4 +1308,4 @@ langpack.getStrings#2e1ee318 lang_code:string keys:Vector<string> = Vector<LangP
|
||||
langpack.getDifference#b2e4d7d from_version:int = LangPackDifference;
|
||||
langpack.getLanguages#800fd57d = Vector<LangPackLanguage>;
|
||||
|
||||
// LAYER 81
|
||||
// LAYER 82
|
||||
|
@ -566,13 +566,15 @@ void ApiWrap::requestDialogEntry(not_null<Data::Feed*> feed) {
|
||||
// }
|
||||
// _dialogFeedRequests.emplace(feed);
|
||||
//
|
||||
// const auto hash = 0;
|
||||
// request(MTPmessages_GetDialogs(
|
||||
// MTP_flags(MTPmessages_GetDialogs::Flag::f_feed_id),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_int(0), // offset_date
|
||||
// MTP_int(0), // offset_id
|
||||
// MTP_inputPeerEmpty(), // offset_peer
|
||||
// MTP_int(Data::Feed::kChannelsLimit)
|
||||
// MTP_int(Data::Feed::kChannelsLimit),
|
||||
// MTP_int(hash)
|
||||
// )).done([=](const MTPmessages_Dialogs &result) {
|
||||
// applyFeedDialogs(feed, result);
|
||||
// _dialogFeedRequests.remove(feed);
|
||||
@ -3777,6 +3779,8 @@ void ApiWrap::sendSharedContact(
|
||||
const auto messagePostAuthor = channelPost
|
||||
? (_session->user()->firstName + ' ' + _session->user()->lastName)
|
||||
: QString();
|
||||
const auto vcard = QString();
|
||||
const auto views = 1;
|
||||
const auto item = history->addNewMessage(
|
||||
MTP_message(
|
||||
MTP_flags(flags),
|
||||
@ -3792,10 +3796,11 @@ void ApiWrap::sendSharedContact(
|
||||
MTP_string(phone),
|
||||
MTP_string(firstName),
|
||||
MTP_string(lastName),
|
||||
MTP_string(vcard),
|
||||
MTP_int(userId)),
|
||||
MTPnullMarkup,
|
||||
MTPnullEntities,
|
||||
MTP_int(1),
|
||||
MTP_int(views),
|
||||
MTPint(),
|
||||
MTP_string(messagePostAuthor),
|
||||
MTPlong()),
|
||||
@ -3804,7 +3809,8 @@ void ApiWrap::sendSharedContact(
|
||||
const auto media = MTP_inputMediaContact(
|
||||
MTP_string(phone),
|
||||
MTP_string(firstName),
|
||||
MTP_string(lastName));
|
||||
MTP_string(lastName),
|
||||
MTP_string(vcard));
|
||||
sendMedia(item, media, _session->data().notifySilentPosts(peer));
|
||||
|
||||
if (const auto main = App::main()) {
|
||||
|
@ -55,7 +55,7 @@ addChildParentFlags('MTPDchannelForbidden', 'MTPDchannel');
|
||||
parentFlagsCheck = {};
|
||||
|
||||
countedTypeIdExceptions = {};
|
||||
for i in range(77, 82):
|
||||
for i in range(77, 83):
|
||||
countedTypeIdExceptions[i] = {}
|
||||
countedTypeIdExceptions[i]['channel'] = True
|
||||
countedTypeIdExceptions['ipPortSecret'] = True
|
||||
|
@ -68,8 +68,11 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
||||
}
|
||||
}
|
||||
|
||||
void clearPeerCloudDraft(PeerId peerId) {
|
||||
auto history = App::history(peerId);
|
||||
void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
||||
const auto history = App::history(peerId);
|
||||
if (history->skipCloudDraft(QString(), date)) {
|
||||
return;
|
||||
}
|
||||
|
||||
history->clearCloudDraft();
|
||||
history->clearLocalDraft();
|
||||
|
@ -14,7 +14,7 @@ class InputField;
|
||||
namespace Data {
|
||||
|
||||
void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft);
|
||||
void clearPeerCloudDraft(PeerId peerId);
|
||||
void clearPeerCloudDraft(PeerId peerId, TimeId date);
|
||||
|
||||
struct Draft {
|
||||
Draft() = default;
|
||||
|
@ -1082,7 +1082,7 @@ DocumentData *Session::documentFromWeb(
|
||||
int32(0), // data.vsize.v
|
||||
StorageImageLocation());
|
||||
result->setWebLocation(WebFileLocation(
|
||||
data.vdc_id.v,
|
||||
Global::WebFileDcId(),
|
||||
data.vurl.v,
|
||||
data.vaccess_hash.v));
|
||||
return result;
|
||||
|
@ -738,6 +738,7 @@ void DialogsWidget::loadDialogs() {
|
||||
const auto loadCount = firstLoad ? DialogsFirstLoad : DialogsPerPage;
|
||||
const auto flags = MTPmessages_GetDialogs::Flag::f_exclude_pinned;
|
||||
const auto feedId = 0;
|
||||
const auto hash = 0;
|
||||
_dialogsRequestId = MTP::send(
|
||||
MTPmessages_GetDialogs(
|
||||
MTP_flags(flags),
|
||||
@ -747,7 +748,8 @@ void DialogsWidget::loadDialogs() {
|
||||
_dialogsOffsetPeer
|
||||
? _dialogsOffsetPeer->input
|
||||
: MTP_inputPeerEmpty(),
|
||||
MTP_int(loadCount)),
|
||||
MTP_int(loadCount),
|
||||
MTP_int(hash)),
|
||||
rpcDone(&DialogsWidget::dialogsReceived),
|
||||
rpcFail(&DialogsWidget::dialogsFailed));
|
||||
if (!_pinnedDialogsReceived) {
|
||||
|
@ -995,6 +995,8 @@ std::vector<int> SortedContactsIndices(const ContactsList &data) {
|
||||
bool AppendTopPeers(ContactsList &to, const MTPcontacts_TopPeers &data) {
|
||||
return data.match([](const MTPDcontacts_topPeersNotModified &data) {
|
||||
return false;
|
||||
}, [](const MTPDcontacts_topPeersDisabled &data) {
|
||||
return true;
|
||||
}, [&](const MTPDcontacts_topPeers &data) {
|
||||
const auto peers = ParsePeersLists(data.vusers, data.vchats);
|
||||
const auto append = [&](
|
||||
@ -1128,7 +1130,9 @@ DialogInfo::Type DialogTypeFromUser(const User &user) {
|
||||
DialogsInfo ParseDialogsInfo(const MTPmessages_Dialogs &data) {
|
||||
auto result = DialogsInfo();
|
||||
const auto folder = QString();
|
||||
data.match([&](const auto &data) { // MTPDmessages_dialogs &data) {
|
||||
data.match([](const MTPDmessages_dialogsNotModified &data) {
|
||||
Unexpected("dialogsNotModified in ParseDialogsInfo.");
|
||||
}, [&](const auto &data) { // MTPDmessages_dialogs &data) {
|
||||
const auto peers = ParsePeersLists(data.vusers, data.vchats);
|
||||
const auto messages = ParseMessagesList(data.vmessages, folder);
|
||||
result.list.reserve(result.list.size() + data.vdialogs.v.size());
|
||||
|
@ -402,22 +402,35 @@ void ApiWrap::requestSplitRanges() {
|
||||
void ApiWrap::requestDialogsCount() {
|
||||
Expects(_startProcess != nullptr);
|
||||
|
||||
const auto offsetDate = 0;
|
||||
const auto offsetId = 0;
|
||||
const auto offsetPeer = MTP_inputPeerEmpty();
|
||||
const auto limit = 1;
|
||||
const auto hash = 0;
|
||||
splitRequest(_startProcess->splitIndex, MTPmessages_GetDialogs(
|
||||
MTP_flags(0),
|
||||
MTP_int(0), // offset_date
|
||||
MTP_int(0), // offset_id
|
||||
MTP_inputPeerEmpty(), // offset_peer
|
||||
MTP_int(1)
|
||||
MTP_int(offsetDate),
|
||||
MTP_int(offsetId),
|
||||
offsetPeer,
|
||||
MTP_int(limit),
|
||||
MTP_int(hash)
|
||||
)).done([=](const MTPmessages_Dialogs &result) {
|
||||
Expects(_settings != nullptr);
|
||||
Expects(_startProcess != nullptr);
|
||||
|
||||
_startProcess->info.dialogsCount += result.match(
|
||||
const auto count = result.match(
|
||||
[](const MTPDmessages_dialogs &data) {
|
||||
return int(data.vdialogs.v.size());
|
||||
}, [](const MTPDmessages_dialogsSlice &data) {
|
||||
return data.vcount.v;
|
||||
}, [](const MTPDmessages_dialogsNotModified &data) {
|
||||
return -1;
|
||||
});
|
||||
if (count < 0) {
|
||||
error("Unexpected dialogsNotModified received.");
|
||||
return;
|
||||
}
|
||||
_startProcess->info.dialogsCount += count;
|
||||
|
||||
if (++_startProcess->splitIndex >= _splits.size()) {
|
||||
sendNextStartRequest();
|
||||
@ -751,6 +764,8 @@ void ApiWrap::requestTopPeersSlice() {
|
||||
const auto loaded = result.match(
|
||||
[](const MTPDcontacts_topPeersNotModified &data) {
|
||||
return true;
|
||||
}, [](const MTPDcontacts_topPeersDisabled &data) {
|
||||
return true;
|
||||
}, [&](const MTPDcontacts_topPeers &data) {
|
||||
for (const auto &category : data.vcategories.v) {
|
||||
const auto loaded = category.match(
|
||||
@ -865,18 +880,26 @@ void ApiWrap::requestDialogsSlice() {
|
||||
Expects(_dialogsProcess != nullptr);
|
||||
|
||||
const auto splitIndex = _dialogsProcess->splitIndexPlusOne - 1;
|
||||
const auto hash = 0;
|
||||
splitRequest(splitIndex, MTPmessages_GetDialogs(
|
||||
MTP_flags(0),
|
||||
MTP_int(_dialogsProcess->offsetDate),
|
||||
MTP_int(_dialogsProcess->offsetId),
|
||||
_dialogsProcess->offsetPeer,
|
||||
MTP_int(kChatsSliceLimit)
|
||||
MTP_int(kChatsSliceLimit),
|
||||
MTP_int(hash)
|
||||
)).done([=](const MTPmessages_Dialogs &result) {
|
||||
if (result.type() == mtpc_messages_dialogsNotModified) {
|
||||
error("Unexpected dialogsNotModified received.");
|
||||
return;
|
||||
}
|
||||
auto finished = result.match(
|
||||
[](const MTPDmessages_dialogs &data) {
|
||||
return true;
|
||||
}, [](const MTPDmessages_dialogsSlice &data) {
|
||||
return data.vdialogs.v.isEmpty();
|
||||
}, [](const MTPDmessages_dialogsNotModified &data) {
|
||||
return true;
|
||||
});
|
||||
|
||||
auto info = Data::ParseDialogsInfo(result);
|
||||
|
@ -522,6 +522,10 @@ struct Data {
|
||||
int32 CallRingTimeoutMs = 90000;
|
||||
int32 CallConnectTimeoutMs = 30000;
|
||||
int32 CallPacketTimeoutMs = 10000;
|
||||
int32 WebFileDcId = cTestMode() ? 2 : 4;
|
||||
QString TxtDomainString = cTestMode()
|
||||
? qsl("testapv2.stel.com")
|
||||
: qsl("apv2.stel.com");
|
||||
bool PhoneCallsEnabled = true;
|
||||
bool BlockedMode = false;
|
||||
base::Observable<void> PhoneCallsEnabledChanged;
|
||||
@ -650,6 +654,8 @@ DefineVar(Global, int32, CallReceiveTimeoutMs);
|
||||
DefineVar(Global, int32, CallRingTimeoutMs);
|
||||
DefineVar(Global, int32, CallConnectTimeoutMs);
|
||||
DefineVar(Global, int32, CallPacketTimeoutMs);
|
||||
DefineVar(Global, int32, WebFileDcId);
|
||||
DefineVar(Global, QString, TxtDomainString);
|
||||
DefineVar(Global, bool, PhoneCallsEnabled);
|
||||
DefineVar(Global, bool, BlockedMode);
|
||||
DefineRefVar(Global, base::Observable<void>, PhoneCallsEnabledChanged);
|
||||
|
@ -277,6 +277,8 @@ DeclareVar(int32, CallReceiveTimeoutMs);
|
||||
DeclareVar(int32, CallRingTimeoutMs);
|
||||
DeclareVar(int32, CallConnectTimeoutMs);
|
||||
DeclareVar(int32, CallPacketTimeoutMs);
|
||||
DeclareVar(int32, WebFileDcId);
|
||||
DeclareVar(QString, TxtDomainString);
|
||||
DeclareVar(bool, PhoneCallsEnabled);
|
||||
DeclareVar(bool, BlockedMode);
|
||||
DeclareRefVar(base::Observable<void>, PhoneCallsEnabledChanged);
|
||||
|
@ -13,9 +13,10 @@ void deinitLocationManager();
|
||||
class LocationCoords {
|
||||
public:
|
||||
LocationCoords() = default;
|
||||
LocationCoords(float64 lat, float64 lon) : _lat(lat), _lon(lon) {
|
||||
}
|
||||
LocationCoords(const MTPDgeoPoint &point) : _lat(point.vlat.v), _lon(point.vlong.v) {
|
||||
explicit LocationCoords(const MTPDgeoPoint &point)
|
||||
: _lat(point.vlat.v)
|
||||
, _lon(point.vlong.v)
|
||||
, _access(point.vaccess_hash.v) {
|
||||
}
|
||||
|
||||
QString latAsString() const {
|
||||
@ -25,7 +26,10 @@ public:
|
||||
return asString(_lon);
|
||||
}
|
||||
MTPGeoPoint toMTP() const {
|
||||
return MTP_geoPoint(MTP_double(_lon), MTP_double(_lat));
|
||||
return MTP_geoPoint(
|
||||
MTP_double(_lon),
|
||||
MTP_double(_lat),
|
||||
MTP_long(_access));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -54,6 +58,7 @@ private:
|
||||
|
||||
float64 _lat = 0;
|
||||
float64 _lon = 0;
|
||||
uint64 _access = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -251,13 +251,15 @@ void NotificationsController::loadMoreRows() {
|
||||
if (_preloadRequestId || _allLoaded) {
|
||||
return;
|
||||
}
|
||||
// const auto hash = 0;
|
||||
//_preloadRequestId = request(MTPmessages_GetDialogs( // #feed
|
||||
// MTP_flags(MTPmessages_GetDialogs::Flag::f_feed_id),
|
||||
// MTP_int(_feed->id()),
|
||||
// MTP_int(_preloadOffsetDate),
|
||||
// MTP_int(_preloadOffsetId),
|
||||
// _preloadPeer ? _preloadPeer->input : MTP_inputPeerEmpty(),
|
||||
// MTP_int(Data::Feed::kChannelsLimit)
|
||||
// MTP_int(Data::Feed::kChannelsLimit),
|
||||
// MTP_int(hash)
|
||||
//)).done([=](const MTPmessages_Dialogs &result) {
|
||||
// applyFeedDialogs(result);
|
||||
// _preloadRequestId = 0;
|
||||
|
@ -366,8 +366,7 @@ MTPWebDocument Result::adjustAttributes(const MTPWebDocument &document) {
|
||||
data.vaccess_hash,
|
||||
data.vsize,
|
||||
data.vmime_type,
|
||||
adjustAttributes(data.vattributes, data.vmime_type),
|
||||
data.vdc_id);
|
||||
adjustAttributes(data.vattributes, data.vmime_type));
|
||||
} break;
|
||||
|
||||
case mtpc_webDocumentNoProxy: {
|
||||
|
@ -99,11 +99,14 @@ SendDataCommon::SentMTPMessageFields SendVenue::getSentMessageFields() const {
|
||||
|
||||
SendDataCommon::SentMTPMessageFields SendContact::getSentMessageFields() const {
|
||||
SentMTPMessageFields result;
|
||||
const auto userId = 0;
|
||||
const auto vcard = QString();
|
||||
result.media = MTP_messageMediaContact(
|
||||
MTP_string(_phoneNumber),
|
||||
MTP_string(_firstName),
|
||||
MTP_string(_lastName),
|
||||
MTP_int(0));
|
||||
MTP_string(vcard),
|
||||
MTP_int(userId));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -4784,6 +4784,13 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
// }
|
||||
//} break;
|
||||
|
||||
case mtpc_updateDialogUnreadMark: {
|
||||
const auto &data = update.c_updateDialogUnreadMark();
|
||||
if (data.is_unread()) {
|
||||
// #TODO dialog_unread
|
||||
}
|
||||
} break;
|
||||
|
||||
// Deleted messages.
|
||||
case mtpc_updateDeleteMessages: {
|
||||
auto &d = update.c_updateDeleteMessages();
|
||||
@ -5335,16 +5342,15 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
////// Cloud drafts
|
||||
case mtpc_updateDraftMessage: {
|
||||
auto &peerDraft = update.c_updateDraftMessage();
|
||||
auto peerId = peerFromMTP(peerDraft.vpeer);
|
||||
|
||||
auto &draftMessage = peerDraft.vdraft;
|
||||
if (draftMessage.type() == mtpc_draftMessage) {
|
||||
auto &draft = draftMessage.c_draftMessage();
|
||||
Data::applyPeerCloudDraft(peerId, draft);
|
||||
} else {
|
||||
Data::clearPeerCloudDraft(peerId);
|
||||
}
|
||||
const auto &data = update.c_updateDraftMessage();
|
||||
const auto peerId = peerFromMTP(data.vpeer);
|
||||
data.vdraft.match([&](const MTPDdraftMessage &data) {
|
||||
Data::applyPeerCloudDraft(peerId, data);
|
||||
}, [&](const MTPDdraftMessageEmpty &data) {
|
||||
Data::clearPeerCloudDraft(
|
||||
peerId,
|
||||
TimeId(data.has_date() ? data.vdate.v : 0));
|
||||
});
|
||||
} break;
|
||||
|
||||
////// Cloud langpacks
|
||||
|
@ -756,6 +756,8 @@ void Instance::Private::configLoadDone(const MTPConfig &result) {
|
||||
Global::SetPinnedDialogsCountMax(data.vpinned_dialogs_count_max.v);
|
||||
Messenger::Instance().setInternalLinkDomain(qs(data.vme_url_prefix));
|
||||
Global::SetChannelsReadMediaPeriod(data.vchannels_read_media_period.v);
|
||||
Global::SetWebFileDcId(data.vwebfile_dc_id.v);
|
||||
Global::SetTxtDomainString(qs(data.vdc_txt_domain_name));
|
||||
Global::SetCallReceiveTimeoutMs(data.vcall_receive_timeout_ms.v);
|
||||
Global::SetCallRingTimeoutMs(data.vcall_ring_timeout_ms.v);
|
||||
Global::SetCallConnectTimeoutMs(data.vcall_connect_timeout_ms.v);
|
||||
|
@ -215,9 +215,7 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
|
||||
} break;
|
||||
case Type::Dns: {
|
||||
url.setPath(qsl("/resolve"));
|
||||
url.setQuery(
|
||||
qsl("name=%1.stel.com&type=16").arg(
|
||||
cTestMode() ? qsl("testapv2") : qsl("apv2")));
|
||||
url.setQuery(qsl("name=%1&type=16").arg(Global::TxtDomainString()));
|
||||
request.setRawHeader("Host", "dns.google.com");
|
||||
} break;
|
||||
default: Unexpected("Type in SpecialConfigRequest::performRequest.");
|
||||
|
@ -579,6 +579,7 @@ enum {
|
||||
dbiStickersFavedLimit = 0x50,
|
||||
dbiSuggestStickersByEmoji = 0x51,
|
||||
dbiSuggestEmoji = 0x52,
|
||||
dbiTxtDomainString = 0x53,
|
||||
|
||||
dbiEncryptedWithSalt = 333,
|
||||
dbiEncrypted = 444,
|
||||
@ -1159,6 +1160,14 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
||||
Global::RefWorkMode().set(newMode());
|
||||
} break;
|
||||
|
||||
case dbiTxtDomainString: {
|
||||
QString v;
|
||||
stream >> v;
|
||||
if (!_checkStreamStatus(stream)) return false;
|
||||
|
||||
Global::SetTxtDomainString(v);
|
||||
} break;
|
||||
|
||||
case dbiConnectionTypeOld: {
|
||||
qint32 v;
|
||||
stream >> v;
|
||||
@ -2474,6 +2483,7 @@ void writeSettings() {
|
||||
quint32 size = 12 * (sizeof(quint32) + sizeof(qint32));
|
||||
size += sizeof(quint32) + Serialize::bytearraySize(dcOptionsSerialized);
|
||||
size += sizeof(quint32) + Serialize::stringSize(cLoggedPhoneNumber());
|
||||
size += sizeof(quint32) + Serialize::stringSize(Global::TxtDomainString());
|
||||
|
||||
auto &proxies = Global::RefProxiesList();
|
||||
const auto &proxy = Global::SelectedProxy();
|
||||
@ -2512,6 +2522,7 @@ void writeSettings() {
|
||||
data.stream << quint32(dbiScale) << qint32(cConfigScale());
|
||||
data.stream << quint32(dbiDcOptions) << dcOptionsSerialized;
|
||||
data.stream << quint32(dbiLoggedPhoneNumber) << cLoggedPhoneNumber();
|
||||
data.stream << quint32(dbiTxtDomainString) << Global::TxtDomainString();
|
||||
|
||||
data.stream << quint32(dbiConnectionType) << qint32(dbictProxiesList);
|
||||
data.stream << qint32(proxies.size());
|
||||
|
@ -1320,7 +1320,7 @@ Image *getImage(const MTPDwebDocument &document) {
|
||||
auto filesize = 0; // document.vsize.v;
|
||||
return getImage(
|
||||
WebFileLocation(
|
||||
document.vdc_id.v,
|
||||
Global::WebFileDcId(),
|
||||
document.vurl.v,
|
||||
document.vaccess_hash.v),
|
||||
size.width(),
|
||||
@ -1348,7 +1348,7 @@ Image *getImage(const MTPDwebDocument &document, QSize box) {
|
||||
auto filesize = 0; // document.vsize.v;
|
||||
return getImage(
|
||||
WebFileLocation(
|
||||
document.vdc_id.v,
|
||||
Global::WebFileDcId(),
|
||||
document.vurl.v,
|
||||
document.vaccess_hash.v),
|
||||
box,
|
||||
|
Loading…
Reference in New Issue
Block a user