2021-10-20 16:54:22 +00:00
|
|
|
/*
|
|
|
|
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 "mtproto/sender.h"
|
|
|
|
|
|
|
|
class ApiWrap;
|
|
|
|
class PeerData;
|
2022-05-16 01:05:17 +00:00
|
|
|
class UserData;
|
2021-10-20 16:54:22 +00:00
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
|
|
|
namespace Api {
|
|
|
|
|
|
|
|
class PeerPhoto final {
|
|
|
|
public:
|
2022-05-16 01:05:17 +00:00
|
|
|
using UserPhotoId = PhotoId;
|
2021-10-20 16:54:22 +00:00
|
|
|
explicit PeerPhoto(not_null<ApiWrap*> api);
|
|
|
|
|
|
|
|
void upload(not_null<PeerData*> peer, QImage &&image);
|
|
|
|
void clear(not_null<PhotoData*> photo);
|
2022-04-06 22:41:26 +00:00
|
|
|
void set(not_null<PeerData*> peer, not_null<PhotoData*> photo);
|
2021-10-20 16:54:22 +00:00
|
|
|
|
2022-05-16 01:05:17 +00:00
|
|
|
void requestUserPhotos(not_null<UserData*> user, UserPhotoId afterId);
|
|
|
|
|
2021-10-20 16:54:22 +00:00
|
|
|
private:
|
|
|
|
void ready(const FullMsgId &msgId, const MTPInputFile &file);
|
|
|
|
|
|
|
|
const not_null<Main::Session*> _session;
|
|
|
|
MTP::Sender _api;
|
|
|
|
|
|
|
|
base::flat_map<FullMsgId, not_null<PeerData*>> _uploads;
|
|
|
|
|
2022-05-16 01:05:17 +00:00
|
|
|
base::flat_map<not_null<UserData*>, mtpRequestId> _userPhotosRequests;
|
|
|
|
|
2021-10-20 16:54:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Api
|