2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Added usernames info to UserData.

This commit is contained in:
23rd
2022-10-09 14:25:47 +03:00
committed by John Preston
parent 51cead1445
commit ffa8a94180
3 changed files with 30 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_changes.h"
#include "data/data_peer_bot_command.h"
#include "data/data_emoji_statuses.h"
#include "data/data_user_names.h"
#include "data/notify/data_notify_settings.h"
#include "ui/text/text_options.h"
#include "lang/lang_keys.h"
@@ -119,6 +120,16 @@ void UserData::setName(const QString &newFirstName, const QString &newLastName,
updateNameDelayed(newFullName, newPhoneName, newUsername);
}
void UserData::setUsernames(const Data::Usernames &usernames) {
_usernames = ranges::views::all(
usernames
) | ranges::views::filter([&](const Data::Username &username) {
return username.active;
}) | ranges::views::transform([&](const Data::Username &username) {
return username.username;
}) | ranges::to_vector;
}
void UserData::setUsername(const QString &username) {
if (_username != username) {
_username = username;
@@ -291,6 +302,10 @@ const QString &UserData::username() const {
return _username;
}
const std::vector<QString> &UserData::usernames() const {
return _usernames;
}
const QString &UserData::phone() const {
return _phone;
}