2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Display admin badges in supergroups.

Also prefer std containers to Qt and OrderedSet in data_peer.
This commit is contained in:
John Preston
2017-12-01 22:38:44 +04:00
parent 3bdce06e19
commit 85b3d3f64d
27 changed files with 347 additions and 220 deletions

View File

@@ -115,11 +115,6 @@ private:
static const PhotoId UnknownPeerPhotoId = 0xFFFFFFFFFFFFFFFFULL;
inline const QString &emptyUsername() {
static QString empty;
return empty;
}
class PeerData;
class PeerClickHandler : public ClickHandler {
@@ -195,7 +190,7 @@ public:
const Text &dialogName() const;
const QString &shortName() const;
const QString &userName() const;
QString userName() const;
const PeerId id;
int32 bareId() const {
@@ -559,7 +554,7 @@ public:
void invalidateParticipants();
bool noParticipantInfo() const {
return (count > 0 || amIn()) && participants.isEmpty();
return (count > 0 || amIn()) && participants.empty();
}
MTPint inputChat;
@@ -623,11 +618,11 @@ public:
bool isMigrated() const {
return flags() & MTPDchat::Flag::f_migrated_to;
}
QMap<not_null<UserData*>, int> participants;
OrderedSet<not_null<UserData*>> invitedByMe;
OrderedSet<not_null<UserData*>> admins;
QList<not_null<UserData*>> lastAuthors;
OrderedSet<not_null<PeerData*>> markupSenders;
base::flat_map<not_null<UserData*>, int> participants;
base::flat_set<not_null<UserData*>> invitedByMe;
base::flat_set<not_null<UserData*>> admins;
std::deque<not_null<UserData*>> lastAuthors;
base::flat_set<not_null<PeerData*>> markupSenders;
int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other
// ImagePtr photoFull;
@@ -744,11 +739,14 @@ struct MegagroupInfo {
}
MTPChannelBannedRights rights;
};
QList<not_null<UserData*>> lastParticipants;
QMap<not_null<UserData*>, Admin> lastAdmins;
QMap<not_null<UserData*>, Restricted> lastRestricted;
OrderedSet<not_null<PeerData*>> markupSenders;
OrderedSet<not_null<UserData*>> bots;
std::deque<not_null<UserData*>> lastParticipants;
base::flat_map<not_null<UserData*>, Admin> lastAdmins;
base::flat_map<not_null<UserData*>, Restricted> lastRestricted;
base::flat_set<not_null<PeerData*>> markupSenders;
base::flat_set<not_null<UserData*>> bots;
// For admin badges, full admins list.
base::flat_set<UserId> admins;
UserData *creator = nullptr; // nullptr means unknown
int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other
@@ -898,6 +896,8 @@ public:
const MTPChannelBannedRights &oldRights,
const MTPChannelBannedRights &newRights);
bool isGroupAdmin(not_null<UserData*> user) const;
int32 date = 0;
int version = 0;
std::unique_ptr<MegagroupInfo> mgInfo;
@@ -1176,12 +1176,12 @@ inline const Text &PeerData::dialogName() const {
inline const QString &PeerData::shortName() const {
return isUser() ? asUser()->firstName : name;
}
inline const QString &PeerData::userName() const {
inline QString PeerData::userName() const {
return isUser()
? asUser()->username
: isChannel()
? asChannel()->username
: emptyUsername();
: QString();
}
inline bool PeerData::isVerified() const {
return isUser()