MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / setFlags

Method setFlags

Telegram/SourceFiles/data/data_user.cpp:545–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545void UserData::setFlags(UserDataFlags which) {
546 if (!isBot()) {
547 which &= ~Flag::Forum;
548 }
549 const auto diff = flags() ^ which;
550 if (diff & Flag::Deleted) {
551 invalidateEmptyUserpic();
552 }
553 // Let Data::Forum live till the end of _flags.set.
554 // That way the data can be used in changes handler.
555 // Example: render frame for forum auto-closing animation.
556 const auto takenForum = (botInfo
557 && (diff & Flag::Forum)
558 && !(which & Flag::Forum))
559 ? botInfo->takeForumData()
560 : nullptr;
561 if ((diff & Flag::Forum) && (which & Flag::Forum)) {
562 if (const auto info = botInfo.get()) {
563 info->ensureForum(this);
564 }
565 }
566 _flags.set((flags() & Flag::Self) | (which & ~Flag::Self));
567 if (diff & Flag::Forum) {
568 if (const auto history = this->owner().historyLoaded(this)) {
569 if (diff & Flag::Forum) {
570 Core::App().notifications().clearFromHistory(history);
571 history->updateChatListEntryHeight();
572 if (history->inChatList()) {
573 if (const auto forum = this->forum()) {
574 forum->preloadTopics();
575 }
576 }
577 }
578 }
579 }
580 if (const auto raw = takenForum.get()) {
581 owner().forumIcons().clearUserpicsReset(raw);
582 }
583}
584
585void UserData::addFlags(UserDataFlags which) {
586 setFlags(flags() | which);

Callers 15

joinChannelMethod · 0.45
setupContentMethod · 0.45
setupContentMethod · 0.45
setStoriesHiddenMethod · 0.45
setIsBlockedMethod · 0.45
ApplyUserUpdateFunction · 0.45
requestTopicsMethod · 0.45
clearMethod · 0.45
processUserMethod · 0.45
processChatMethod · 0.45
readPeerFunction · 0.45

Calls 13

forumMethod · 0.95
AppClass · 0.85
inChatListMethod · 0.80
preloadTopicsMethod · 0.80
clearUserpicsResetMethod · 0.80
takeForumDataMethod · 0.45
getMethod · 0.45
ensureForumMethod · 0.45
setMethod · 0.45
historyLoadedMethod · 0.45
ownerMethod · 0.45

Tested by

no test coverage detected