diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp index b23329c03d..b50c105f32 100644 --- a/Telegram/SourceFiles/export/export_api_wrap.cpp +++ b/Telegram/SourceFiles/export/export_api_wrap.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "export/output/export_output_file.h" #include "mtproto/mtproto_response.h" #include "base/bytes.h" +#include "base/options.h" #include "base/random.h" #include #include @@ -1069,7 +1070,35 @@ void ApiWrap::requestContacts(FnMut done) { mainRequest(MTPcontacts_GetSaved( )).done([=](const MTPVector &result) { _contactsProcess->result = Data::ParseContactsList(result); - requestTopPeersSlice(); + + const auto resolve = [=](int index, const auto &resolveNext) -> void { + if (index == _contactsProcess->result.list.size()) { + return requestTopPeersSlice(); + } + const auto &contact = _contactsProcess->result.list[index]; + mainRequest(MTPcontacts_ResolvePhone( + MTP_string(qs(contact.phoneNumber)) + )).done([=](const MTPcontacts_ResolvedPeer &result) { + auto &contact = _contactsProcess->result.list[index]; + contact.userId = result.data().vpeer().match([&]( + const MTPDpeerUser &user) { + return UserId(user.vuser_id()); + }, [](const auto &) { + return UserId(); + }); + resolveNext(index + 1, resolveNext); + }).fail([=](const MTP::Error &) { + resolveNext(index + 1, resolveNext); + return true; + }).send(); + }; + + if (base::options::lookup("show-peer-id-below-about").value()) { + resolve(0, resolve); + } else { + requestTopPeersSlice(); + } + }).send(); } diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index 30397aab63..3953152278 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -357,6 +357,7 @@ struct UserpicData { QString largeLink; QByteArray firstName; QByteArray lastName; + QByteArray tooltip; }; struct StoryData { @@ -743,9 +744,17 @@ QByteArray HtmlWriter::Wrap::pushUserpic(const UserpicData &userpic) { }, { "style", sizeStyle } })); - result.append(pushDiv( - "initials", - "line-height: " + size)); + if (userpic.tooltip.isEmpty()) { + result.append(pushDiv( + "initials", + "line-height: " + size)); + } else { + result.append(pushTag("div", { + { "class", "initials" }, + { "style", "line-height: " + size }, + { "title", userpic.tooltip }, + })); + } auto character = [](const QByteArray &from) { const auto utf = QString::fromUtf8(from).trimmed(); return utf.isEmpty() @@ -2493,6 +2502,10 @@ Result HtmlWriter::writeSavedContacts(const Data::ContactsList &data) { }; userpic.firstName = contact.firstName; userpic.lastName = contact.lastName; + if (contact.userId) { + const auto raw = contact.userId.bare & PeerId::kChatTypeMask; + userpic.tooltip = (u"ID: "_q + QString::number(raw)).toUtf8(); + } block.append(file->pushListEntry( userpic, ComposeName(userpic, "Deleted Account"), diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index cd78b8d93d..eba90de159 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -74,7 +74,8 @@ namespace { base::options::toggle ShowPeerIdBelowAbout({ .id = kOptionShowPeerIdBelowAbout, .name = "Show Peer IDs in Profile", - .description = "Show peer IDs from API below their Bio / Description.", + .description = "Show peer IDs from API below their Bio / Description." + " Add contact IDs to exported data.", }); [[nodiscard]] rpl::producer UsernamesSubtext(