mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Removed username from public data members of UserData.
This commit is contained in:
parent
9b7329b378
commit
5751d29c47
26 changed files with 112 additions and 61 deletions
|
@ -418,7 +418,7 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
|||
}();
|
||||
if (!fastSwitchDone) {
|
||||
controller->content()->inlineSwitchLayer('@'
|
||||
+ bot->username
|
||||
+ bot->username()
|
||||
+ ' '
|
||||
+ QString::fromUtf8(button->data));
|
||||
}
|
||||
|
|
|
@ -1953,7 +1953,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
|| user->phone().isEmpty())
|
||||
? QString()
|
||||
: Ui::FormatPhone(user->phone())),
|
||||
user->username);
|
||||
user->username());
|
||||
|
||||
session().changes().peerUpdated(
|
||||
user,
|
||||
|
|
|
@ -3559,7 +3559,7 @@ void ApiWrap::sendBotStart(
|
|||
: bot.get())));
|
||||
message.textWithTags = { u"/start"_q, TextWithTags::Tags() };
|
||||
if (chat) {
|
||||
message.textWithTags.text += '@' + bot->username;
|
||||
message.textWithTags.text += '@' + bot->username();
|
||||
}
|
||||
sendMessage(std::move(message));
|
||||
return;
|
||||
|
|
|
@ -1446,7 +1446,7 @@ void EditNameBox::saveSelfFail(const QString &error) {
|
|||
TextUtilities::SingleLine(_first->getLastText().trimmed()),
|
||||
TextUtilities::SingleLine(_last->getLastText().trimmed()),
|
||||
QString(),
|
||||
TextUtilities::SingleLine(_user->username));
|
||||
TextUtilities::SingleLine(_user->username()));
|
||||
closeBox();
|
||||
} else if (error == "FIRSTNAME_INVALID") {
|
||||
_first->setFocus();
|
||||
|
|
|
@ -57,7 +57,7 @@ void SendRequest(
|
|||
first,
|
||||
last,
|
||||
user->nameOrPhone,
|
||||
user->username);
|
||||
user->username());
|
||||
user->session().api().applyUpdates(result);
|
||||
if (const auto settings = user->settings()) {
|
||||
const auto flags = PeerSetting::AddContact
|
||||
|
|
|
@ -1266,7 +1266,7 @@ void FastShareMessage(
|
|||
if (const auto media = item->media()) {
|
||||
if (const auto game = media->game()) {
|
||||
const auto link = session->createInternalLinkFull(
|
||||
bot->username + qsl("?game=") + game->shortName);
|
||||
bot->username() + qsl("?game=") + game->shortName);
|
||||
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ UsernameBox::UsernameBox(QWidget*, not_null<Main::Session*> session)
|
|||
this,
|
||||
st::defaultInputField,
|
||||
rpl::single(qsl("@username")),
|
||||
session->user()->username,
|
||||
session->user()->username(),
|
||||
QString())
|
||||
, _about(
|
||||
this,
|
||||
|
@ -45,7 +45,7 @@ UsernameBox::UsernameBox(QWidget*, not_null<Main::Session*> session)
|
|||
}
|
||||
|
||||
void UsernameBox::prepare() {
|
||||
_goodText = _session->user()->username.isEmpty()
|
||||
_goodText = _session->user()->username().isEmpty()
|
||||
? QString()
|
||||
: tr::lng_username_available(tr::now);
|
||||
|
||||
|
@ -196,7 +196,7 @@ void UsernameBox::check() {
|
|||
_checkRequestId = 0;
|
||||
|
||||
_errorText = (mtpIsTrue(result)
|
||||
|| _checkUsername == _session->user()->username)
|
||||
|| _checkUsername == _session->user()->username())
|
||||
? QString()
|
||||
: tr::lng_username_occupied(tr::now);
|
||||
_goodText = _errorText.isEmpty()
|
||||
|
@ -263,7 +263,7 @@ void UsernameBox::linkClick() {
|
|||
void UsernameBox::updateFail(const QString &error) {
|
||||
const auto self = _session->user();
|
||||
if ((error == qstr("USERNAME_NOT_MODIFIED"))
|
||||
|| (_sentUsername == self->username)) {
|
||||
|| (_sentUsername == self->username())) {
|
||||
self->setName(
|
||||
TextUtilities::SingleLine(self->firstName),
|
||||
TextUtilities::SingleLine(self->lastName),
|
||||
|
@ -291,7 +291,7 @@ void UsernameBox::checkFail(const QString &error) {
|
|||
_errorText = tr::lng_username_invalid(tr::now);
|
||||
update();
|
||||
} else if ((error == qstr("USERNAME_OCCUPIED"))
|
||||
&& (_checkUsername != _session->user()->username)) {
|
||||
&& (_checkUsername != _session->user()->username())) {
|
||||
_errorText = tr::lng_username_occupied(tr::now);
|
||||
update();
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ QString WrapCommandInChat(
|
|||
not_null<PeerData*> peer,
|
||||
const QString &command,
|
||||
not_null<UserData*> bot) {
|
||||
if (!bot->isBot() || bot->username.isEmpty()) {
|
||||
if (!bot->isBot() || bot->username().isEmpty()) {
|
||||
return command;
|
||||
}
|
||||
const auto botStatus = peer->isChat()
|
||||
|
@ -42,7 +42,7 @@ QString WrapCommandInChat(
|
|||
? peer->asChannel()->mgInfo->botStatus
|
||||
: -1;
|
||||
return ((command.indexOf('@') < 2) && (botStatus == 0 || botStatus == 2))
|
||||
? command + '@' + bot->username
|
||||
? command + '@' + bot->username()
|
||||
: command;
|
||||
}
|
||||
|
||||
|
|
|
@ -396,8 +396,9 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
}
|
||||
|
||||
auto filterNotPassedByUsername = [this](UserData *user) -> bool {
|
||||
if (user->username.startsWith(_filter, Qt::CaseInsensitive)) {
|
||||
bool exactUsername = (user->username.size() == _filter.size());
|
||||
if (user->username().startsWith(_filter, Qt::CaseInsensitive)) {
|
||||
const auto exactUsername =
|
||||
(user->username().size() == _filter.size());
|
||||
return exactUsername;
|
||||
}
|
||||
return true;
|
||||
|
@ -405,7 +406,8 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
auto filterNotPassedByName = [&](UserData *user) -> bool {
|
||||
for (const auto &nameWord : user->nameWords()) {
|
||||
if (nameWord.startsWith(_filter, Qt::CaseInsensitive)) {
|
||||
auto exactUsername = (user->username.compare(_filter, Qt::CaseInsensitive) == 0);
|
||||
const auto exactUsername =
|
||||
(user->username().compare(_filter, Qt::CaseInsensitive) == 0);
|
||||
return exactUsername;
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +556,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
for (const auto &command : *i->second) {
|
||||
if (!listAllSuggestions) {
|
||||
auto toFilter = (hasUsername || botStatus == 0 || botStatus == 2)
|
||||
? command.command + '@' + user->username
|
||||
? command.command + '@' + user->username()
|
||||
: command.command;
|
||||
if (!toFilter.startsWith(_filter, Qt::CaseInsensitive)/* || toFilter.size() == _filter.size()*/) {
|
||||
continue;
|
||||
|
@ -570,7 +572,11 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
const auto user = i->first;
|
||||
for (const auto &command : *i->second) {
|
||||
if (!listAllSuggestions) {
|
||||
QString toFilter = (hasUsername || botStatus == 0 || botStatus == 2) ? command.command + '@' + user->username : command.command;
|
||||
const auto toFilter = (hasUsername
|
||||
|| botStatus == 0
|
||||
|| botStatus == 2)
|
||||
? command.command + '@' + user->username()
|
||||
: command.command;
|
||||
if (!toFilter.startsWith(_filter, Qt::CaseInsensitive)/* || toFilter.size() == _filter.size()*/) continue;
|
||||
}
|
||||
brows.push_back(make(user, command));
|
||||
|
@ -934,8 +940,17 @@ void FieldAutocomplete::Inner::paintEvent(QPaintEvent *e) {
|
|||
if (!_mrows->empty()) {
|
||||
auto &row = _mrows->at(i);
|
||||
const auto user = row.user;
|
||||
auto first = (!filterIsEmpty && user->username.startsWith(filter, Qt::CaseInsensitive)) ? ('@' + user->username.mid(0, filterSize)) : QString();
|
||||
auto second = first.isEmpty() ? (user->username.isEmpty() ? QString() : ('@' + user->username)) : user->username.mid(filterSize);
|
||||
auto first = (!filterIsEmpty
|
||||
&& user->username().startsWith(
|
||||
filter,
|
||||
Qt::CaseInsensitive))
|
||||
? ('@' + user->username().mid(0, filterSize))
|
||||
: QString();
|
||||
auto second = first.isEmpty()
|
||||
? (user->username().isEmpty()
|
||||
? QString()
|
||||
: ('@' + user->username()))
|
||||
: user->username().mid(filterSize);
|
||||
auto firstwidth = st::mentionFont->width(first);
|
||||
auto secondwidth = st::mentionFont->width(second);
|
||||
auto unamewidth = firstwidth + secondwidth;
|
||||
|
@ -1000,7 +1015,7 @@ void FieldAutocomplete::Inner::paintEvent(QPaintEvent *e) {
|
|||
auto toHighlight = row.command;
|
||||
int32 botStatus = _parent->chat() ? _parent->chat()->botStatus : ((_parent->channel() && _parent->channel()->isMegagroup()) ? _parent->channel()->mgInfo->botStatus : -1);
|
||||
if (hasUsername || botStatus == 0 || botStatus == 2) {
|
||||
toHighlight += '@' + user->username;
|
||||
toHighlight += '@' + user->username();
|
||||
}
|
||||
user->loadUserpic();
|
||||
user->paintUserpicLeft(p, row.userpic, st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), width(), st::mentionPhotoSize);
|
||||
|
@ -1157,7 +1172,7 @@ bool FieldAutocomplete::Inner::chooseAtIndex(
|
|||
|| _parent->filter().indexOf('@') > 0);
|
||||
const auto commandString = QString("/%1%2").arg(
|
||||
command,
|
||||
insertUsername ? ('@' + user->username) : QString());
|
||||
insertUsername ? ('@' + user->username()) : QString());
|
||||
|
||||
_botCommandChosen.fire({ commandString, method });
|
||||
return true;
|
||||
|
|
|
@ -198,7 +198,7 @@ void PeerData::updateNameDelayed(
|
|||
if (_name == newName && _nameVersion > 1) {
|
||||
if (isUser()) {
|
||||
if (asUser()->nameOrPhone == newNameOrPhone
|
||||
&& asUser()->username == newUsername) {
|
||||
&& asUser()->username() == newUsername) {
|
||||
return;
|
||||
}
|
||||
} else if (isChannel()) {
|
||||
|
@ -220,8 +220,8 @@ void PeerData::updateNameDelayed(
|
|||
flags |= UpdateFlag::Name;
|
||||
}
|
||||
if (isUser()) {
|
||||
if (asUser()->username != newUsername) {
|
||||
asUser()->username = newUsername;
|
||||
if (asUser()->username() != newUsername) {
|
||||
asUser()->setUsername(newUsername);
|
||||
flags |= UpdateFlag::Username;
|
||||
}
|
||||
asUser()->setNameOrPhone(newNameOrPhone);
|
||||
|
@ -631,7 +631,7 @@ void PeerData::fillNames() {
|
|||
if (user->nameOrPhone != name()) {
|
||||
appendToIndex(user->nameOrPhone);
|
||||
}
|
||||
appendToIndex(user->username);
|
||||
appendToIndex(user->username());
|
||||
if (isSelf()) {
|
||||
const auto english = qsl("Saved messages");
|
||||
const auto localized = tr::lng_saved_messages(tr::now);
|
||||
|
@ -820,7 +820,7 @@ const QString &PeerData::shortName() const {
|
|||
|
||||
QString PeerData::userName() const {
|
||||
if (const auto user = asUser()) {
|
||||
return user->username;
|
||||
return user->username();
|
||||
} else if (const auto channel = asChannel()) {
|
||||
return channel->username();
|
||||
}
|
||||
|
|
|
@ -517,12 +517,24 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
|||
} else {
|
||||
// apply first_name and last_name from minimal user only if we don't have
|
||||
// local values for first name and last name already, otherwise skip
|
||||
bool noLocalName = result->firstName.isEmpty() && result->lastName.isEmpty();
|
||||
QString fname = (!minimal || noLocalName) ? TextUtilities::SingleLine(qs(data.vfirst_name().value_or_empty())) : result->firstName;
|
||||
QString lname = (!minimal || noLocalName) ? TextUtilities::SingleLine(qs(data.vlast_name().value_or_empty())) : result->lastName;
|
||||
const auto noLocalName = result->firstName.isEmpty()
|
||||
&& result->lastName.isEmpty();
|
||||
const auto fname = (!minimal || noLocalName)
|
||||
? TextUtilities::SingleLine(
|
||||
qs(data.vfirst_name().value_or_empty()))
|
||||
: result->firstName;
|
||||
const auto lname = (!minimal || noLocalName)
|
||||
? TextUtilities::SingleLine(
|
||||
qs(data.vlast_name().value_or_empty()))
|
||||
: result->lastName;
|
||||
|
||||
QString phone = minimal ? result->phone() : qs(data.vphone().value_or_empty());
|
||||
QString uname = minimal ? result->username : TextUtilities::SingleLine(qs(data.vusername().value_or_empty()));
|
||||
const auto phone = minimal
|
||||
? result->phone()
|
||||
: qs(data.vphone().value_or_empty());
|
||||
const auto uname = minimal
|
||||
? result->username()
|
||||
: TextUtilities::SingleLine(
|
||||
qs(data.vusername().value_or_empty()));
|
||||
|
||||
const auto phoneChanged = (result->phone() != phone);
|
||||
if (phoneChanged) {
|
||||
|
|
|
@ -119,6 +119,12 @@ void UserData::setName(const QString &newFirstName, const QString &newLastName,
|
|||
updateNameDelayed(newFullName, newPhoneName, newUsername);
|
||||
}
|
||||
|
||||
void UserData::setUsername(const QString &username) {
|
||||
if (_username != username) {
|
||||
_username = username;
|
||||
}
|
||||
}
|
||||
|
||||
void UserData::setPhone(const QString &newPhone) {
|
||||
if (_phone != newPhone) {
|
||||
_phone = newPhone;
|
||||
|
@ -281,6 +287,10 @@ bool UserData::canShareThisContactFast() const {
|
|||
return !_phone.isEmpty();
|
||||
}
|
||||
|
||||
const QString &UserData::username() const {
|
||||
return _username;
|
||||
}
|
||||
|
||||
const QString &UserData::phone() const {
|
||||
return _phone;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
void setEmojiStatus(DocumentId emojiStatusId, TimeId until = 0);
|
||||
[[nodiscard]] DocumentId emojiStatusId() const;
|
||||
|
||||
void setUsername(const QString &username);
|
||||
void setPhone(const QString &newPhone);
|
||||
void setBotInfoVersion(int version);
|
||||
void setBotInfo(const MTPBotInfo &info);
|
||||
|
@ -126,8 +127,8 @@ public:
|
|||
|
||||
QString firstName;
|
||||
QString lastName;
|
||||
QString username;
|
||||
[[nodiscard]] const QString &phone() const;
|
||||
[[nodiscard]] const QString &username() const;
|
||||
QString nameOrPhone;
|
||||
TimeId onlineTill = 0;
|
||||
|
||||
|
@ -165,6 +166,7 @@ private:
|
|||
Flags _flags;
|
||||
|
||||
std::vector<Data::UnavailableReason> _unavailableReasons;
|
||||
QString _username;
|
||||
QString _phone;
|
||||
ContactStatus _contactStatus = ContactStatus::Unknown;
|
||||
CallsStatus _callsStatus = CallsStatus::Unknown;
|
||||
|
|
|
@ -3282,7 +3282,7 @@ void HistoryInner::elementSendBotCommand(
|
|||
}
|
||||
|
||||
void HistoryInner::elementHandleViaClick(not_null<UserData*> bot) {
|
||||
_widget->insertBotCommand('@' + bot->username);
|
||||
_widget->insertBotCommand('@' + bot->username());
|
||||
}
|
||||
|
||||
bool HistoryInner::elementIsChatWide() {
|
||||
|
|
|
@ -53,7 +53,10 @@ void HistoryMessageVia::create(
|
|||
UserId userId) {
|
||||
bot = owner->user(userId);
|
||||
maxWidth = st::msgServiceNameFont->width(
|
||||
tr::lng_inline_bot_via(tr::now, lt_inline_bot, '@' + bot->username));
|
||||
tr::lng_inline_bot_via(
|
||||
tr::now,
|
||||
lt_inline_bot,
|
||||
'@' + bot->username()));
|
||||
link = std::make_shared<LambdaClickHandler>([bot = this->bot](
|
||||
ClickContext context) {
|
||||
const auto my = context.other.value<ClickHandlerContext>();
|
||||
|
@ -83,7 +86,10 @@ void HistoryMessageVia::resize(int32 availw) const {
|
|||
text = QString();
|
||||
width = 0;
|
||||
} else {
|
||||
text = tr::lng_inline_bot_via(tr::now, lt_inline_bot, '@' + bot->username);
|
||||
text = tr::lng_inline_bot_via(
|
||||
tr::now,
|
||||
lt_inline_bot,
|
||||
'@' + bot->username());
|
||||
if (availw < maxWidth) {
|
||||
text = st::msgServiceNameFont->elided(text, availw);
|
||||
width = st::msgServiceNameFont->width(text);
|
||||
|
@ -182,7 +188,7 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
|||
lt_channel,
|
||||
Ui::Text::Link(phrase.text, 1), // Link 1.
|
||||
lt_inline_bot,
|
||||
Ui::Text::Link('@' + via->bot->username, 2), // Link 2.
|
||||
Ui::Text::Link('@' + via->bot->username(), 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
phrase = tr::lng_forwarded_via(
|
||||
|
@ -190,7 +196,7 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
|||
lt_user,
|
||||
Ui::Text::Link(phrase.text, 1), // Link 1.
|
||||
lt_inline_bot,
|
||||
Ui::Text::Link('@' + via->bot->username, 2), // Link 2.
|
||||
Ui::Text::Link('@' + via->bot->username(), 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1333,14 +1333,14 @@ void HistoryWidget::start() {
|
|||
|
||||
void HistoryWidget::insertMention(UserData *user) {
|
||||
QString replacement, entityTag;
|
||||
if (user->username.isEmpty()) {
|
||||
if (user->username().isEmpty()) {
|
||||
replacement = user->firstName;
|
||||
if (replacement.isEmpty()) {
|
||||
replacement = user->name();
|
||||
}
|
||||
entityTag = PrepareMentionTag(user);
|
||||
} else {
|
||||
replacement = '@' + user->username;
|
||||
replacement = '@' + user->username();
|
||||
}
|
||||
_field->insertTag(replacement, entityTag);
|
||||
}
|
||||
|
@ -1759,7 +1759,10 @@ void HistoryWidget::setInnerFocus() {
|
|||
bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo) {
|
||||
if (samePeerBot) {
|
||||
if (_history) {
|
||||
TextWithTags textWithTags = { '@' + samePeerBot->username + ' ' + query, TextWithTags::Tags() };
|
||||
const auto textWithTags = TextWithTags{
|
||||
'@' + samePeerBot->username() + ' ' + query,
|
||||
TextWithTags::Tags(),
|
||||
};
|
||||
MessageCursor cursor = { int(textWithTags.text.size()), int(textWithTags.text.size()), QFIXED_MAX };
|
||||
_history->setLocalDraft(std::make_unique<Data::Draft>(
|
||||
textWithTags,
|
||||
|
@ -1781,7 +1784,10 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U
|
|||
bot->botInfo->inlineReturnTo = Dialogs::EntryState();
|
||||
using Section = Dialogs::EntryState::Section;
|
||||
|
||||
TextWithTags textWithTags = { '@' + bot->username + ' ' + query, TextWithTags::Tags() };
|
||||
const auto textWithTags = TextWithTags{
|
||||
'@' + bot->username() + ' ' + query,
|
||||
TextWithTags::Tags(),
|
||||
};
|
||||
MessageCursor cursor = { int(textWithTags.text.size()), int(textWithTags.text.size()), QFIXED_MAX };
|
||||
auto draft = std::make_unique<Data::Draft>(
|
||||
textWithTags,
|
||||
|
@ -4182,7 +4188,7 @@ bool HistoryWidget::insertBotCommand(const QString &cmd) {
|
|||
if (bot && (!bot->isUser() || !bot->asUser()->isBot())) {
|
||||
bot = nullptr;
|
||||
}
|
||||
auto username = bot ? bot->asUser()->username : QString();
|
||||
auto username = bot ? bot->asUser()->username() : QString();
|
||||
auto botStatus = _peer->isChat() ? _peer->asChat()->botStatus : (_peer->isMegagroup() ? _peer->asChannel()->mgInfo->botStatus : -1);
|
||||
if (toInsert.indexOf('@') < 0 && !username.isEmpty() && (botStatus == 0 || botStatus == 2)) {
|
||||
toInsert += '@' + username;
|
||||
|
@ -4818,7 +4824,7 @@ void HistoryWidget::updateFieldPlaceholder() {
|
|||
if (!_editMsgId && _inlineBot && !_inlineLookingUpBot) {
|
||||
_field->setPlaceholder(
|
||||
rpl::single(_inlineBot->botInfo->inlinePlaceholder.mid(1)),
|
||||
_inlineBot->username.size() + 2);
|
||||
_inlineBot->username().size() + 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1497,12 +1497,12 @@ void ComposeControls::initAutocomplete() {
|
|||
}
|
||||
};
|
||||
const auto insertMention = [=](not_null<UserData*> user) {
|
||||
if (user->username.isEmpty()) {
|
||||
if (user->username().isEmpty()) {
|
||||
_field->insertTag(
|
||||
user->firstName.isEmpty() ? user->name() : user->firstName,
|
||||
PrepareMentionTag(user));
|
||||
} else {
|
||||
_field->insertTag('@' + user->username);
|
||||
_field->insertTag('@' + user->username());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1604,7 +1604,7 @@ void ComposeControls::updateFieldPlaceholder() {
|
|||
if (!isEditingMessage() && _isInlineBot) {
|
||||
_field->setPlaceholder(
|
||||
rpl::single(_inlineBot->botInfo->inlinePlaceholder.mid(1)),
|
||||
_inlineBot->username.size() + 2);
|
||||
_inlineBot->username().size() + 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1972,7 +1972,7 @@ void RepliesWidget::listSendBotCommand(
|
|||
}
|
||||
|
||||
void RepliesWidget::listHandleViaClick(not_null<UserData*> bot) {
|
||||
_composeControls->setText({ '@' + bot->username + ' ' });
|
||||
_composeControls->setText({ '@' + bot->username() + ' ' });
|
||||
}
|
||||
|
||||
not_null<Ui::ChatTheme*> RepliesWidget::listChatTheme() {
|
||||
|
|
|
@ -1235,7 +1235,7 @@ void ScheduledWidget::listSendBotCommand(
|
|||
}
|
||||
|
||||
void ScheduledWidget::listHandleViaClick(not_null<UserData*> bot) {
|
||||
_composeControls->setText({ '@' + bot->username + ' ' });
|
||||
_composeControls->setText({ '@' + bot->username() + ' ' });
|
||||
}
|
||||
|
||||
not_null<Ui::ChatTheme*> ScheduledWidget::listChatTheme() {
|
||||
|
|
|
@ -406,7 +406,7 @@ void AttachWebView::request(
|
|||
if (botUsername.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
const auto username = _bot ? _bot->username : _botUsername;
|
||||
const auto username = _bot ? _bot->username() : _botUsername;
|
||||
if (_peer == peer
|
||||
&& username.toLower() == botUsername.toLower()
|
||||
&& _startCommand == startCommand) {
|
||||
|
@ -879,7 +879,7 @@ void AttachWebView::show(
|
|||
.url = url,
|
||||
.userDataPath = _session->domain().local().webviewDataPath(),
|
||||
.title = std::move(title),
|
||||
.bottom = rpl::single('@' + _bot->username),
|
||||
.bottom = rpl::single('@' + _bot->username()),
|
||||
.handleLocalUri = handleLocalUri,
|
||||
.handleInvoice = handleInvoice,
|
||||
.sendData = sendData,
|
||||
|
|
|
@ -148,7 +148,7 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
|
|||
auto text = policyUrl.isEmpty()
|
||||
? tr::lng_passport_allow(
|
||||
lt_bot,
|
||||
rpl::single('@' + bot->username)
|
||||
rpl::single('@' + bot->username())
|
||||
) | Ui::Text::ToWithEntities()
|
||||
: tr::lng_passport_accept_allow(
|
||||
lt_policy,
|
||||
|
@ -157,7 +157,7 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
|
|||
rpl::single(bot->name())
|
||||
) | Ui::Text::ToLink(policyUrl),
|
||||
lt_bot,
|
||||
rpl::single('@' + bot->username) | Ui::Text::ToWithEntities(),
|
||||
rpl::single('@' + bot->username()) | Ui::Text::ToWithEntities(),
|
||||
Ui::Text::WithEntities);
|
||||
const auto policy = inner->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
|
|
|
@ -421,7 +421,7 @@ void Form::processDetails(const MTPDpayments_paymentForm &data) {
|
|||
if (const auto botId = _details.botId) {
|
||||
if (const auto bot = _session->data().userLoaded(botId)) {
|
||||
_invoice.cover.seller = bot->name();
|
||||
_details.termsBotUsername = bot->username;
|
||||
_details.termsBotUsername = bot->username();
|
||||
}
|
||||
}
|
||||
if (const auto providerId = _details.providerId) {
|
||||
|
|
|
@ -439,8 +439,8 @@ std::unique_ptr<PeerListRow> BlockedBoxController::createRow(
|
|||
return tr::lng_group_status(tr::now);
|
||||
} else if (!user->phone().isEmpty()) {
|
||||
return Ui::FormatPhone(user->phone());
|
||||
} else if (!user->username.isEmpty()) {
|
||||
return '@' + user->username;
|
||||
} else if (!user->username().isEmpty()) {
|
||||
return '@' + user->username();
|
||||
} else if (user->isBot()) {
|
||||
return tr::lng_status_bot(tr::now);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ uint32 peerSize(not_null<PeerData*> peer) {
|
|||
result += stringSize(user->firstName)
|
||||
+ stringSize(user->lastName)
|
||||
+ stringSize(user->phone())
|
||||
+ stringSize(user->username)
|
||||
+ stringSize(user->username())
|
||||
+ sizeof(quint64) // access
|
||||
+ sizeof(qint32) // flags
|
||||
+ sizeof(qint32) // onlineTill
|
||||
|
@ -164,7 +164,7 @@ void writePeer(QDataStream &stream, not_null<PeerData*> peer) {
|
|||
<< user->firstName
|
||||
<< user->lastName
|
||||
<< user->phone()
|
||||
<< user->username
|
||||
<< user->username()
|
||||
<< quint64(user->accessHash())
|
||||
<< qint32(user->flags())
|
||||
<< botInlinePlaceholder
|
||||
|
|
|
@ -2537,7 +2537,7 @@ void Account::readRecentHashtagsAndBots() {
|
|||
} else if (peer->isUser()
|
||||
&& peer->asUser()->isBot()
|
||||
&& !peer->asUser()->botInfo->inlinePlaceholder.isEmpty()
|
||||
&& !peer->asUser()->username.isEmpty()) {
|
||||
&& !peer->asUser()->username().isEmpty()) {
|
||||
bots.push_back(peer->asUser());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -957,9 +957,9 @@ QString Manager::addTargetAccountName(
|
|||
return add
|
||||
? (title
|
||||
+ accountNameSeparator()
|
||||
+ (session->user()->username.isEmpty()
|
||||
+ (session->user()->username().isEmpty()
|
||||
? session->user()->name()
|
||||
: session->user()->username))
|
||||
: session->user()->username()))
|
||||
: title;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue