tdesktop/Telegram/SourceFiles/apiwrap.h

724 lines
22 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include <rpl/event_stream.h>
#include "base/timer.h"
#include "base/flat_map.h"
#include "base/flat_set.h"
2018-01-09 17:08:31 +00:00
#include "core/single_timer.h"
#include "mtproto/sender.h"
#include "chat_helpers/stickers.h"
2018-01-09 17:08:31 +00:00
#include "data/data_messages.h"
2017-12-19 16:57:42 +00:00
class TaskQueue;
2017-06-05 13:33:45 +00:00
class AuthSession;
2017-12-19 16:57:42 +00:00
struct MessageGroupId;
struct SendingAlbum;
enum class SendMediaType;
struct FileLoadTo;
class mtpFileLoader;
namespace InlineBots {
class Result;
} // namespace InlineBots
2017-06-05 13:33:45 +00:00
namespace Storage {
enum class SharedMediaType : signed char;
2017-12-19 16:57:42 +00:00
struct PreparedList;
} // namespace Storage
2018-02-21 21:17:36 +00:00
namespace Dialogs {
class Key;
} // namespace Dialogs
namespace Core {
struct CloudPasswordState;
} // namespace Core
namespace Api {
inline const MTPVector<MTPChat> *getChatsFromMessagesChats(const MTPmessages_Chats &chats) {
switch (chats.type()) {
case mtpc_messages_chats: return &chats.c_messages_chats().vchats;
case mtpc_messages_chatsSlice: return &chats.c_messages_chatsSlice().vchats;
}
return nullptr;
}
2018-01-29 17:13:24 +00:00
template <typename IntRange>
inline int32 CountHash(IntRange &&range) {
uint32 acc = 0;
for (auto value : range) {
acc += (acc * 20261) + uint32(value);
}
return int32(acc & 0x7FFFFFFF);
}
} // namespace Api
2017-06-05 13:33:45 +00:00
class ApiWrap : private MTP::Sender, private base::Subscriber {
public:
ApiWrap(not_null<AuthSession*> session);
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
void savePinnedOrder();
2018-03-06 17:07:42 +00:00
//void toggleChannelGrouping( // #feed
// not_null<ChannelData*> channel,
// bool group,
// Fn<void()> callback);
2018-03-06 17:07:42 +00:00
//void ungroupAllFromFeed(not_null<Data::Feed*> feed);
2018-01-03 18:00:11 +00:00
using RequestMessageDataCallback = Fn<void(ChannelData*, MsgId)>;
2018-01-03 18:00:11 +00:00
void requestMessageData(
ChannelData *channel,
MsgId msgId,
RequestMessageDataCallback callback);
2018-01-03 17:06:43 +00:00
void requestContacts();
void requestDialogEntry(not_null<Data::Feed*> feed);
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed);
void requestDialogEntry(not_null<History*> history);
2018-03-06 17:07:42 +00:00
//void applyFeedSources(const MTPDchannels_feedSources &data); // #feed
//void setFeedChannels(
// not_null<Data::Feed*> feed,
// const std::vector<not_null<ChannelData*>> &channels);
2018-06-26 18:03:45 +00:00
void changeDialogUnreadMark(not_null<History*> history, bool unread);
//void changeDialogUnreadMark(not_null<Data::Feed*> feed, bool unread); // #feed
2018-01-03 17:06:43 +00:00
void requestFullPeer(PeerData *peer);
void requestPeer(PeerData *peer);
void requestPeers(const QList<PeerData*> &peers);
void requestLastParticipants(not_null<ChannelData*> channel);
void requestBots(not_null<ChannelData*> channel);
void requestAdmins(not_null<ChannelData*> channel);
void requestParticipantsCountDelayed(not_null<ChannelData*> channel);
void requestChannelRangeDifference(not_null<History*> history);
using UpdatedFileReferences = Data::UpdatedFileReferences;
using FileReferencesHandler = FnMut<void(const UpdatedFileReferences&)>;
void refreshFileReference(
Data::FileOrigin origin,
FileReferencesHandler &&handler);
void refreshFileReference(
Data::FileOrigin origin,
not_null<mtpFileLoader*> loader,
int requestId,
const QByteArray &current);
void requestChangelog(
const QString &sinceVersion,
Fn<void(const MTPUpdates &result)> callback);
void refreshProxyPromotion();
void requestDeepLinkInfo(
const QString &path,
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
void requestTermsUpdate();
void acceptTerms(bytes::const_span termsId);
void requestChannelMembersForAdd(
not_null<ChannelData*> channel,
Fn<void(const MTPchannels_ChannelParticipants&)> callback);
2015-10-30 15:57:22 +00:00
void processFullPeer(PeerData *peer, const MTPmessages_ChatFull &result);
void processFullPeer(UserData *user, const MTPUserFull &result);
2015-10-30 15:57:22 +00:00
void markMediaRead(const base::flat_set<not_null<HistoryItem*>> &items);
void markMediaRead(not_null<HistoryItem*> item);
2015-09-21 20:57:42 +00:00
void requestSelfParticipant(ChannelData *channel);
void kickParticipant(not_null<ChatData*> chat, not_null<UserData*> user);
void kickParticipant(
not_null<ChannelData*> channel,
not_null<UserData*> user,
const MTPChannelBannedRights &currentRights);
void unblockParticipant(
not_null<ChannelData*> channel,
not_null<UserData*> user);
void deleteAllFromUser(
not_null<ChannelData*> channel,
not_null<UserData*> from);
2015-09-21 20:57:42 +00:00
2015-04-04 20:01:34 +00:00
void requestWebPageDelayed(WebPageData *page);
void clearWebPageRequest(WebPageData *page);
void clearWebPageRequests();
void scheduleStickerSetRequest(uint64 setId, uint64 access);
void requestStickerSets();
void saveStickerSets(
const Stickers::Order &localOrder,
const Stickers::Order &localRemoved);
void updateStickers();
void requestRecentStickersForce();
void setGroupStickerSet(
not_null<ChannelData*> megagroup,
const MTPInputStickerSet &set);
2018-03-07 13:53:12 +00:00
std::vector<not_null<DocumentData*>> *stickersByEmoji(
not_null<EmojiPtr> emoji);
void toggleFavedSticker(
not_null<DocumentData*> document,
Data::FileOrigin origin,
bool faved);
void toggleSavedGif(
not_null<DocumentData*> document,
Data::FileOrigin origin,
bool saved);
void joinChannel(not_null<ChannelData*> channel);
void leaveChannel(not_null<ChannelData*> channel);
void blockUser(not_null<UserData*> user);
void unblockUser(not_null<UserData*> user);
void exportInviteLink(not_null<PeerData*> peer);
void requestNotifySettings(const MTPInputNotifyPeer &peer);
void updateNotifySettingsDelayed(not_null<const PeerData*> peer);
void saveDraftToCloudDelayed(not_null<History*> history);
void savePrivacy(const MTPInputPrivacyKey &key, QVector<MTPInputPrivacyRule> &&rules);
void handlePrivacyChange(mtpTypeId keyTypeId, const MTPVector<MTPPrivacyRule> &rules);
static int OnlineTillFromStatus(
const MTPUserStatus &status,
int currentOnlineTill);
void clearHistory(not_null<PeerData*> peer);
base::Observable<PeerData*> &fullPeerUpdated() {
return _fullPeerUpdated;
}
bool isQuitPrevent();
void applyUpdatesNoPtsCheck(const MTPUpdates &updates);
void applyUpdateNoPtsCheck(const MTPUpdate &update);
2018-02-21 21:17:36 +00:00
void jumpToDate(Dialogs::Key chat, const QDate &date);
void preloadEnoughUnreadMentions(not_null<History*> history);
void checkForUnreadMentions(const base::flat_set<MsgId> &possiblyReadMentions, ChannelData *channel = nullptr);
void editChatAdmins(
not_null<ChatData*> chat,
bool adminsEnabled,
base::flat_set<not_null<UserData*>> &&admins);
2018-01-09 17:08:31 +00:00
using SliceType = Data::LoadDirection;
void requestSharedMedia(
not_null<PeerData*> peer,
Storage::SharedMediaType type,
MsgId messageId,
SliceType slice);
void requestSharedMediaCount(
not_null<PeerData*> peer,
Storage::SharedMediaType type);
void requestUserPhotos(
not_null<UserData*> user,
PhotoId afterId);
2018-03-06 17:07:42 +00:00
//void requestFeedChannels( // #feed
// not_null<Data::Feed*> feed);
//void requestFeedMessages(
// not_null<Data::Feed*> feed,
// Data::MessagePosition messageId,
// SliceType slice);
//void saveDefaultFeedId(FeedId id, bool isDefaultFeedId);
2018-01-09 17:08:31 +00:00
void stickerSetInstalled(uint64 setId) {
_stickerSetInstalled.fire_copy(setId);
}
2017-09-27 12:04:19 +00:00
auto stickerSetInstalled() const {
return _stickerSetInstalled.events();
}
void readFeaturedSetDelayed(uint64 setId);
2017-11-20 19:54:05 +00:00
void parseChannelParticipants(
not_null<ChannelData*> channel,
2017-11-20 19:54:05 +00:00
const MTPchannels_ChannelParticipants &result,
Fn<void(
int availableCount,
const QVector<MTPChannelParticipant> &list)> callbackList,
Fn<void()> callbackNotModified = nullptr);
void parseRecentChannelParticipants(
not_null<ChannelData*> channel,
const MTPchannels_ChannelParticipants &result,
Fn<void(
int availableCount,
const QVector<MTPChannelParticipant> &list)> callbackList,
Fn<void()> callbackNotModified = nullptr);
2017-11-20 19:54:05 +00:00
struct SendOptions {
SendOptions(not_null<History*> history);
not_null<History*> history;
MsgId replyTo = 0;
WebPageId webPageId = 0;
bool clearDraft = false;
bool generateLocal = true;
};
rpl::producer<SendOptions> sendActions() const {
return _sendActions.events();
}
void sendAction(const SendOptions &options);
void forwardMessages(
HistoryItemsList &&items,
const SendOptions &options,
FnMut<void()> &&successCallback = nullptr);
void shareContact(
const QString &phone,
const QString &firstName,
const QString &lastName,
const SendOptions &options);
void shareContact(not_null<UserData*> user, const SendOptions &options);
void readServerHistory(not_null<History*> history);
void readServerHistoryForce(not_null<History*> history);
2018-02-02 12:51:18 +00:00
void readFeed(
not_null<Data::Feed*> feed,
Data::MessagePosition position);
2017-12-19 16:57:42 +00:00
void sendVoiceMessage(
QByteArray result,
VoiceWaveform waveform,
int duration,
const SendOptions &options);
void sendFiles(
Storage::PreparedList &&list,
SendMediaType type,
TextWithTags &&caption,
2017-12-19 16:57:42 +00:00
std::shared_ptr<SendingAlbum> album,
const SendOptions &options);
void sendFile(
const QByteArray &fileContent,
SendMediaType type,
const SendOptions &options);
void sendUploadedPhoto(
FullMsgId localId,
const MTPInputFile &file,
bool silent);
void sendUploadedDocument(
FullMsgId localId,
const MTPInputFile &file,
const base::optional<MTPInputFile> &thumb,
bool silent);
void cancelLocalItem(not_null<HistoryItem*> item);
2017-12-19 16:57:42 +00:00
struct MessageToSend {
MessageToSend(not_null<History*> history);
not_null<History*> history;
TextWithTags textWithTags;
MsgId replyTo = 0;
WebPageId webPageId = 0;
bool clearDraft = true;
};
void sendMessage(MessageToSend &&message);
void sendInlineResult(
not_null<UserData*> bot,
not_null<InlineBots::Result*> data,
const SendOptions &options);
void sendExistingDocument(
not_null<DocumentData*> document,
Data::FileOrigin origin,
TextWithEntities caption,
const SendOptions &options);
void requestSupportContact(FnMut<void(const MTPUser&)> callback);
void uploadPeerPhoto(not_null<PeerData*> peer, QImage &&image);
void clearPeerPhoto(not_null<PhotoData*> photo);
void reloadPasswordState();
void clearUnconfirmedPassword();
rpl::producer<Core::CloudPasswordState> passwordState() const;
base::optional<Core::CloudPasswordState> passwordStateCurrent() const;
void saveSelfBio(const QString &text, FnMut<void()> done);
struct Privacy {
enum class Key {
LastSeen,
Calls,
Invites,
};
enum class Option {
Everyone,
Contacts,
Nobody,
};
Option option = Option::Everyone;
std::vector<not_null<UserData*>> always;
std::vector<not_null<UserData*>> never;
static MTPInputPrivacyKey Input(Key key);
};
void reloadPrivacy(Privacy::Key key);
rpl::producer<Privacy> privacyValue(Privacy::Key key);
2018-09-17 17:31:01 +00:00
void reloadSelfDestruct();
rpl::producer<int> selfDestructValue() const;
void saveSelfDestruct(int days);
~ApiWrap();
private:
struct MessageDataRequest {
using Callbacks = QList<RequestMessageDataCallback>;
mtpRequestId requestId = 0;
Callbacks callbacks;
};
using MessageDataRequests = QMap<MsgId, MessageDataRequest>;
using SharedMediaType = Storage::SharedMediaType;
2018-03-07 13:53:12 +00:00
struct StickersByEmoji {
std::vector<not_null<DocumentData*>> list;
int32 hash = 0;
2018-03-07 13:53:12 +00:00
TimeMs received = 0;
};
using SimpleFileLocationId = Data::SimpleFileLocationId;
using DocumentFileLocationId = Data::DocumentFileLocationId;
using FileLocationId = Data::FileLocationId;
void updatesReceived(const MTPUpdates &updates);
void checkQuitPreventFinished();
void saveDraftsToCloud();
void resolveMessageDatas();
void gotMessageDatas(ChannelData *channel, const MTPmessages_Messages &result, mtpRequestId requestId);
2017-11-23 15:41:13 +00:00
void finalizeMessageDataRequest(
ChannelData *channel,
mtpRequestId requestId);
QVector<MTPInputMessage> collectMessageIds(const MessageDataRequests &requests);
MessageDataRequests *messageDataRequests(ChannelData *channel, bool onlyExisting = false);
void applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs);
void historyDialogEntryApplied(not_null<History*> history);
void applyFeedDialogs(
not_null<Data::Feed*> feed,
const MTPmessages_Dialogs &dialogs);
2015-10-30 15:57:22 +00:00
void gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mtpRequestId req);
void gotUserFull(UserData *user, const MTPUserFull &result, mtpRequestId req);
2017-11-20 19:54:05 +00:00
void applyLastParticipantsList(
not_null<ChannelData*> channel,
int availableCount,
const QVector<MTPChannelParticipant> &list);
void applyBotsList(
not_null<ChannelData*> channel,
int availableCount,
const QVector<MTPChannelParticipant> &list);
void applyAdminsList(
not_null<ChannelData*> channel,
int availableCount,
const QVector<MTPChannelParticipant> &list);
void resolveWebPages();
void gotWebPages(
ChannelData *channel,
const MTPmessages_Messages &result,
mtpRequestId req);
void gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result);
void channelRangeDifferenceSend(
not_null<ChannelData*> channel,
MsgRange range,
int32 pts);
void channelRangeDifferenceDone(
not_null<ChannelData*> channel,
MsgRange range,
const MTPupdates_ChannelDifference &result);
void notifySettingReceived(
MTPInputNotifyPeer peer,
const MTPPeerNotifySettings &settings);
void stickerSetDisenabled(mtpRequestId requestId);
void stickersSaveOrder();
void requestStickers(TimeId now);
void requestRecentStickers(TimeId now);
void requestRecentStickersWithHash(int32 hash);
void requestFavedStickers(TimeId now);
void requestFeaturedStickers(TimeId now);
void requestSavedGifs(TimeId now);
void readFeaturedSets();
void cancelEditChatAdmins(not_null<ChatData*> chat);
void saveChatAdmins(not_null<ChatData*> chat);
void sendSaveChatAdminsRequests(not_null<ChatData*> chat);
void refreshChannelAdmins(
not_null<ChannelData*> channel,
const QVector<MTPChannelParticipant> &participants);
2018-02-21 21:17:36 +00:00
void jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date);
void jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date);
template <typename Callback>
void requestMessageAfterDate(
not_null<PeerData*> peer,
const QDate &date,
Callback &&callback);
2018-02-21 21:17:36 +00:00
template <typename Callback>
void requestMessageAfterDate(
not_null<Data::Feed*> feed,
const QDate &date,
Callback &&callback);
void sharedMediaDone(
not_null<PeerData*> peer,
SharedMediaType type,
MsgId messageId,
SliceType slice,
const MTPmessages_Messages &result);
void userPhotosDone(
not_null<UserData*> user,
PhotoId photoId,
const MTPphotos_Photos &result);
2018-03-06 17:07:42 +00:00
//void feedChannelsDone(not_null<Data::Feed*> feed); // #feed
//void feedMessagesDone(
// not_null<Data::Feed*> feed,
// Data::MessagePosition messageId,
// SliceType slice,
// const MTPmessages_FeedMessages &result);
2018-01-09 17:08:31 +00:00
void sendSharedContact(
const QString &phone,
const QString &firstName,
const QString &lastName,
UserId userId,
const SendOptions &options);
void sendReadRequest(not_null<PeerData*> peer, MsgId upTo);
int applyAffectedHistory(
not_null<PeerData*> peer,
const MTPmessages_AffectedHistory &result);
void applyAffectedMessages(const MTPmessages_AffectedMessages &result);
void applyAffectedMessages(
not_null<PeerData*> peer,
const MTPmessages_AffectedMessages &result);
void deleteAllFromUserSend(
not_null<ChannelData*> channel,
not_null<UserData*> from);
2017-12-19 16:57:42 +00:00
void sendMessageFail(const RPCError &error);
void uploadAlbumMedia(
not_null<HistoryItem*> item,
const MessageGroupId &groupId,
const MTPInputMedia &media);
void sendAlbumWithUploaded(
2017-12-19 16:57:42 +00:00
not_null<HistoryItem*> item,
const MessageGroupId &groupId,
const MTPInputMedia &media);
void sendAlbumWithCancelled(
not_null<HistoryItem*> item,
const MessageGroupId &groupId);
void sendAlbumIfReady(not_null<SendingAlbum*> album);
2017-12-19 16:57:42 +00:00
void sendMedia(
not_null<HistoryItem*> item,
const MTPInputMedia &media,
bool silent);
void sendMediaWithRandomId(
not_null<HistoryItem*> item,
const MTPInputMedia &media,
bool silent,
uint64 randomId);
FileLoadTo fileLoadTaskOptions(const SendOptions &options) const;
2018-02-02 12:51:18 +00:00
void readFeeds();
void getProxyPromotionDelayed(TimeId now, TimeId next);
void proxyPromotionDone(const MTPhelp_ProxyData &proxy);
void sendNotifySettingsUpdates();
template <typename Request>
void requestFileReference(
Data::FileOrigin origin,
FileReferencesHandler &&handler,
Request &&data);
void photoUploadReady(const FullMsgId &msgId, const MTPInputFile &file);
Privacy parsePrivacy(const QVector<MTPPrivacyRule> &rules);
void pushPrivacy(
Privacy::Key key,
const QVector<MTPPrivacyRule> &rules);
void updatePrivacyLastSeens(const QVector<MTPPrivacyRule> &rules);
2018-09-17 17:31:01 +00:00
void setSelfDestructDays(int days);
not_null<AuthSession*> _session;
2017-06-05 13:33:45 +00:00
MessageDataRequests _messageDataRequests;
QMap<ChannelData*, MessageDataRequests> _channelMessageDataRequests;
SingleQueuedInvokation _messageDataResolveDelayed;
using PeerRequests = QMap<PeerData*, mtpRequestId>;
PeerRequests _fullPeerRequests;
PeerRequests _peerRequests;
PeerRequests _participantsRequests;
PeerRequests _botsRequests;
PeerRequests _adminsRequests;
base::DelayedCallTimer _participantsCountRequestTimer;
2015-11-09 09:51:22 +00:00
ChannelData *_channelMembersForAdd = nullptr;
mtpRequestId _channelMembersForAddRequestId = 0;
Fn<void(
const MTPchannels_ChannelParticipants&)> _channelMembersForAddCallback;
base::flat_map<
not_null<ChannelData*>,
std::pair<mtpRequestId,Fn<void()>>> _channelGroupingRequests;
using KickRequest = std::pair<
not_null<ChannelData*>,
not_null<UserData*>>;
base::flat_map<KickRequest, mtpRequestId> _kickRequests;
2015-11-09 09:51:22 +00:00
QMap<ChannelData*, mtpRequestId> _selfParticipantRequests;
2015-09-21 20:57:42 +00:00
base::flat_map<
not_null<ChannelData*>,
mtpRequestId> _rangeDifferenceRequests;
QMap<WebPageData*, mtpRequestId> _webPagesPending;
base::Timer _webPagesTimer;
2015-04-04 20:01:34 +00:00
QMap<uint64, QPair<uint64, mtpRequestId> > _stickerSetRequests;
QMap<ChannelData*, mtpRequestId> _channelAmInRequests;
base::flat_map<not_null<UserData*>, mtpRequestId> _blockRequests;
base::flat_map<not_null<PeerData*>, mtpRequestId> _exportInviteRequests;
base::flat_map<PeerId, mtpRequestId> _notifySettingRequests;
base::flat_map<not_null<History*>, mtpRequestId> _draftsSaveRequestIds;
base::Timer _draftsSaveTimer;
base::flat_set<mtpRequestId> _stickerSetDisenableRequests;
2016-11-22 09:48:13 +00:00
Stickers::Order _stickersOrder;
mtpRequestId _stickersReorderRequestId = 0;
mtpRequestId _stickersClearRecentRequestId = 0;
mtpRequestId _stickersUpdateRequest = 0;
mtpRequestId _recentStickersUpdateRequest = 0;
mtpRequestId _favedStickersUpdateRequest = 0;
mtpRequestId _featuredStickersUpdateRequest = 0;
mtpRequestId _savedGifsUpdateRequest = 0;
base::Timer _featuredSetsReadTimer;
base::flat_set<uint64> _featuredSetsRead;
2018-03-07 13:53:12 +00:00
base::flat_map<not_null<EmojiPtr>, StickersByEmoji> _stickersByEmoji;
2018-01-03 17:06:43 +00:00
base::flat_map<mtpTypeId, mtpRequestId> _privacySaveRequests;
2018-01-03 17:06:43 +00:00
mtpRequestId _contactsRequestId = 0;
mtpRequestId _contactsStatusesRequestId = 0;
base::flat_set<not_null<Data::Feed*>> _dialogFeedRequests;
base::flat_set<not_null<History*>> _dialogRequests;
base::flat_map<not_null<History*>, mtpRequestId> _unreadMentionsRequests;
base::flat_map<
not_null<ChatData*>,
mtpRequestId> _chatAdminsEnabledRequests;
base::flat_map<
not_null<ChatData*>,
base::flat_set<not_null<UserData*>>> _chatAdminsToSave;
base::flat_map<
not_null<ChatData*>,
base::flat_set<mtpRequestId>> _chatAdminsSaveRequests;
base::flat_map<std::tuple<
not_null<PeerData*>,
SharedMediaType,
MsgId,
SliceType>, mtpRequestId> _sharedMediaRequests;
base::flat_map<not_null<UserData*>, mtpRequestId> _userPhotosRequests;
2018-02-20 16:56:41 +00:00
base::flat_set<not_null<Data::Feed*>> _feedChannelsGetRequests;
base::flat_map<
not_null<Data::Feed*>,
mtpRequestId> _feedChannelsSetRequests;
base::flat_set<std::tuple<
not_null<Data::Feed*>,
Data::MessagePosition,
SliceType>> _feedMessagesRequests;
base::flat_set<std::tuple<
2018-01-09 17:08:31 +00:00
not_null<Data::Feed*>,
Data::MessagePosition,
SliceType>> _feedMessagesRequestsPending;
mtpRequestId _saveDefaultFeedIdRequest = 0;
2018-01-09 17:08:31 +00:00
rpl::event_stream<SendOptions> _sendActions;
struct ReadRequest {
ReadRequest(mtpRequestId requestId, MsgId upTo)
: requestId(requestId)
, upTo(upTo) {
}
mtpRequestId requestId = 0;
MsgId upTo = 0;
};
base::flat_map<not_null<PeerData*>, ReadRequest> _readRequests;
base::flat_map<not_null<PeerData*>, MsgId> _readRequestsPending;
2018-02-02 12:51:18 +00:00
2017-12-19 16:57:42 +00:00
std::unique_ptr<TaskQueue> _fileLoader;
base::flat_map<uint64, std::shared_ptr<SendingAlbum>> _sendingAlbums;
base::Observable<PeerData*> _fullPeerUpdated;
rpl::event_stream<uint64> _stickerSetInstalled;
2018-02-02 12:51:18 +00:00
base::flat_map<not_null<Data::Feed*>, TimeMs> _feedReadsDelayed;
base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
base::Timer _feedReadTimer;
mtpRequestId _proxyPromotionRequestId = 0;
std::pair<QString, uint32> _proxyPromotionKey;
TimeId _proxyPromotionNextRequestTime = TimeId(0);
base::Timer _proxyPromotionTimer;
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
base::Timer _updateNotifySettingsTimer;
std::map<
Data::FileOrigin,
std::vector<FileReferencesHandler>> _fileReferenceHandlers;
mtpRequestId _deepLinkInfoRequestId = 0;
TimeMs _termsUpdateSendAt = 0;
mtpRequestId _termsUpdateRequestId = 0;
std::vector<FnMut<void(const MTPUser &)>> _supportContactCallbacks;
base::flat_map<FullMsgId, not_null<PeerData*>> _peerPhotoUploads;
mtpRequestId _passwordRequestId = 0;
std::unique_ptr<Core::CloudPasswordState> _passwordState;
rpl::event_stream<Core::CloudPasswordState> _passwordStateChanges;
mtpRequestId _saveBioRequestId = 0;
FnMut<void()> _saveBioDone;
QString _saveBioText;
base::flat_map<Privacy::Key, mtpRequestId> _privacyRequestIds;
base::flat_map<Privacy::Key, Privacy> _privacyValues;
std::map<Privacy::Key, rpl::event_stream<Privacy>> _privacyChanges;
2018-09-17 17:31:01 +00:00
mtpRequestId _selfDestructRequestId = 0;
base::optional<int> _selfDestructDays;
rpl::event_stream<int> _selfDestructChanges;
};