diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 521a5410b..47f1485e2 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -822,8 +822,8 @@ messagePositions total_count:int32 positions:vector = MessagePo //@description Contains information about found messages sent in a specific day @total_count Total number of found messages sent in the day @message First message sent in the day messageCalendarDay total_count:int32 message:message = MessageCalendarDay; -//@description Contains information about found messages, splitted by days @total_count Total number of found messages @utc_time_offset UTC time offset in seconds, used to split messages by days @days Information about messages sent -messageCalendar total_count:int32 utc_time_offset:int32 days:vector = MessageCalendar; +//@description Contains information about found messages, splitted by days according to GetOption("utc_time_offset") @total_count Total number of found messages @days Information about messages sent +messageCalendar total_count:int32 days:vector = MessageCalendar; //@description Describes a sponsored message @id Unique sponsored message identifier @sponsor_chat_id Chat identifier diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 620c20bdf..83b91a4ce 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -67,7 +67,6 @@ #include "td/utils/format.h" #include "td/utils/misc.h" #include "td/utils/PathView.h" -#include "td/utils/port/Clocks.h" #include "td/utils/Random.h" #include "td/utils/Slice.h" #include "td/utils/SliceBuilder.h" @@ -9811,7 +9810,7 @@ void MessagesManager::on_get_message_search_result_calendar( days.push_back(td_api::make_object( period->count_, get_message_object(dialog_id, m, "on_get_message_search_result_calendar"))); } - it->second = td_api::make_object(total_count, Clocks::tz_offset(), std::move(days)); + it->second = td_api::make_object(total_count, std::move(days)); promise.set_value(Unit()); } @@ -21540,7 +21539,7 @@ td_api::object_ptr MessagesManager::get_dialog_message_ db_query.dialog_id = dialog_id; db_query.filter = filter; db_query.from_message_id = fixed_from_message_id; - db_query.tz_offset = Clocks::tz_offset(); + db_query.tz_offset = static_cast(G()->shared_config().get_option_integer("utc_time_offset")); G()->td_db()->get_messages_db_async()->get_dialog_message_calendar(db_query, std::move(new_promise)); return {}; } @@ -21619,7 +21618,7 @@ void MessagesManager::on_get_message_calendar_from_database(int64 random_id, Dia days.push_back(td_api::make_object( period.second, get_message_object(dialog_id, m, "on_get_message_calendar_from_database"))); } - it->second = td_api::make_object(total_count, Clocks::tz_offset(), std::move(days)); + it->second = td_api::make_object(total_count, std::move(days)); } promise.set_value(Unit()); } diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index b8163243b..f354b8cf2 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -130,6 +130,7 @@ #include "td/utils/MimeType.h" #include "td/utils/misc.h" #include "td/utils/PathView.h" +#include "td/utils/port/Clocks.h" #include "td/utils/port/IPAddress.h" #include "td/utils/port/path.h" #include "td/utils/port/SocketFd.h" @@ -3867,6 +3868,7 @@ Status Td::init(DbKey key) { options_.language_pack = G()->shared_config().get_option_string("localization_target"); options_.language_code = G()->shared_config().get_option_string("language_pack_id"); options_.parameters = G()->shared_config().get_option_string("connection_parameters"); + options_.tz_offset = static_cast(G()->shared_config().get_option_integer("utc_time_offset")); options_.is_emulator = G()->shared_config().get_option_boolean("is_emulator"); // options_.proxy = Proxy(); G()->set_mtproto_header(make_unique(options_)); @@ -4023,6 +4025,7 @@ void Td::init_options_and_network() { if (!G()->shared_config().have_option("suggested_video_note_audio_bitrate")) { G()->shared_config().set_option_integer("suggested_video_note_audio_bitrate", 64); } + G()->shared_config().set_option_integer("utc_time_offset", Clocks::tz_offset()); init_connection_creator(); @@ -4463,9 +4466,9 @@ Status Td::set_parameters(td_api::object_ptr parameters options_.application_version += ", TDLib "; options_.application_version += TDLIB_VERSION; } - options_.language_pack = ""; - options_.language_code = ""; - options_.parameters = ""; + options_.language_pack = string(); + options_.language_code = string(); + options_.parameters = string(); options_.is_emulator = false; options_.proxy = Proxy(); diff --git a/td/telegram/net/MtprotoHeader.cpp b/td/telegram/net/MtprotoHeader.cpp index 831b4468c..9c388a73e 100644 --- a/td/telegram/net/MtprotoHeader.cpp +++ b/td/telegram/net/MtprotoHeader.cpp @@ -13,7 +13,6 @@ #include "td/tl/tl_object_store.h" -#include "td/utils/port/Clocks.h" #include "td/utils/tl_helpers.h" namespace td { @@ -89,12 +88,12 @@ class HeaderStorer { for (auto &value : values) { if (value->key_ == "tz_offset") { has_tz_offset = true; - break; + value->value_ = make_tl_object(options.tz_offset); } } if (!has_tz_offset) { values.push_back(make_tl_object( - "tz_offset", make_tl_object(Clocks::tz_offset()))); + "tz_offset", make_tl_object(options.tz_offset))); } } TlStoreBoxedUnknown::store(json_value, storer); diff --git a/td/telegram/net/MtprotoHeader.h b/td/telegram/net/MtprotoHeader.h index b5b0754c3..77699697b 100644 --- a/td/telegram/net/MtprotoHeader.h +++ b/td/telegram/net/MtprotoHeader.h @@ -24,6 +24,7 @@ class MtprotoHeader { string language_pack; string language_code; string parameters; + int32 tz_offset = 0; bool is_emulator = false; Proxy proxy; };