@@ -29,8 +29,8 @@ void UserProfile::set_name(std::string_view new_name) {
2929 throw std::invalid_argument{" Invalid profile name: exceeds maximum length" };
3030 set_nonempty_str (data[" n" ], new_name);
3131
32- // const auto target_timestamp = (data["t"].integer_or(0) >= data["T"].integer_or(0) ? "t" :
33- // "T"); data[target_timestamp] = ts_now();
32+ const auto target_timestamp = (data[" t" ].integer_or (0 ) >= data[" T" ].integer_or (0 ) ? " t" : " T " );
33+ data[target_timestamp] = ts_now ();
3434}
3535void UserProfile::set_name_truncated (std::string new_name) {
3636 set_name (utf8_truncate (std::move (new_name), contact_info::MAX_NAME_LENGTH));
@@ -59,7 +59,7 @@ void UserProfile::set_profile_pic(std::string_view url, std::span<const unsigned
5959 if (url.empty () || key.size () != 32 )
6060 set_reupload_profile_pic ({});
6161
62- // data["t"] = ts_now();
62+ data[" t" ] = ts_now ();
6363}
6464
6565void UserProfile::set_profile_pic (profile_pic pic) {
@@ -69,7 +69,7 @@ void UserProfile::set_profile_pic(profile_pic pic) {
6969void UserProfile::set_reupload_profile_pic (
7070 std::string_view url, std::span<const unsigned char > key) {
7171 set_pair_if (!url.empty () && key.size () == 32 , data[" P" ], url, data[" Q" ], key);
72- // data["T"] = ts_now();
72+ data[" T" ] = ts_now ();
7373}
7474
7575void UserProfile::set_reupload_profile_pic (profile_pic pic) {
@@ -100,8 +100,8 @@ void UserProfile::set_blinded_msgreqs(std::optional<bool> value) {
100100 else
101101 data[" M" ] = static_cast <int >(*value);
102102
103- // const auto target_timestamp = (data["t"].integer_or(0) >= data["T"].integer_or(0) ? "t" :
104- // "T"); data[target_timestamp] = ts_now();
103+ const auto target_timestamp = (data[" t" ].integer_or (0 ) >= data[" T" ].integer_or (0 ) ? " t" : " T " );
104+ data[target_timestamp] = ts_now ();
105105}
106106
107107std::optional<bool > UserProfile::get_blinded_msgreqs () const {
@@ -111,11 +111,11 @@ std::optional<bool> UserProfile::get_blinded_msgreqs() const {
111111}
112112
113113std::chrono::sys_seconds UserProfile::get_profile_updated () const {
114- // if (auto t = data["t"].sys_seconds()) {
115- // if (auto T = data["T"].sys_seconds(); T && *T > *t)
116- // return *T;
117- // return *t;
118- // }
114+ if (auto t = data[" t" ].sys_seconds ()) {
115+ if (auto T = data[" T" ].sys_seconds (); T && *T > *t)
116+ return *T;
117+ return *t;
118+ }
119119 return std::chrono::sys_seconds{};
120120}
121121
0 commit comments