2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Send chosen venues.

This commit is contained in:
John Preston
2024-07-12 12:23:47 +02:00
parent a130bb1be6
commit 8ce10d5503
6 changed files with 73 additions and 64 deletions

View File

@@ -144,28 +144,22 @@ std::vector<QString> AppConfig::getStringArray(
});
}
std::vector<std::map<QString, QString>> AppConfig::getStringMapArray(
base::flat_map<QString, QString> AppConfig::getStringMap(
const QString &key,
std::vector<std::map<QString, QString>> &&fallback) const {
base::flat_map<QString, QString> &&fallback) const {
return getValue(key, [&](const MTPJSONValue &value) {
return value.match([&](const MTPDjsonArray &data) {
auto result = std::vector<std::map<QString, QString>>();
return value.match([&](const MTPDjsonObject &data) {
auto result = base::flat_map<QString, QString>();
result.reserve(data.vvalue().v.size());
for (const auto &entry : data.vvalue().v) {
if (entry.type() != mtpc_jsonObject) {
const auto &data = entry.data();
const auto &value = data.vvalue();
if (value.type() != mtpc_jsonString) {
return std::move(fallback);
}
auto element = std::map<QString, QString>();
for (const auto &field : entry.c_jsonObject().vvalue().v) {
const auto &data = field.c_jsonObjectValue();
if (data.vvalue().type() != mtpc_jsonString) {
return std::move(fallback);
}
element.emplace(
qs(data.vkey()),
qs(data.vvalue().c_jsonString().vvalue()));
}
result.push_back(std::move(element));
result.emplace(
qs(data.vkey()),
qs(value.c_jsonString().vvalue()));
}
return result;
}, [&](const auto &data) {