tdesktop/Telegram/SourceFiles/data/data_group_call.h

69 lines
1.7 KiB
C
Raw Normal View History

2020-11-20 19:25:35 +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
class UserData;
class ChannelData;
namespace Data {
class GroupCall final {
public:
GroupCall(not_null<ChannelData*> channel, uint64 id, uint64 accessHash);
2020-11-24 11:56:46 +00:00
~GroupCall();
2020-11-20 19:25:35 +00:00
[[nodiscard]] uint64 id() const;
2020-11-24 11:56:46 +00:00
[[nodiscard]] not_null<ChannelData*> channel() const;
2020-11-20 19:25:35 +00:00
[[nodiscard]] MTPInputGroupCall input() const;
struct Participant {
not_null<UserData*> user;
TimeId date = 0;
2020-11-24 11:56:46 +00:00
uint32 source = 0;
2020-11-20 19:25:35 +00:00
bool muted = false;
bool canSelfUnmute = false;
};
[[nodiscard]] auto participants() const
-> const std::vector<Participant> &;
2020-11-24 11:56:46 +00:00
[[nodiscard]] const base::flat_set<uint32> &sources() const;
2020-11-20 19:25:35 +00:00
void requestParticipants();
[[nodiscard]] bool participantsLoaded() const;
2020-11-24 11:56:46 +00:00
void applyUpdate(const MTPGroupCall &update);
void applyUpdate(const MTPDupdateGroupCallParticipants &update);
2020-11-20 19:25:35 +00:00
[[nodiscard]] int fullCount() const;
2020-11-24 11:56:46 +00:00
void reload();
[[nodiscard]] bool finished() const;
[[nodiscard]] int duration() const;
2020-11-20 19:25:35 +00:00
private:
2020-11-24 11:56:46 +00:00
void applyCall(const MTPGroupCall &call, bool force);
void applyParticipantsSlice(const QVector<MTPGroupCallParticipant> &list);
2020-11-20 19:25:35 +00:00
const not_null<ChannelData*> _channel;
const uint64 _id = 0;
const uint64 _accessHash = 0;
int _version = 0;
mtpRequestId _participantsRequestId = 0;
2020-11-24 11:56:46 +00:00
mtpRequestId _reloadRequestId = 0;
2020-11-20 19:25:35 +00:00
std::vector<Participant> _participants;
2020-11-24 11:56:46 +00:00
base::flat_set<uint32> _sources;
2020-11-20 19:25:35 +00:00
int _fullCount = 0;
2020-11-24 11:56:46 +00:00
int _duration = 0;
bool _finished = false;
2020-11-20 19:25:35 +00:00
bool _allReceived = false;
};
} // namespace Data