2015-03-19 09:18:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-03-19 09:18:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
#include <rpl/event_stream.h>
|
2017-04-07 12:10:10 +00:00
|
|
|
#include "base/timer.h"
|
2017-08-11 07:16:07 +00:00
|
|
|
#include "base/flat_map.h"
|
|
|
|
#include "base/flat_set.h"
|
2018-01-09 17:08:31 +00:00
|
|
|
#include "mtproto/sender.h"
|
2017-11-05 17:07:27 +00:00
|
|
|
#include "chat_helpers/stickers.h"
|
2018-01-09 17:08:31 +00:00
|
|
|
#include "data/data_messages.h"
|
2016-10-05 16:56:27 +00:00
|
|
|
|
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;
|
2018-06-26 15:34:38 +00:00
|
|
|
struct FileLoadTo;
|
2018-07-15 16:36:19 +00:00
|
|
|
class mtpFileLoader;
|
2018-06-26 15:34:38 +00:00
|
|
|
|
2019-01-04 11:09:48 +00:00
|
|
|
namespace Data {
|
|
|
|
struct UpdatedFileReferences;
|
2019-01-28 13:59:49 +00:00
|
|
|
class WallPaper;
|
2019-01-04 11:09:48 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2018-06-26 15:34:38 +00:00
|
|
|
namespace InlineBots {
|
|
|
|
class Result;
|
|
|
|
} // namespace InlineBots
|
2017-06-05 13:33:45 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
namespace Storage {
|
2018-03-09 20:48:47 +00:00
|
|
|
enum class SharedMediaType : signed char;
|
2017-12-19 16:57:42 +00:00
|
|
|
struct PreparedList;
|
2017-08-18 19:14:31 +00:00
|
|
|
} // namespace Storage
|
|
|
|
|
2018-02-21 21:17:36 +00:00
|
|
|
namespace Dialogs {
|
|
|
|
class Key;
|
|
|
|
} // namespace Dialogs
|
|
|
|
|
2018-09-09 12:10:54 +00:00
|
|
|
namespace Core {
|
|
|
|
struct CloudPasswordState;
|
|
|
|
} // namespace Core
|
|
|
|
|
2016-10-23 21:03:10 +00:00
|
|
|
namespace Api {
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-10-23 21:03:10 +00:00
|
|
|
} // namespace Api
|
|
|
|
|
2019-01-10 06:26:08 +00:00
|
|
|
class ApiWrap : public MTP::Sender, private base::Subscriber {
|
2015-03-19 09:18:19 +00:00
|
|
|
public:
|
2017-08-17 08:31:24 +00:00
|
|
|
ApiWrap(not_null<AuthSession*> session);
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2017-04-13 17:59:05 +00:00
|
|
|
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
|
|
|
|
2018-01-04 19:54:35 +00:00
|
|
|
void savePinnedOrder();
|
2018-03-06 17:07:42 +00:00
|
|
|
//void toggleChannelGrouping( // #feed
|
|
|
|
// not_null<ChannelData*> channel,
|
|
|
|
// bool group,
|
2018-06-04 15:35:11 +00:00
|
|
|
// 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
|
|
|
|
2018-06-04 15:35: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);
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2018-01-03 17:06:43 +00:00
|
|
|
void requestContacts();
|
2018-01-31 17:10:29 +00:00
|
|
|
void requestDialogEntry(not_null<Data::Feed*> feed);
|
2018-02-03 19:52:35 +00:00
|
|
|
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed);
|
2018-09-27 20:31:48 +00:00
|
|
|
void requestDialogEntry(
|
|
|
|
not_null<History*> history,
|
|
|
|
Fn<void()> callback = nullptr);
|
2019-01-16 09:01:38 +00:00
|
|
|
void dialogEntryApplied(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
|
2019-01-15 11:57:45 +00:00
|
|
|
void requestFakeChatListMessage(not_null<History*> history);
|
2018-01-03 17:06:43 +00:00
|
|
|
|
2019-01-17 08:18:23 +00:00
|
|
|
void requestWallPaper(
|
|
|
|
const QString &slug,
|
|
|
|
Fn<void(const Data::WallPaper &)> done,
|
|
|
|
Fn<void(const RPCError &)> fail);
|
|
|
|
|
2019-01-08 13:57:22 +00:00
|
|
|
void requestFullPeer(not_null<PeerData*> peer);
|
|
|
|
void requestPeer(not_null<PeerData*> peer);
|
2015-08-07 12:11:50 +00:00
|
|
|
void requestPeers(const QList<PeerData*> &peers);
|
2017-12-03 16:43:42 +00:00
|
|
|
void requestLastParticipants(not_null<ChannelData*> channel);
|
|
|
|
void requestBots(not_null<ChannelData*> channel);
|
|
|
|
void requestAdmins(not_null<ChannelData*> channel);
|
|
|
|
void requestParticipantsCountDelayed(not_null<ChannelData*> channel);
|
2018-01-31 17:10:29 +00:00
|
|
|
void requestChannelRangeDifference(not_null<History*> history);
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2018-07-16 17:31:07 +00:00
|
|
|
using UpdatedFileReferences = Data::UpdatedFileReferences;
|
|
|
|
using FileReferencesHandler = FnMut<void(const UpdatedFileReferences&)>;
|
|
|
|
void refreshFileReference(
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
FileReferencesHandler &&handler);
|
2018-07-15 16:36:19 +00:00
|
|
|
void refreshFileReference(
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
not_null<mtpFileLoader*> loader,
|
|
|
|
int requestId,
|
|
|
|
const QByteArray ¤t);
|
|
|
|
|
2017-12-29 18:17:07 +00:00
|
|
|
void requestChangelog(
|
|
|
|
const QString &sinceVersion,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(const MTPUpdates &result)> callback);
|
2018-05-11 14:03:53 +00:00
|
|
|
void refreshProxyPromotion();
|
2018-04-18 15:42:02 +00:00
|
|
|
void requestDeepLinkInfo(
|
|
|
|
const QString &path,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
2018-06-03 13:30:40 +00:00
|
|
|
void requestTermsUpdate();
|
|
|
|
void acceptTerms(bytes::const_span termsId);
|
2017-12-29 18:17:07 +00:00
|
|
|
|
2018-11-26 11:55:02 +00:00
|
|
|
void checkChatInvite(
|
|
|
|
const QString &hash,
|
|
|
|
FnMut<void(const MTPChatInvite &)> done,
|
|
|
|
FnMut<void(const RPCError &)> fail);
|
|
|
|
void importChatInvite(const QString &hash);
|
|
|
|
|
2017-11-19 14:41:52 +00:00
|
|
|
void requestChannelMembersForAdd(
|
|
|
|
not_null<ChannelData*> channel,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(const MTPchannels_ChannelParticipants&)> callback);
|
2019-01-08 13:57:22 +00:00
|
|
|
void processFullPeer(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const MTPmessages_ChatFull &result);
|
|
|
|
void processFullPeer(
|
|
|
|
not_null<UserData*> user,
|
|
|
|
const MTPUserFull &result);
|
2015-10-30 15:57:22 +00:00
|
|
|
|
2019-01-13 13:28:05 +00:00
|
|
|
void migrateChat(
|
|
|
|
not_null<ChatData*> chat,
|
|
|
|
FnMut<void(not_null<ChannelData*>)> done,
|
|
|
|
FnMut<void(const RPCError &)> fail = nullptr);
|
|
|
|
|
2018-01-17 16:21:01 +00:00
|
|
|
void markMediaRead(const base::flat_set<not_null<HistoryItem*>> &items);
|
|
|
|
void markMediaRead(not_null<HistoryItem*> item);
|
|
|
|
|
2019-01-16 09:01:38 +00:00
|
|
|
void requestSelfParticipant(not_null<ChannelData*> channel);
|
2017-12-26 16:12:10 +00:00
|
|
|
void kickParticipant(not_null<ChatData*> chat, not_null<UserData*> user);
|
|
|
|
void kickParticipant(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<UserData*> user,
|
2019-01-03 14:39:19 +00:00
|
|
|
const MTPChatBannedRights ¤tRights);
|
2017-12-26 16:12:10 +00:00
|
|
|
void unblockParticipant(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<UserData*> user);
|
2018-01-31 17:10:29 +00:00
|
|
|
void deleteAllFromUser(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<UserData*> from);
|
2019-01-08 10:54:18 +00:00
|
|
|
void saveDefaultRestrictions(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const MTPChatBannedRights &rights,
|
|
|
|
Fn<void(bool)> callback = nullptr);
|
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();
|
|
|
|
|
2019-03-10 12:55:24 +00:00
|
|
|
void requestAttachedStickerSets(not_null<PhotoData*> photo);
|
2015-06-28 12:37:10 +00:00
|
|
|
void scheduleStickerSetRequest(uint64 setId, uint64 access);
|
|
|
|
void requestStickerSets();
|
2018-01-23 16:51:12 +00:00
|
|
|
void saveStickerSets(
|
|
|
|
const Stickers::Order &localOrder,
|
|
|
|
const Stickers::Order &localRemoved);
|
2017-08-02 15:07:28 +00:00
|
|
|
void updateStickers();
|
2018-03-07 21:25:03 +00:00
|
|
|
void requestRecentStickersForce();
|
2018-01-23 16:51:12 +00:00
|
|
|
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);
|
2018-07-16 19:41:43 +00:00
|
|
|
void toggleFavedSticker(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
bool faved);
|
|
|
|
void toggleSavedGif(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
bool saved);
|
2015-06-28 12:37:10 +00:00
|
|
|
|
2018-03-16 16:56:07 +00:00
|
|
|
void joinChannel(not_null<ChannelData*> channel);
|
|
|
|
void leaveChannel(not_null<ChannelData*> channel);
|
2016-05-25 17:59:21 +00:00
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
void blockUser(not_null<UserData*> user);
|
|
|
|
void unblockUser(not_null<UserData*> user);
|
2016-06-01 20:05:37 +00:00
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
void exportInviteLink(not_null<PeerData*> peer);
|
|
|
|
void requestNotifySettings(const MTPInputNotifyPeer &peer);
|
|
|
|
void updateNotifySettingsDelayed(not_null<const PeerData*> peer);
|
|
|
|
void saveDraftToCloudDelayed(not_null<History*> history);
|
2016-06-07 19:59:39 +00:00
|
|
|
|
2017-03-17 17:19:46 +00:00
|
|
|
void savePrivacy(const MTPInputPrivacyKey &key, QVector<MTPInputPrivacyRule> &&rules);
|
|
|
|
void handlePrivacyChange(mtpTypeId keyTypeId, const MTPVector<MTPPrivacyRule> &rules);
|
2018-09-11 12:50:40 +00:00
|
|
|
static int OnlineTillFromStatus(
|
|
|
|
const MTPUserStatus &status,
|
|
|
|
int currentOnlineTill);
|
2017-03-17 17:19:46 +00:00
|
|
|
|
2017-11-21 16:38:17 +00:00
|
|
|
void clearHistory(not_null<PeerData*> peer);
|
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
base::Observable<PeerData*> &fullPeerUpdated() {
|
|
|
|
return _fullPeerUpdated;
|
|
|
|
}
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2017-04-29 20:06:32 +00:00
|
|
|
bool isQuitPrevent();
|
|
|
|
|
2017-07-14 11:54:47 +00:00
|
|
|
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);
|
2017-08-01 11:43:50 +00:00
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
void preloadEnoughUnreadMentions(not_null<History*> history);
|
2019-01-10 06:26:08 +00:00
|
|
|
void checkForUnreadMentions(
|
|
|
|
const base::flat_set<MsgId> &possiblyReadMentions,
|
|
|
|
ChannelData *channel = nullptr);
|
2017-08-14 12:48:11 +00:00
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
using SliceType = Data::LoadDirection;
|
2017-08-18 19:14:31 +00:00
|
|
|
void requestSharedMedia(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Storage::SharedMediaType type,
|
|
|
|
MsgId messageId,
|
|
|
|
SliceType slice);
|
|
|
|
void requestSharedMediaCount(
|
|
|
|
not_null<PeerData*> peer,
|
2017-10-29 15:32:01 +00:00
|
|
|
Storage::SharedMediaType type);
|
2017-08-18 19:14:31 +00:00
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
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
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
void stickerSetInstalled(uint64 setId) {
|
|
|
|
_stickerSetInstalled.fire_copy(setId);
|
|
|
|
}
|
2017-09-27 12:04:19 +00:00
|
|
|
auto stickerSetInstalled() const {
|
2017-09-16 16:53:41 +00:00
|
|
|
return _stickerSetInstalled.events();
|
|
|
|
}
|
2017-11-05 17:07:27 +00:00
|
|
|
void readFeaturedSetDelayed(uint64 setId);
|
2017-09-16 16:53:41 +00:00
|
|
|
|
2017-11-20 19:54:05 +00:00
|
|
|
void parseChannelParticipants(
|
2017-12-01 18:38:44 +00:00
|
|
|
not_null<ChannelData*> channel,
|
2017-11-20 19:54:05 +00:00
|
|
|
const MTPchannels_ChannelParticipants &result,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(
|
2017-11-28 18:30:01 +00:00
|
|
|
int availableCount,
|
|
|
|
const QVector<MTPChannelParticipant> &list)> callbackList,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> callbackNotModified = nullptr);
|
2017-11-22 09:56:00 +00:00
|
|
|
void parseRecentChannelParticipants(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
const MTPchannels_ChannelParticipants &result,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(
|
2017-11-28 18:30:01 +00:00
|
|
|
int availableCount,
|
|
|
|
const QVector<MTPChannelParticipant> &list)> callbackList,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> callbackNotModified = nullptr);
|
2018-12-28 11:42:58 +00:00
|
|
|
void addChatParticipants(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const std::vector<not_null<UserData*>> &users);
|
2017-11-20 19:54:05 +00:00
|
|
|
|
2017-12-06 13:56:40 +00:00
|
|
|
struct SendOptions {
|
2018-06-26 15:34:38 +00:00
|
|
|
SendOptions(not_null<History*> history);
|
2017-12-06 13:56:40 +00:00
|
|
|
|
|
|
|
not_null<History*> history;
|
|
|
|
MsgId replyTo = 0;
|
|
|
|
WebPageId webPageId = 0;
|
2017-12-07 13:02:24 +00:00
|
|
|
bool clearDraft = false;
|
2017-12-06 13:56:40 +00:00
|
|
|
bool generateLocal = true;
|
2018-10-08 14:08:17 +00:00
|
|
|
bool handleSupportSwitch = false;
|
2017-12-06 13:56:40 +00:00
|
|
|
};
|
2017-12-07 13:02:24 +00:00
|
|
|
rpl::producer<SendOptions> sendActions() const {
|
|
|
|
return _sendActions.events();
|
|
|
|
}
|
|
|
|
void sendAction(const SendOptions &options);
|
2017-12-06 13:56:40 +00:00
|
|
|
void forwardMessages(
|
|
|
|
HistoryItemsList &&items,
|
|
|
|
const SendOptions &options,
|
2018-06-04 15:35:11 +00:00
|
|
|
FnMut<void()> &&successCallback = nullptr);
|
2017-12-07 13:02:24 +00:00
|
|
|
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-06 13:56:40 +00:00
|
|
|
|
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,
|
2018-05-24 13:03:21 +00:00
|
|
|
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,
|
2018-09-21 16:28:46 +00:00
|
|
|
const std::optional<MTPInputFile> &thumb,
|
2017-12-19 16:57:42 +00:00
|
|
|
bool silent);
|
2017-12-25 14:17:00 +00:00
|
|
|
void cancelLocalItem(not_null<HistoryItem*> item);
|
2017-12-19 16:57:42 +00:00
|
|
|
|
2018-06-26 15:34:38 +00:00
|
|
|
struct MessageToSend {
|
|
|
|
MessageToSend(not_null<History*> history);
|
|
|
|
|
|
|
|
not_null<History*> history;
|
|
|
|
TextWithTags textWithTags;
|
|
|
|
MsgId replyTo = 0;
|
|
|
|
WebPageId webPageId = 0;
|
|
|
|
bool clearDraft = true;
|
2018-10-08 14:08:17 +00:00
|
|
|
bool handleSupportSwitch = false;
|
2018-06-26 15:34:38 +00:00
|
|
|
};
|
|
|
|
void sendMessage(MessageToSend &&message);
|
2018-12-28 11:42:58 +00:00
|
|
|
void sendBotStart(not_null<UserData*> bot, PeerData *chat = nullptr);
|
2018-06-26 15:34:38 +00:00
|
|
|
void sendInlineResult(
|
|
|
|
not_null<UserData*> bot,
|
|
|
|
not_null<InlineBots::Result*> data,
|
|
|
|
const SendOptions &options);
|
2018-07-16 17:31:07 +00:00
|
|
|
void sendExistingDocument(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
TextWithEntities caption,
|
|
|
|
const SendOptions &options);
|
2018-06-26 15:34:38 +00:00
|
|
|
|
2018-09-06 10:18:49 +00:00
|
|
|
void requestSupportContact(FnMut<void(const MTPUser&)> callback);
|
|
|
|
|
2018-09-06 11:13:54 +00:00
|
|
|
void uploadPeerPhoto(not_null<PeerData*> peer, QImage &&image);
|
|
|
|
void clearPeerPhoto(not_null<PhotoData*> photo);
|
|
|
|
|
2018-09-09 12:10:54 +00:00
|
|
|
void reloadPasswordState();
|
|
|
|
void clearUnconfirmedPassword();
|
|
|
|
rpl::producer<Core::CloudPasswordState> passwordState() const;
|
2018-09-21 16:28:46 +00:00
|
|
|
std::optional<Core::CloudPasswordState> passwordStateCurrent() const;
|
2018-09-09 12:10:54 +00:00
|
|
|
|
2019-01-18 09:24:10 +00:00
|
|
|
void reloadContactSignupSilent();
|
|
|
|
rpl::producer<bool> contactSignupSilent() const;
|
|
|
|
std::optional<bool> contactSignupSilentCurrent() const;
|
|
|
|
void saveContactSignupSilent(bool silent);
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
void saveSelfBio(const QString &text, FnMut<void()> done);
|
|
|
|
|
2018-09-11 09:11:52 +00:00
|
|
|
struct Privacy {
|
|
|
|
enum class Key {
|
|
|
|
LastSeen,
|
|
|
|
Calls,
|
|
|
|
Invites,
|
2018-10-24 09:07:54 +00:00
|
|
|
CallsPeer2Peer,
|
2018-09-11 09:11:52 +00:00
|
|
|
};
|
|
|
|
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);
|
|
|
|
|
2018-12-20 16:02:44 +00:00
|
|
|
void createPoll(
|
|
|
|
const PollData &data,
|
|
|
|
const SendOptions &options,
|
|
|
|
FnMut<void()> done,
|
|
|
|
FnMut<void(const RPCError &error)> fail);
|
2018-12-19 11:20:04 +00:00
|
|
|
void sendPollVotes(
|
|
|
|
FullMsgId itemId,
|
|
|
|
const std::vector<QByteArray> &options);
|
|
|
|
void closePoll(FullMsgId itemId);
|
2018-12-24 17:03:53 +00:00
|
|
|
void reloadPollResults(not_null<HistoryItem*> item);
|
2018-12-19 11:20:04 +00:00
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
~ApiWrap();
|
2015-11-13 15:14:33 +00:00
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
private:
|
2016-03-10 10:15:21 +00:00
|
|
|
struct MessageDataRequest {
|
2016-09-26 12:09:59 +00:00
|
|
|
using Callbacks = QList<RequestMessageDataCallback>;
|
2017-04-06 19:02:40 +00:00
|
|
|
mtpRequestId requestId = 0;
|
2016-03-10 10:15:21 +00:00
|
|
|
Callbacks callbacks;
|
2015-03-19 09:18:19 +00:00
|
|
|
};
|
2017-04-06 19:02:40 +00:00
|
|
|
using MessageDataRequests = QMap<MsgId, MessageDataRequest>;
|
2017-08-18 19:14:31 +00:00
|
|
|
using SharedMediaType = Storage::SharedMediaType;
|
2017-04-06 19:02:40 +00:00
|
|
|
|
2018-03-07 13:53:12 +00:00
|
|
|
struct StickersByEmoji {
|
|
|
|
std::vector<not_null<DocumentData*>> list;
|
2018-04-09 17:48:29 +00:00
|
|
|
int32 hash = 0;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time received = 0;
|
2018-03-07 13:53:12 +00:00
|
|
|
};
|
|
|
|
|
2017-04-06 19:02:40 +00:00
|
|
|
void updatesReceived(const MTPUpdates &updates);
|
2017-04-29 20:06:32 +00:00
|
|
|
void checkQuitPreventFinished();
|
|
|
|
|
|
|
|
void saveDraftsToCloud();
|
2017-04-06 19:02:40 +00:00
|
|
|
|
|
|
|
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);
|
2017-04-06 19:02:40 +00:00
|
|
|
|
2018-02-06 07:24:55 +00:00
|
|
|
QVector<MTPInputMessage> collectMessageIds(const MessageDataRequests &requests);
|
2016-03-10 10:15:21 +00:00
|
|
|
MessageDataRequests *messageDataRequests(ChannelData *channel, bool onlyExisting = false);
|
2018-01-31 17:10:29 +00:00
|
|
|
void applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs);
|
2018-02-03 19:52:35 +00:00
|
|
|
void applyFeedDialogs(
|
|
|
|
not_null<Data::Feed*> feed,
|
|
|
|
const MTPmessages_Dialogs &dialogs);
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2019-01-08 13:57:22 +00:00
|
|
|
void gotChatFull(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const MTPmessages_ChatFull &result,
|
|
|
|
mtpRequestId req);
|
|
|
|
void gotUserFull(
|
|
|
|
not_null<UserData*> user,
|
|
|
|
const MTPUserFull &result,
|
|
|
|
mtpRequestId req);
|
2017-11-20 19:54:05 +00:00
|
|
|
void applyLastParticipantsList(
|
2017-12-03 16:43:42 +00:00
|
|
|
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,
|
2017-11-28 18:30:01 +00:00
|
|
|
int availableCount,
|
2017-12-03 16:43:42 +00:00
|
|
|
const QVector<MTPChannelParticipant> &list);
|
2017-04-06 19:02:40 +00:00
|
|
|
void resolveWebPages();
|
2018-01-31 17:10:29 +00:00
|
|
|
void gotWebPages(
|
|
|
|
ChannelData *channel,
|
|
|
|
const MTPmessages_Messages &result,
|
|
|
|
mtpRequestId req);
|
2017-04-06 19:02:40 +00:00
|
|
|
void gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result);
|
2016-03-05 21:12:55 +00:00
|
|
|
|
2018-01-31 17:10:29 +00:00
|
|
|
void channelRangeDifferenceSend(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
MsgRange range,
|
|
|
|
int32 pts);
|
|
|
|
void channelRangeDifferenceDone(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
MsgRange range,
|
|
|
|
const MTPupdates_ChannelDifference &result);
|
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
void notifySettingReceived(
|
2018-01-31 17:10:29 +00:00
|
|
|
MTPInputNotifyPeer peer,
|
|
|
|
const MTPPeerNotifySettings &settings);
|
2017-04-06 19:02:40 +00:00
|
|
|
|
|
|
|
void stickerSetDisenabled(mtpRequestId requestId);
|
|
|
|
void stickersSaveOrder();
|
|
|
|
|
2017-08-02 20:57:49 +00:00
|
|
|
void requestStickers(TimeId now);
|
|
|
|
void requestRecentStickers(TimeId now);
|
2018-03-07 21:25:03 +00:00
|
|
|
void requestRecentStickersWithHash(int32 hash);
|
2017-08-02 20:57:49 +00:00
|
|
|
void requestFavedStickers(TimeId now);
|
|
|
|
void requestFeaturedStickers(TimeId now);
|
|
|
|
void requestSavedGifs(TimeId now);
|
2017-11-05 17:07:27 +00:00
|
|
|
void readFeaturedSets();
|
2017-08-02 15:07:28 +00:00
|
|
|
|
2017-12-01 18:38:44 +00:00
|
|
|
void refreshChannelAdmins(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
const QVector<MTPChannelParticipant> &participants);
|
2017-08-14 12:48:11 +00:00
|
|
|
|
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);
|
2017-11-30 12:50:13 +00:00
|
|
|
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);
|
2017-11-30 12:50:13 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
void sharedMediaDone(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
SharedMediaType type,
|
|
|
|
MsgId messageId,
|
|
|
|
SliceType slice,
|
|
|
|
const MTPmessages_Messages &result);
|
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
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
|
|
|
|
2017-12-07 13:02:24 +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);
|
2018-01-31 17:10:29 +00:00
|
|
|
|
|
|
|
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,
|
2017-12-25 14:17:00 +00:00
|
|
|
const MTPInputMedia &media);
|
|
|
|
void sendAlbumWithUploaded(
|
2017-12-19 16:57:42 +00:00
|
|
|
not_null<HistoryItem*> item,
|
|
|
|
const MessageGroupId &groupId,
|
2017-12-25 14:17:00 +00:00
|
|
|
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);
|
2017-12-25 14:17:00 +00:00
|
|
|
void sendMediaWithRandomId(
|
|
|
|
not_null<HistoryItem*> item,
|
|
|
|
const MTPInputMedia &media,
|
|
|
|
bool silent,
|
|
|
|
uint64 randomId);
|
2018-06-26 15:34:38 +00:00
|
|
|
FileLoadTo fileLoadTaskOptions(const SendOptions &options) const;
|
2017-12-07 13:02:24 +00:00
|
|
|
|
2018-02-02 12:51:18 +00:00
|
|
|
void readFeeds();
|
|
|
|
|
2018-05-11 14:03:53 +00:00
|
|
|
void getProxyPromotionDelayed(TimeId now, TimeId next);
|
|
|
|
void proxyPromotionDone(const MTPhelp_ProxyData &proxy);
|
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
void sendNotifySettingsUpdates();
|
|
|
|
|
2018-07-15 16:36:19 +00:00
|
|
|
template <typename Request>
|
|
|
|
void requestFileReference(
|
|
|
|
Data::FileOrigin origin,
|
2018-07-16 17:31:07 +00:00
|
|
|
FileReferencesHandler &&handler,
|
2018-07-15 16:36:19 +00:00
|
|
|
Request &&data);
|
|
|
|
|
2018-09-06 11:13:54 +00:00
|
|
|
void photoUploadReady(const FullMsgId &msgId, const MTPInputFile &file);
|
|
|
|
|
2018-09-11 09:11:52 +00:00
|
|
|
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);
|
|
|
|
|
2019-01-14 06:34:51 +00:00
|
|
|
void migrateDone(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
not_null<ChannelData*> channel);
|
|
|
|
void migrateFail(not_null<PeerData*> peer, const RPCError &error);
|
|
|
|
|
2019-01-16 09:01:38 +00:00
|
|
|
void sendDialogRequests();
|
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
not_null<AuthSession*> _session;
|
2017-06-05 13:33:45 +00:00
|
|
|
|
2017-04-06 19:02:40 +00:00
|
|
|
MessageDataRequests _messageDataRequests;
|
|
|
|
QMap<ChannelData*, MessageDataRequests> _channelMessageDataRequests;
|
|
|
|
SingleQueuedInvokation _messageDataResolveDelayed;
|
|
|
|
|
|
|
|
using PeerRequests = QMap<PeerData*, mtpRequestId>;
|
|
|
|
PeerRequests _fullPeerRequests;
|
2015-06-29 22:09:23 +00:00
|
|
|
PeerRequests _peerRequests;
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2017-04-06 19:02:40 +00:00
|
|
|
PeerRequests _participantsRequests;
|
|
|
|
PeerRequests _botsRequests;
|
2017-12-03 16:43:42 +00:00
|
|
|
PeerRequests _adminsRequests;
|
2017-04-07 12:10:10 +00:00
|
|
|
base::DelayedCallTimer _participantsCountRequestTimer;
|
2015-11-09 09:51:22 +00:00
|
|
|
|
2017-11-19 14:41:52 +00:00
|
|
|
ChannelData *_channelMembersForAdd = nullptr;
|
|
|
|
mtpRequestId _channelMembersForAddRequestId = 0;
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(
|
2018-01-23 16:51:12 +00:00
|
|
|
const MTPchannels_ChannelParticipants&)> _channelMembersForAddCallback;
|
|
|
|
base::flat_map<
|
|
|
|
not_null<ChannelData*>,
|
2018-06-04 15:35:11 +00:00
|
|
|
std::pair<mtpRequestId,Fn<void()>>> _channelGroupingRequests;
|
2017-11-19 14:41:52 +00:00
|
|
|
|
2017-12-26 16:12:10 +00:00
|
|
|
using KickRequest = std::pair<
|
|
|
|
not_null<ChannelData*>,
|
|
|
|
not_null<UserData*>>;
|
|
|
|
base::flat_map<KickRequest, mtpRequestId> _kickRequests;
|
2015-11-09 09:51:22 +00:00
|
|
|
|
2019-01-08 10:54:18 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<PeerData*>,
|
|
|
|
mtpRequestId> _defaultRestrictionsRequests;
|
|
|
|
|
2019-01-16 09:01:38 +00:00
|
|
|
base::flat_set<not_null<ChannelData*>> _selfParticipantRequests;
|
2015-09-21 20:57:42 +00:00
|
|
|
|
2018-01-31 17:10:29 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<ChannelData*>,
|
|
|
|
mtpRequestId> _rangeDifferenceRequests;
|
|
|
|
|
2017-04-06 19:02:40 +00:00
|
|
|
QMap<WebPageData*, mtpRequestId> _webPagesPending;
|
2017-04-07 12:10:10 +00:00
|
|
|
base::Timer _webPagesTimer;
|
2015-04-04 20:01:34 +00:00
|
|
|
|
2015-06-28 12:37:10 +00:00
|
|
|
QMap<uint64, QPair<uint64, mtpRequestId> > _stickerSetRequests;
|
|
|
|
|
2016-05-25 17:59:21 +00:00
|
|
|
QMap<ChannelData*, mtpRequestId> _channelAmInRequests;
|
2018-06-06 19:56:35 +00:00
|
|
|
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;
|
2017-04-07 12:10:10 +00:00
|
|
|
base::Timer _draftsSaveTimer;
|
2016-06-01 13:07:03 +00:00
|
|
|
|
2017-11-05 17:07:27 +00:00
|
|
|
base::flat_set<mtpRequestId> _stickerSetDisenableRequests;
|
2016-11-22 09:48:13 +00:00
|
|
|
Stickers::Order _stickersOrder;
|
|
|
|
mtpRequestId _stickersReorderRequestId = 0;
|
|
|
|
mtpRequestId _stickersClearRecentRequestId = 0;
|
|
|
|
|
2017-08-02 15:07:28 +00:00
|
|
|
mtpRequestId _stickersUpdateRequest = 0;
|
|
|
|
mtpRequestId _recentStickersUpdateRequest = 0;
|
|
|
|
mtpRequestId _favedStickersUpdateRequest = 0;
|
|
|
|
mtpRequestId _featuredStickersUpdateRequest = 0;
|
|
|
|
mtpRequestId _savedGifsUpdateRequest = 0;
|
|
|
|
|
2017-11-05 17:07:27 +00:00
|
|
|
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;
|
2017-03-17 17:19:46 +00:00
|
|
|
|
2018-01-03 17:06:43 +00:00
|
|
|
mtpRequestId _contactsRequestId = 0;
|
2017-03-17 17:19:46 +00:00
|
|
|
mtpRequestId _contactsStatusesRequestId = 0;
|
2018-01-31 17:10:29 +00:00
|
|
|
base::flat_set<not_null<Data::Feed*>> _dialogFeedRequests;
|
2018-09-27 20:31:48 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<History*>,
|
|
|
|
std::vector<Fn<void()>>> _dialogRequests;
|
2019-01-16 09:01:38 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<History*>,
|
|
|
|
std::vector<Fn<void()>>> _dialogRequestsPending;
|
2019-01-15 11:57:45 +00:00
|
|
|
base::flat_set<not_null<History*>> _fakeChatListRequests;
|
2017-03-17 17:19:46 +00:00
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
base::flat_map<not_null<History*>, mtpRequestId> _unreadMentionsRequests;
|
2017-08-11 07:16:07 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
base::flat_map<std::tuple<
|
|
|
|
not_null<PeerData*>,
|
|
|
|
SharedMediaType,
|
|
|
|
MsgId,
|
|
|
|
SliceType>, mtpRequestId> _sharedMediaRequests;
|
2017-08-14 12:48:11 +00:00
|
|
|
|
2017-08-29 19:52:52 +00:00
|
|
|
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;
|
2018-01-30 12:13:46 +00:00
|
|
|
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,
|
2018-01-30 12:13:46 +00:00
|
|
|
SliceType>> _feedMessagesRequestsPending;
|
2018-02-08 09:20:14 +00:00
|
|
|
mtpRequestId _saveDefaultFeedIdRequest = 0;
|
2018-01-09 17:08:31 +00:00
|
|
|
|
2017-12-07 13:02:24 +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;
|
2017-12-07 13:02:24 +00:00
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
base::Observable<PeerData*> _fullPeerUpdated;
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
rpl::event_stream<uint64> _stickerSetInstalled;
|
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
base::flat_map<not_null<Data::Feed*>, crl::time> _feedReadsDelayed;
|
2018-02-02 12:51:18 +00:00
|
|
|
base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
|
|
|
base::Timer _feedReadTimer;
|
|
|
|
|
2018-05-11 14:03:53 +00:00
|
|
|
mtpRequestId _proxyPromotionRequestId = 0;
|
|
|
|
std::pair<QString, uint32> _proxyPromotionKey;
|
|
|
|
TimeId _proxyPromotionNextRequestTime = TimeId(0);
|
|
|
|
base::Timer _proxyPromotionTimer;
|
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
|
|
|
|
base::Timer _updateNotifySettingsTimer;
|
2018-05-11 14:03:53 +00:00
|
|
|
|
2018-07-15 16:36:19 +00:00
|
|
|
std::map<
|
|
|
|
Data::FileOrigin,
|
|
|
|
std::vector<FileReferencesHandler>> _fileReferenceHandlers;
|
|
|
|
|
2018-04-18 15:42:02 +00:00
|
|
|
mtpRequestId _deepLinkInfoRequestId = 0;
|
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _termsUpdateSendAt = 0;
|
2018-06-03 13:30:40 +00:00
|
|
|
mtpRequestId _termsUpdateRequestId = 0;
|
|
|
|
|
2018-11-26 11:55:02 +00:00
|
|
|
mtpRequestId _checkInviteRequestId = 0;
|
|
|
|
FnMut<void(const MTPChatInvite &result)> _checkInviteDone;
|
|
|
|
FnMut<void(const RPCError &error)> _checkInviteFail;
|
|
|
|
|
2019-01-13 13:28:05 +00:00
|
|
|
struct MigrateCallbacks {
|
|
|
|
FnMut<void(not_null<ChannelData*>)> done;
|
|
|
|
FnMut<void(const RPCError&)> fail;
|
|
|
|
};
|
|
|
|
base::flat_map<
|
2019-01-14 06:34:51 +00:00
|
|
|
not_null<PeerData*>,
|
2019-01-13 13:28:05 +00:00
|
|
|
std::vector<MigrateCallbacks>> _migrateCallbacks;
|
|
|
|
|
2018-09-06 10:18:49 +00:00
|
|
|
std::vector<FnMut<void(const MTPUser &)>> _supportContactCallbacks;
|
|
|
|
|
2018-09-06 11:13:54 +00:00
|
|
|
base::flat_map<FullMsgId, not_null<PeerData*>> _peerPhotoUploads;
|
|
|
|
|
2018-09-09 12:10:54 +00:00
|
|
|
mtpRequestId _passwordRequestId = 0;
|
|
|
|
std::unique_ptr<Core::CloudPasswordState> _passwordState;
|
|
|
|
rpl::event_stream<Core::CloudPasswordState> _passwordStateChanges;
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
mtpRequestId _saveBioRequestId = 0;
|
|
|
|
FnMut<void()> _saveBioDone;
|
|
|
|
QString _saveBioText;
|
|
|
|
|
2018-09-11 09:11:52 +00:00
|
|
|
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;
|
2018-09-21 16:28:46 +00:00
|
|
|
std::optional<int> _selfDestructDays;
|
2018-09-17 17:31:01 +00:00
|
|
|
rpl::event_stream<int> _selfDestructChanges;
|
|
|
|
|
2018-12-19 11:20:04 +00:00
|
|
|
base::flat_map<FullMsgId, mtpRequestId> _pollVotesRequestIds;
|
|
|
|
base::flat_map<FullMsgId, mtpRequestId> _pollCloseRequestIds;
|
2018-12-24 17:03:53 +00:00
|
|
|
base::flat_map<FullMsgId, mtpRequestId> _pollReloadRequestIds;
|
2018-12-19 11:20:04 +00:00
|
|
|
|
2019-01-17 08:18:23 +00:00
|
|
|
mtpRequestId _wallPaperRequestId = 0;
|
|
|
|
QString _wallPaperSlug;
|
|
|
|
Fn<void(const Data::WallPaper &)> _wallPaperDone;
|
|
|
|
Fn<void(const RPCError &)> _wallPaperFail;
|
|
|
|
|
2019-01-18 09:24:10 +00:00
|
|
|
mtpRequestId _contactSignupSilentRequestId = 0;
|
|
|
|
std::optional<bool> _contactSignupSilent;
|
|
|
|
rpl::event_stream<bool> _contactSignupSilentChanges;
|
|
|
|
|
2019-03-10 12:55:24 +00:00
|
|
|
mtpRequestId _attachedStickerSetsRequestId = 0;
|
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
};
|