mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Send chosen venues.
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user