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

Method deleteConversationLocally

Telegram/SourceFiles/data/data_session.cpp:1535–1562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1533}
1534
1535void Session::deleteConversationLocally(not_null<PeerData*> peer) {
1536 const auto markLeft = [&] {
1537 if (const auto channel = peer->asMegagroup()) {
1538 channel->addFlags(ChannelDataFlag::Left);
1539 if (const auto from = channel->getMigrateFromChat()) {
1540 if (const auto migrated = historyLoaded(from)) {
1541 migrated->updateChatListExistence();
1542 }
1543 }
1544 }
1545 };
1546 if (const auto history = historyLoaded(peer)) {
1547 if (history->folderKnown()) {
1548 setChatPinned(history, FilterId(), false);
1549 }
1550 removeChatListEntry(history);
1551 history->clearFolder();
1552
1553 // We want to mark the channel as left before unloading the history,
1554 // otherwise some parts of updating may return us to the chats list.
1555 markLeft();
1556 history->clear(peer->isChannel()
1557 ? History::ClearType::Unload
1558 : History::ClearType::DeleteChat);
1559 } else {
1560 markLeft();
1561 }
1562}
1563
1564bool Session::chatsListLoaded(Data::Folder *folder) {
1565 return chatsList(folder)->loaded();

Callers 1

deleteHistoryMethod · 0.80

Calls 8

asMegagroupMethod · 0.80
getMigrateFromChatMethod · 0.80
clearFolderMethod · 0.80
isChannelMethod · 0.80
addFlagsMethod · 0.45
folderKnownMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected