diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 8fbec712..10a5e690 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -48,6 +48,7 @@ #include "td/utils/base64.h" #include "td/utils/buffer.h" +#include "td/utils/port/Clocks.h" #include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/misc.h" @@ -2754,7 +2755,8 @@ class GetBroadcastStatsQuery : public Td::ResultHandler { flags |= telegram_api::stats_getBroadcastStats::DARK_MASK; } send_query(G()->net_query_creator().create( - telegram_api::stats_getBroadcastStats(flags, false /*ignored*/, std::move(input_channel), 0), dc_id)); + telegram_api::stats_getBroadcastStats(flags, false /*ignored*/, std::move(input_channel), Clocks::tz_offset()), + dc_id)); } void on_result(uint64 id, BufferSlice packet) override { diff --git a/td/telegram/net/MtprotoHeader.cpp b/td/telegram/net/MtprotoHeader.cpp index bd90bc4a..5924fec1 100644 --- a/td/telegram/net/MtprotoHeader.cpp +++ b/td/telegram/net/MtprotoHeader.cpp @@ -8,10 +8,12 @@ #include "td/telegram/JsonValue.h" #include "td/telegram/LanguagePackManager.h" +#include "td/telegram/telegram_api.h" #include "td/telegram/Version.h" #include "td/tl/tl_object_store.h" +#include "td/utils/port/Clocks.h" #include "td/utils/tl_helpers.h" namespace td { @@ -37,7 +39,7 @@ class HeaderStorer { if (have_proxy) { flags |= 1 << 0; } - if (!options.parameters.empty()) { + if (!is_anonymous) { flags |= 1 << 1; } if (options.is_emulator) { @@ -72,10 +74,29 @@ class HeaderStorer { store(Slice(options.proxy.server()), storer); store(options.proxy.port(), storer); } - if (!options.parameters.empty()) { - auto parameters_copy = options.parameters; - auto json_value = get_input_json_value(parameters_copy).move_as_ok(); + if (!is_anonymous) { + telegram_api::object_ptr json_value; + if (options.parameters.empty()) { + json_value = make_tl_object(vector>()); + } else { + auto parameters_copy = options.parameters; + json_value = get_input_json_value(parameters_copy).move_as_ok(); + } CHECK(json_value != nullptr); + if (json_value->get_id() == telegram_api::jsonObject::ID) { + auto &values = static_cast(json_value.get())->value_; + bool has_tz_offset = false; + for (auto &value : values) { + if (value->key_ == "tz_offset") { + has_tz_offset = true; + break; + } + } + if (!has_tz_offset) { + values.push_back(make_tl_object( + "tz_offset", make_tl_object(Clocks::tz_offset()))); + } + } TlStoreBoxedUnknown::store(json_value, storer); } }