Remove MessagesManager dependency on sstream.
GitOrigin-RevId: dd20f03bdef240f92ce01a485f3555553e93f113
This commit is contained in:
parent
412c93b0f1
commit
d409d44d7f
@ -74,7 +74,6 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -4484,14 +4483,16 @@ MessagesManager::MessagesManager(Td *td, ActorShared<> parent) : td_(td), parent
|
|||||||
if (G()->parameters().use_message_db) {
|
if (G()->parameters().use_message_db) {
|
||||||
auto last_database_server_dialog_date_string = G()->td_db()->get_binlog_pmc()->get("last_server_dialog_date");
|
auto last_database_server_dialog_date_string = G()->td_db()->get_binlog_pmc()->get("last_server_dialog_date");
|
||||||
if (!last_database_server_dialog_date_string.empty()) {
|
if (!last_database_server_dialog_date_string.empty()) {
|
||||||
int64 order;
|
string order_str;
|
||||||
int64 dialog_id;
|
string dialog_id_str;
|
||||||
std::stringstream ss(last_database_server_dialog_date_string);
|
std::tie(order_str, dialog_id_str) = split(last_database_server_dialog_date_string);
|
||||||
ss >> order >> dialog_id;
|
|
||||||
if (ss.fail()) {
|
auto r_order = to_integer_safe<int64>(order_str);
|
||||||
|
auto r_dialog_id = to_integer_safe<int64>(dialog_id_str);
|
||||||
|
if (r_order.is_error() || r_dialog_id.is_error()) {
|
||||||
LOG(ERROR) << "Can't parse " << last_database_server_dialog_date_string;
|
LOG(ERROR) << "Can't parse " << last_database_server_dialog_date_string;
|
||||||
} else {
|
} else {
|
||||||
last_database_server_dialog_date_ = DialogDate(order, DialogId(dialog_id));
|
last_database_server_dialog_date_ = DialogDate(r_order.ok(), DialogId(r_dialog_id.ok()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Load last_database_server_dialog_date_ = " << last_database_server_dialog_date_;
|
LOG(INFO) << "Load last_database_server_dialog_date_ = " << last_database_server_dialog_date_;
|
||||||
@ -22900,9 +22901,8 @@ void MessagesManager::update_last_dialog_date() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (G()->parameters().use_message_db && last_database_server_dialog_date_ < last_server_dialog_date_) {
|
if (G()->parameters().use_message_db && last_database_server_dialog_date_ < last_server_dialog_date_) {
|
||||||
std::stringstream ss;
|
auto last_server_dialog_date_string = to_string(last_server_dialog_date_.get_order()) + " " +
|
||||||
ss << last_server_dialog_date_.get_order() << " " << last_server_dialog_date_.get_dialog_id().get();
|
to_string(last_server_dialog_date_.get_dialog_id().get());
|
||||||
auto last_server_dialog_date_string = ss.str();
|
|
||||||
G()->td_db()->get_binlog_pmc()->set("last_server_dialog_date", last_server_dialog_date_string);
|
G()->td_db()->get_binlog_pmc()->set("last_server_dialog_date", last_server_dialog_date_string);
|
||||||
LOG(INFO) << "Save last server dialog date " << last_server_dialog_date_string;
|
LOG(INFO) << "Save last server dialog date " << last_server_dialog_date_string;
|
||||||
last_database_server_dialog_date_ = last_server_dialog_date_;
|
last_database_server_dialog_date_ = last_server_dialog_date_;
|
||||||
|
Reference in New Issue
Block a user