mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Improve export phrases.
This commit is contained in:
parent
9d66f9cc03
commit
914e043abe
@ -469,7 +469,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_calls_privacy" = "Phone calls privacy";
|
||||
"lng_settings_groups_invite_privacy" = "Group invite settings";
|
||||
"lng_settings_show_sessions" = "Show all sessions";
|
||||
"lng_settings_export_data" = "Export all my data";
|
||||
"lng_settings_export_data" = "Export Telegram data";
|
||||
"lng_settings_self_destruct" = "Account self-destruct settings";
|
||||
"lng_settings_change_phone" = "Change phone number";
|
||||
|
||||
@ -1656,10 +1656,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"lng_export_title" = "Export Personal Data";
|
||||
"lng_export_progress_title" = "Exporting personal data";
|
||||
"lng_export_option_info" = "Personal information";
|
||||
"lng_export_option_info_about" = "Your chosen screen name, username and profile pictures are public and available to everyone. You don't have to supply your real name.";
|
||||
"lng_export_option_info" = "Account information";
|
||||
"lng_export_option_info_about" = "Your chosen screen name, username, phone number and profile pictures.";
|
||||
"lng_export_option_contacts" = "Contacts list";
|
||||
"lng_export_option_contacts_about" = "To let you connect with friends across all your devices, your contacts are continuosly synced with Telegram. You can disable syncing or delete your stored contacts in Settings > Privacy & Security.";
|
||||
"lng_export_option_contacts_about" = "If you allow access, contacts are continuously synced with Telegram. You can adjust this in Settings > Privacy & Security on mobile devices.";
|
||||
"lng_export_option_sessions" = "Sessions list";
|
||||
"lng_export_option_sessions_about" = "We store this to display your connected devices in Settings > Privacy & Security > Active Sessions. Terminating a session removes this data from Telegram servers.";
|
||||
"lng_export_header_chats" = "Chat export settings";
|
||||
@ -1685,7 +1685,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_export_option_json" = "Machine-readable JSON";
|
||||
"lng_export_start" = "Export";
|
||||
"lng_export_state_initializing" = "Initializing...";
|
||||
"lng_export_state_userpics" = "Personal photos";
|
||||
"lng_export_state_userpics" = "Profile pictures";
|
||||
"lng_export_state_chats_list" = "Processing chats...";
|
||||
"lng_export_state_chats" = "Chats";
|
||||
"lng_export_state_progress" = "{count} / {total}";
|
||||
@ -1695,7 +1695,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_export_state_video_message" = "Round video message";
|
||||
"lng_export_state_sticker" = "Sticker";
|
||||
"lng_export_state_gif" = "Animated GIF";
|
||||
"lng_export_progress" = "Note: You can close this window, but please don't quit Telegram while the export is running.";
|
||||
"lng_export_progress" = "You can close this window now. Please don't quit Telegram until the data export is completed.";
|
||||
"lng_export_stop" = "Stop";
|
||||
"lng_export_sure_stop" = "Are you sure you want to stop exporting your data?\n\nIf you do, you'll need to start over.";
|
||||
"lng_export_about_done" = "Your data was successfully exported.";
|
||||
|
@ -12,17 +12,33 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Export {
|
||||
namespace Data {
|
||||
|
||||
inline Utf8String AboutPersonalInfo() {
|
||||
return "Your chosen screen name, username and profile pictures "
|
||||
"are public and available to everyone. "
|
||||
"You don't have to supply your real name.";
|
||||
inline Utf8String AboutContacts() {
|
||||
return "If you allow access, your contacts are continuously synced "
|
||||
"with Telegram. Thanks to this, you can easily switch to Telegram "
|
||||
"without losing your existing social graph "
|
||||
"\xE2\x80\x93 and connect with friends across all your devices. "
|
||||
"We use data about your contacts to let you know "
|
||||
"when they join Telegram. We also use it to make sure "
|
||||
"that you see the names you have in your phone book "
|
||||
"instead of the screen names people choose for themselves.\n\n"
|
||||
"You can disable contacts syncing or delete your stored contacts "
|
||||
"in Settings > Privacy & Security on Telegram's mobile apps.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutContacts() {
|
||||
return "To let you connect with friends across all your devices, "
|
||||
"your contacts are continuosly synced with Telegram. "
|
||||
"You can disable syncing or delete your stored contacts "
|
||||
"in Settings > Privacy & Security.";
|
||||
inline Utf8String AboutFrequent() {
|
||||
return "This rating shows which people "
|
||||
"you are likelier to message frequently. "
|
||||
"Telegram uses this data to populate the 'People' box at the top "
|
||||
"of the Search section. The rating is also calculated "
|
||||
"for inline bots so that the app can suggest you "
|
||||
"the bots you are most likely to use in the attachment menu "
|
||||
"(or when you start a new message with \"@\").\n\n"
|
||||
"To delete this data, go to Settings > Privacy & Security and "
|
||||
"disable 'Suggest Frequent Contacts' "
|
||||
"(requires Telegram for iOS v.4.8.3 "
|
||||
"or Telegram for Android v.4.8.10 or higher). "
|
||||
"See this page for more information: "
|
||||
"https://telegram.org/faq/data-export";
|
||||
}
|
||||
|
||||
inline Utf8String AboutSessions() {
|
||||
@ -31,5 +47,22 @@ inline Utf8String AboutSessions() {
|
||||
"Terminating a session removes this data from Telegram servers.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutWebSessions() {
|
||||
return "We store this to display you the websites "
|
||||
"where you used Telegram to log in "
|
||||
"in Settings > Privacy & Security > Active Sessions. "
|
||||
"Disconnecting a website removes this data from Telegram servers.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutChats() {
|
||||
return "This page lists all chats from this export "
|
||||
"and where to look for their data.";
|
||||
}
|
||||
|
||||
inline Utf8String AboutLeftChats() {
|
||||
return "This page lists all supergroups and channels from this export "
|
||||
"that you've left and where to look for their data.";
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
} // namespace Export
|
||||
|
@ -257,21 +257,21 @@ QString ComputeDocumentName(
|
||||
const auto pattern = patterns.isEmpty() ? QString() : patterns.front();
|
||||
if (data.isVoiceMessage) {
|
||||
const auto isMP3 = hasMimeType(qstr("audio/mp3"));
|
||||
return qsl("Audio_")
|
||||
return qsl("audio_")
|
||||
+ QString::number(++context.audios)
|
||||
+ (isMP3 ? qsl(".mp3") : qsl(".ogg"));
|
||||
} else if (data.isVideoFile) {
|
||||
const auto extension = pattern.isEmpty()
|
||||
? qsl(".mov")
|
||||
: QString(pattern).replace('*', QString());
|
||||
return qsl("Video_")
|
||||
return qsl("video_")
|
||||
+ QString::number(++context.videos)
|
||||
+ extension;
|
||||
} else {
|
||||
const auto extension = pattern.isEmpty()
|
||||
? qsl(".unknown")
|
||||
: QString(pattern).replace('*', QString());
|
||||
return qsl("File_")
|
||||
return qsl("file_")
|
||||
+ QString::number(++context.files)
|
||||
+ extension;
|
||||
}
|
||||
@ -326,17 +326,17 @@ QString CleanDocumentName(QString name) {
|
||||
|
||||
QString DocumentFolder(const Document &data) {
|
||||
if (data.isVideoFile) {
|
||||
return "VideoFiles";
|
||||
return "video_files";
|
||||
} else if (data.isAnimated) {
|
||||
return "AnimatedGIFs";
|
||||
return "animations";
|
||||
} else if (data.isSticker) {
|
||||
return "Stickers";
|
||||
return "stickers";
|
||||
} else if (data.isVoiceMessage) {
|
||||
return "VoiceMessages";
|
||||
return "voice_messages";
|
||||
} else if (data.isVideoMessage) {
|
||||
return "RoundVideoMessages";
|
||||
return "round_video_messages";
|
||||
}
|
||||
return "Files";
|
||||
return "files";
|
||||
}
|
||||
|
||||
Document ParseDocument(
|
||||
@ -413,8 +413,8 @@ UserpicsSlice ParseUserpicsSlice(
|
||||
auto result = UserpicsSlice();
|
||||
result.list.reserve(list.size());
|
||||
for (const auto &photo : list) {
|
||||
const auto suggestedPath = "PersonalPhotos/"
|
||||
"Photo_" + QString::number(++baseIndex) + ".jpg";
|
||||
const auto suggestedPath = "profile_pictures/"
|
||||
"photo_" + QString::number(++baseIndex) + ".jpg";
|
||||
result.list.push_back(ParsePhoto(photo, suggestedPath));
|
||||
}
|
||||
return result;
|
||||
@ -645,8 +645,8 @@ Media ParseMedia(
|
||||
result.content = data.has_photo()
|
||||
? ParsePhoto(
|
||||
data.vphoto,
|
||||
folder + "Photos/"
|
||||
"Photo_" + QString::number(++context.photos) + ".jpg")
|
||||
folder + "photos/"
|
||||
"photo_" + QString::number(++context.photos) + ".jpg")
|
||||
: Photo();
|
||||
if (data.has_ttl_seconds()) {
|
||||
result.ttl = data.vttl_seconds.v;
|
||||
@ -700,8 +700,8 @@ ServiceAction ParseServiceAction(
|
||||
auto content = ActionChatEditPhoto();
|
||||
content.photo = ParsePhoto(
|
||||
data.vphoto,
|
||||
mediaFolder + "Photos/"
|
||||
"Photo_" + QString::number(++context.photos) + ".jpg");
|
||||
mediaFolder + "photos/"
|
||||
"photo_" + QString::number(++context.photos) + ".jpg");
|
||||
result.content = content;
|
||||
}, [&](const MTPDmessageActionChatDeletePhoto &data) {
|
||||
result.content = ActionChatDeletePhoto();
|
||||
@ -1190,7 +1190,7 @@ void FinalizeDialogsInfo(DialogsInfo &info, const Settings &settings) {
|
||||
auto index = 0;
|
||||
for (auto &dialog : list) {
|
||||
const auto number = Data::NumberToString(++index, digits, '0');
|
||||
dialog.relativePath = "Chats/chat_" + number + '/';
|
||||
dialog.relativePath = "chats/chat_" + number + '/';
|
||||
|
||||
using DialogType = DialogInfo::Type;
|
||||
using Type = Settings::Type;
|
||||
@ -1219,7 +1219,7 @@ void FinalizeLeftChannelsInfo(DialogsInfo &info, const Settings &settings) {
|
||||
auto index = 0;
|
||||
for (auto &dialog : list) {
|
||||
const auto number = Data::NumberToString(++index, digits, '0');
|
||||
dialog.relativePath = "Chats/left_" + number + '/';
|
||||
dialog.relativePath = "chats/left_" + number + '/';
|
||||
dialog.onlyMyMessages = true;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ Stats AbstractWriter::produceTestExample(const QString &path) {
|
||||
result.id = counter();
|
||||
result.image.width = 512;
|
||||
result.image.height = 512;
|
||||
result.image.file.relativePath = "Files/Photo_"
|
||||
result.image.file.relativePath = "files/photo_"
|
||||
+ QString::number(++index)
|
||||
+ ".jpg";
|
||||
return result;
|
||||
@ -439,7 +439,9 @@ Stats AbstractWriter::produceTestExample(const QString &path) {
|
||||
dialogBot.name = peerBot.name();
|
||||
dialogBot.onlyMyMessages = false;
|
||||
dialogBot.peerId = peerBot.id();
|
||||
dialogBot.relativePath = "Chats/C_" + QString::number(counter()) + '/';
|
||||
dialogBot.relativePath = "chats/chat_"
|
||||
+ QString::number(counter())
|
||||
+ '/';
|
||||
dialogBot.splits.push_back(0);
|
||||
dialogBot.splits.push_back(1);
|
||||
dialogBot.topMessageDate = sliceBot2.list.back().date;
|
||||
@ -451,7 +453,9 @@ Stats AbstractWriter::produceTestExample(const QString &path) {
|
||||
dialogChat.name = peerChat.name();
|
||||
dialogChat.onlyMyMessages = true;
|
||||
dialogChat.peerId = peerChat.id();
|
||||
dialogChat.relativePath = "Chats/C_" + QString::number(counter()) + '/';
|
||||
dialogChat.relativePath = "chats/chat_"
|
||||
+ QString::number(counter())
|
||||
+ '/';
|
||||
dialogChat.splits.push_back(0);
|
||||
dialogChat.splits.push_back(1);
|
||||
dialogChat.topMessageDate = sliceChat2.list.back().date;
|
||||
|
@ -256,8 +256,12 @@ QByteArray SerializeMessage(
|
||||
: SerializeString(name + ' ');
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return pre + "(file unavailable)";
|
||||
case SkipReason::FileSize: return pre + "(file too large)";
|
||||
case SkipReason::FileType: return pre + "(file skipped)";
|
||||
case SkipReason::FileSize:
|
||||
return pre + "(" + label + " exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return pre + "(" + label + " not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return SerializeLink(
|
||||
FormatFilePath(file),
|
||||
relativePath(file.relativePath));
|
||||
@ -307,10 +311,10 @@ QByteArray SerializeMessage(
|
||||
push("Title", data.title);
|
||||
}, [&](const ActionChatMigrateTo &data) {
|
||||
pushActor();
|
||||
pushAction("Migrate this group to supergroup");
|
||||
pushAction("Convert this group to supergroup");
|
||||
}, [&](const ActionChannelMigrateFrom &data) {
|
||||
pushActor();
|
||||
pushAction("Migrate this supergroup from group");
|
||||
pushAction("Basic group converted to supergroup");
|
||||
push("Title", data.title);
|
||||
}, [&](const ActionPinMessage &data) {
|
||||
pushActor();
|
||||
@ -669,8 +673,6 @@ Result HtmlWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
{ "Bio", SerializeString(data.bio) },
|
||||
})
|
||||
+ kLineBreak
|
||||
+ SerializeString(Data::AboutPersonalInfo())
|
||||
+ kLineBreak
|
||||
+ kLineBreak;
|
||||
return _summary->writeBlock(serialized);
|
||||
}
|
||||
@ -683,11 +685,11 @@ Result HtmlWriter::writeUserpicsStart(const Data::UserpicsInfo &data) {
|
||||
if (!_userpicsCount) {
|
||||
return Result::Success();
|
||||
}
|
||||
const auto filename = "personal_photos.html";
|
||||
const auto filename = "profile_pictures.html";
|
||||
_userpics = fileWithRelativePath(filename);
|
||||
|
||||
const auto serialized = SerializeLink(
|
||||
"Personal photos "
|
||||
"Profile pictures "
|
||||
"(" + Data::NumberToString(_userpicsCount) + ")",
|
||||
_summary->relativePath(filename))
|
||||
+ kLineBreak
|
||||
@ -712,8 +714,12 @@ Result HtmlWriter::writeUserpicsSlice(const Data::UserpicsSlice &data) {
|
||||
const auto path = [&]() -> Data::Utf8String {
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return "(file unavailable)";
|
||||
case SkipReason::FileSize: return "(file too large)";
|
||||
case SkipReason::FileType: return "(file skipped)";
|
||||
case SkipReason::FileSize:
|
||||
return "(Photo exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return "(Photo not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return SerializeLink(
|
||||
FormatFilePath(file),
|
||||
_userpics->relativePath(file.relativePath));
|
||||
@ -775,7 +781,7 @@ Result HtmlWriter::writeSavedContacts(const Data::ContactsList &data) {
|
||||
Data::FormatPhoneNumber(contact.phoneNumber))
|
||||
},
|
||||
{
|
||||
"Date",
|
||||
"Added",
|
||||
SerializeString(Data::FormatDateTime(contact.date))
|
||||
}
|
||||
}));
|
||||
@ -867,10 +873,13 @@ Result HtmlWriter::writeFrequentContacts(const Data::ContactsList &data) {
|
||||
}));
|
||||
}
|
||||
};
|
||||
writeList(data.correspondents, "Correspondents");
|
||||
writeList(data.correspondents, "People");
|
||||
writeList(data.inlineBots, "Inline bots");
|
||||
writeList(data.phoneCalls, "Calls");
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = SerializeString(Data::AboutFrequent())
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
} else if (const auto closed = file->close(); !closed) {
|
||||
@ -991,7 +1000,10 @@ Result HtmlWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
},
|
||||
}));
|
||||
}
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = SerializeString(Data::AboutWebSessions())
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
} else if (const auto closed = file->close(); !closed) {
|
||||
@ -1008,7 +1020,11 @@ Result HtmlWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
}
|
||||
|
||||
Result HtmlWriter::writeDialogsStart(const Data::DialogsInfo &data) {
|
||||
return writeChatsStart(data, "Chats", "chats.html");
|
||||
return writeChatsStart(
|
||||
data,
|
||||
"Chats",
|
||||
Data::AboutChats(),
|
||||
"chats.html");
|
||||
}
|
||||
|
||||
Result HtmlWriter::writeDialogStart(const Data::DialogInfo &data) {
|
||||
@ -1028,7 +1044,11 @@ Result HtmlWriter::writeDialogsEnd() {
|
||||
}
|
||||
|
||||
Result HtmlWriter::writeLeftChannelsStart(const Data::DialogsInfo &data) {
|
||||
return writeChatsStart(data, "Left chats", "left_chats.html");
|
||||
return writeChatsStart(
|
||||
data,
|
||||
"Left chats",
|
||||
Data::AboutLeftChats(),
|
||||
"left_chats.html");
|
||||
}
|
||||
|
||||
Result HtmlWriter::writeLeftChannelStart(const Data::DialogInfo &data) {
|
||||
@ -1050,6 +1070,7 @@ Result HtmlWriter::writeLeftChannelsEnd() {
|
||||
Result HtmlWriter::writeChatsStart(
|
||||
const Data::DialogsInfo &data,
|
||||
const QByteArray &listName,
|
||||
const QByteArray &about,
|
||||
const QString &fileName) {
|
||||
Expects(_summary != nullptr);
|
||||
Expects(_chats == nullptr);
|
||||
@ -1062,6 +1083,11 @@ Result HtmlWriter::writeChatsStart(
|
||||
_dialogIndex = 0;
|
||||
_dialogsCount = data.list.size();
|
||||
|
||||
const auto block = SerializeString(about) + kLineBreak;
|
||||
if (const auto result = _chats->writeBlock(block); !result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const auto header = SerializeLink(
|
||||
listName + " "
|
||||
"(" + Data::NumberToString(data.list.size()) + ")",
|
||||
@ -1097,9 +1123,7 @@ Result HtmlWriter::writeChatSlice(const Data::MessagesSlice &data) {
|
||||
data.peers,
|
||||
_settings.internalLinksDomain));
|
||||
}
|
||||
const auto full = _chat->empty()
|
||||
? JoinList(kLineBreak, list)
|
||||
: kLineBreak + JoinList(kLineBreak, list);
|
||||
const auto full = kLineBreak + JoinList(kLineBreak, list);
|
||||
return _chat->writeBlock(full);
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ private:
|
||||
Result writeChatsStart(
|
||||
const Data::DialogsInfo &data,
|
||||
const QByteArray &listName,
|
||||
const QByteArray &about,
|
||||
const QString &fileName);
|
||||
Result writeChatStart(const Data::DialogInfo &data);
|
||||
Result writeChatSlice(const Data::MessagesSlice &data);
|
||||
|
@ -327,8 +327,12 @@ QByteArray SerializeMessage(
|
||||
const auto pre = name.isEmpty() ? QByteArray() : name + ' ';
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return pre + "(file unavailable)";
|
||||
case SkipReason::FileSize: return pre + "(file too large)";
|
||||
case SkipReason::FileType: return pre + "(file skipped)";
|
||||
case SkipReason::FileSize:
|
||||
return pre + "(File exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return pre + "(File not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return FormatFilePath(file);
|
||||
}
|
||||
Unexpected("Skip reason while writing file path.");
|
||||
@ -616,7 +620,6 @@ Result JsonWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
return _output->writeBlock(
|
||||
prepareObjectItemStart("personal_information")
|
||||
+ SerializeObject(_context, {
|
||||
{ "about", SerializeString(Data::AboutPersonalInfo()) },
|
||||
{ "first_name", SerializeString(info.firstName) },
|
||||
{ "last_name", SerializeString(info.lastName) },
|
||||
{
|
||||
@ -641,7 +644,7 @@ Result JsonWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
Result JsonWriter::writeUserpicsStart(const Data::UserpicsInfo &data) {
|
||||
Expects(_output != nullptr);
|
||||
|
||||
auto block = prepareObjectItemStart("personal_photos");
|
||||
auto block = prepareObjectItemStart("profile_pictures");
|
||||
return _output->writeBlock(block + pushNesting(Context::kArray));
|
||||
}
|
||||
|
||||
@ -651,6 +654,23 @@ Result JsonWriter::writeUserpicsSlice(const Data::UserpicsSlice &data) {
|
||||
|
||||
auto block = QByteArray();
|
||||
for (const auto &userpic : data.list) {
|
||||
using SkipReason = Data::File::SkipReason;
|
||||
const auto &file = userpic.image.file;
|
||||
Assert(!file.relativePath.isEmpty()
|
||||
|| file.skipReason != SkipReason::None);
|
||||
const auto path = [&]() -> Data::Utf8String {
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return "(file unavailable)";
|
||||
case SkipReason::FileSize:
|
||||
return "(Photo exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return "(Photo not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return FormatFilePath(file);
|
||||
}
|
||||
Unexpected("Skip reason while writing photo path.");
|
||||
}();
|
||||
block.append(prepareArrayItemStart());
|
||||
block.append(SerializeObject(_context, {
|
||||
{
|
||||
@ -659,9 +679,7 @@ Result JsonWriter::writeUserpicsSlice(const Data::UserpicsSlice &data) {
|
||||
},
|
||||
{
|
||||
"photo",
|
||||
SerializeString(userpic.image.file.relativePath.isEmpty()
|
||||
? QByteArray("(file unavailable)")
|
||||
: FormatFilePath(userpic.image.file))
|
||||
SerializeString(path)
|
||||
},
|
||||
}));
|
||||
}
|
||||
@ -725,6 +743,10 @@ Result JsonWriter::writeFrequentContacts(const Data::ContactsList &data) {
|
||||
Expects(_output != nullptr);
|
||||
|
||||
auto block = prepareObjectItemStart("frequent_contacts");
|
||||
block.append(pushNesting(Context::kObject));
|
||||
block.append(prepareObjectItemStart("about"));
|
||||
block.append(SerializeString(Data::AboutFrequent()));
|
||||
block.append(prepareObjectItemStart("list"));
|
||||
block.append(pushNesting(Context::kArray));
|
||||
const auto writeList = [&](
|
||||
const std::vector<Data::TopPeer> &peers,
|
||||
@ -753,9 +775,10 @@ Result JsonWriter::writeFrequentContacts(const Data::ContactsList &data) {
|
||||
}));
|
||||
}
|
||||
};
|
||||
writeList(data.correspondents, "correspondents");
|
||||
writeList(data.correspondents, "people");
|
||||
writeList(data.inlineBots, "inline_bots");
|
||||
writeList(data.phoneCalls, "calls");
|
||||
block.append(popNesting());
|
||||
return _output->writeBlock(block + popNesting());
|
||||
}
|
||||
|
||||
@ -808,6 +831,10 @@ Result JsonWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
Expects(_output != nullptr);
|
||||
|
||||
auto block = prepareObjectItemStart("web_sessions");
|
||||
block.append(pushNesting(Context::kObject));
|
||||
block.append(prepareObjectItemStart("about"));
|
||||
block.append(SerializeString(Data::AboutWebSessions()));
|
||||
block.append(prepareObjectItemStart("list"));
|
||||
block.append(pushNesting(Context::kArray));
|
||||
for (const auto &session : data.webList) {
|
||||
block.append(prepareArrayItemStart());
|
||||
@ -822,6 +849,7 @@ Result JsonWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
{ "created", SerializeDate(session.created) },
|
||||
}));
|
||||
}
|
||||
block.append(popNesting());
|
||||
return _output->writeBlock(block + popNesting());
|
||||
}
|
||||
|
||||
|
@ -199,8 +199,12 @@ QByteArray SerializeMessage(
|
||||
const auto pre = name.isEmpty() ? QByteArray() : name + ' ';
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return pre + "(file unavailable)";
|
||||
case SkipReason::FileSize: return pre + "(file too large)";
|
||||
case SkipReason::FileType: return pre + "(file skipped)";
|
||||
case SkipReason::FileSize:
|
||||
return pre + "(" + label + " exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return pre + "(" + label + " not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return FormatFilePath(file);
|
||||
}
|
||||
Unexpected("Skip reason while writing file path.");
|
||||
@ -248,10 +252,10 @@ QByteArray SerializeMessage(
|
||||
push("Title", data.title);
|
||||
}, [&](const ActionChatMigrateTo &data) {
|
||||
pushActor();
|
||||
pushAction("Migrate this group to supergroup");
|
||||
pushAction("Convert this group to supergroup");
|
||||
}, [&](const ActionChannelMigrateFrom &data) {
|
||||
pushActor();
|
||||
pushAction("Migrate this supergroup from group");
|
||||
pushAction("Basic group converted to supergroup");
|
||||
push("Title", data.title);
|
||||
}, [&](const ActionPinMessage &data) {
|
||||
pushActor();
|
||||
@ -459,8 +463,6 @@ Result TextWriter::writePersonal(const Data::PersonalInfo &data) {
|
||||
{ "Bio", data.bio },
|
||||
})
|
||||
+ kLineBreak
|
||||
+ Data::AboutPersonalInfo()
|
||||
+ kLineBreak
|
||||
+ kLineBreak;
|
||||
return _summary->writeBlock(serialized);
|
||||
}
|
||||
@ -473,10 +475,10 @@ Result TextWriter::writeUserpicsStart(const Data::UserpicsInfo &data) {
|
||||
if (!_userpicsCount) {
|
||||
return Result::Success();
|
||||
}
|
||||
const auto filename = "personal_photos.txt";
|
||||
const auto filename = "profile_pictures.txt";
|
||||
_userpics = fileWithRelativePath(filename);
|
||||
|
||||
const auto serialized = "Personal photos "
|
||||
const auto serialized = "Profile pictures"
|
||||
"(" + Data::NumberToString(_userpicsCount) + ") - " + filename
|
||||
+ kLineBreak
|
||||
+ kLineBreak;
|
||||
@ -493,14 +495,26 @@ Result TextWriter::writeUserpicsSlice(const Data::UserpicsSlice &data) {
|
||||
if (!userpic.date) {
|
||||
lines.push_back("(deleted photo)");
|
||||
} else {
|
||||
using SkipReason = Data::File::SkipReason;
|
||||
const auto &file = userpic.image.file;
|
||||
Assert(!file.relativePath.isEmpty()
|
||||
|| file.skipReason != SkipReason::None);
|
||||
const auto path = [&]() -> Data::Utf8String {
|
||||
switch (file.skipReason) {
|
||||
case SkipReason::Unavailable: return "(file unavailable)";
|
||||
case SkipReason::FileSize:
|
||||
return "(Photo exceeds maximum size. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::FileType:
|
||||
return "(Photo not included. "
|
||||
"Change data exporting settings to download.)";
|
||||
case SkipReason::None: return FormatFilePath(file);
|
||||
}
|
||||
Unexpected("Skip reason while writing photo path.");
|
||||
}();
|
||||
lines.push_back(SerializeKeyValue({
|
||||
{ "Date", Data::FormatDateTime(userpic.date) },
|
||||
{
|
||||
"Photo",
|
||||
(userpic.image.file.relativePath.isEmpty()
|
||||
? QByteArray("(file unavailable)")
|
||||
: FormatFilePath(userpic.image.file))
|
||||
},
|
||||
{ "Photo", path },
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -624,10 +638,13 @@ Result TextWriter::writeFrequentContacts(const Data::ContactsList &data) {
|
||||
}));
|
||||
}
|
||||
};
|
||||
writeList(data.correspondents, "Correspondents");
|
||||
writeList(data.correspondents, "People");
|
||||
writeList(data.inlineBots, "Inline bots");
|
||||
writeList(data.phoneCalls, "Calls");
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = Data::AboutFrequent()
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
}
|
||||
@ -726,7 +743,10 @@ Result TextWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
{ "Created", Data::FormatDateTime(session.created) },
|
||||
}));
|
||||
}
|
||||
const auto full = JoinList(kLineBreak, list);
|
||||
const auto full = Data::AboutWebSessions()
|
||||
+ kLineBreak
|
||||
+ kLineBreak
|
||||
+ JoinList(kLineBreak, list);
|
||||
if (const auto result = file->writeBlock(full); !result) {
|
||||
return result;
|
||||
}
|
||||
@ -740,7 +760,11 @@ Result TextWriter::writeWebSessions(const Data::SessionsList &data) {
|
||||
}
|
||||
|
||||
Result TextWriter::writeDialogsStart(const Data::DialogsInfo &data) {
|
||||
return writeChatsStart(data, "Chats", "chats.txt");
|
||||
return writeChatsStart(
|
||||
data,
|
||||
"Chats",
|
||||
Data::AboutChats(),
|
||||
"chats.html");
|
||||
}
|
||||
|
||||
Result TextWriter::writeDialogStart(const Data::DialogInfo &data) {
|
||||
@ -760,7 +784,11 @@ Result TextWriter::writeDialogsEnd() {
|
||||
}
|
||||
|
||||
Result TextWriter::writeLeftChannelsStart(const Data::DialogsInfo &data) {
|
||||
return writeChatsStart(data, "Left chats", "left_chats.txt");
|
||||
return writeChatsStart(
|
||||
data,
|
||||
"Left chats",
|
||||
Data::AboutLeftChats(),
|
||||
"left_chats.html");
|
||||
}
|
||||
|
||||
Result TextWriter::writeLeftChannelStart(const Data::DialogInfo &data) {
|
||||
@ -782,6 +810,7 @@ Result TextWriter::writeLeftChannelsEnd() {
|
||||
Result TextWriter::writeChatsStart(
|
||||
const Data::DialogsInfo &data,
|
||||
const QByteArray &listName,
|
||||
const QByteArray &about,
|
||||
const QString &fileName) {
|
||||
Expects(_summary != nullptr);
|
||||
Expects(_chats == nullptr);
|
||||
@ -794,6 +823,11 @@ Result TextWriter::writeChatsStart(
|
||||
_dialogIndex = 0;
|
||||
_dialogsCount = data.list.size();
|
||||
|
||||
const auto block = about + kLineBreak;
|
||||
if (const auto result = _chats->writeBlock(block); !result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const auto header = listName + " "
|
||||
"(" + Data::NumberToString(data.list.size()) + ") - "
|
||||
+ fileName.toUtf8()
|
||||
@ -827,9 +861,7 @@ Result TextWriter::writeChatSlice(const Data::MessagesSlice &data) {
|
||||
data.peers,
|
||||
_settings.internalLinksDomain));
|
||||
}
|
||||
const auto full = _chat->empty()
|
||||
? JoinList(kLineBreak, list)
|
||||
: kLineBreak + JoinList(kLineBreak, list);
|
||||
const auto full = kLineBreak + JoinList(kLineBreak, list);
|
||||
return _chat->writeBlock(full);
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
Result writeChatsStart(
|
||||
const Data::DialogsInfo &data,
|
||||
const QByteArray &listName,
|
||||
const QByteArray &about,
|
||||
const QString &fileName);
|
||||
Result writeChatStart(const Data::DialogInfo &data);
|
||||
Result writeChatSlice(const Data::MessagesSlice &data);
|
||||
|
Loading…
Reference in New Issue
Block a user