@@ -97,7 +97,7 @@ void contact_info::load(const dict& info_dict) {
9797 } else {
9898 notifications = notify_mode::defaulted;
9999 }
100- mute_until = maybe_int (info_dict, " !" ).value_or (0 );
100+ mute_until = to_epoch_seconds ( maybe_int (info_dict, " !" ).value_or (0 ) );
101101
102102 int exp_mode_ = maybe_int (info_dict, " e" ).value_or (0 );
103103 if (exp_mode_ >= static_cast <int >(expiration_mode::none) &&
@@ -118,7 +118,7 @@ void contact_info::load(const dict& info_dict) {
118118 }
119119 }
120120
121- created = maybe_int (info_dict, " j" ).value_or (0 );
121+ created = to_epoch_seconds ( maybe_int (info_dict, " j" ).value_or (0 ) );
122122}
123123
124124void contact_info::into (contacts_contact& c) const {
@@ -136,12 +136,12 @@ void contact_info::into(contacts_contact& c) const {
136136 c.blocked = blocked;
137137 c.priority = priority;
138138 c.notifications = static_cast <CONVO_NOTIFY_MODE>(notifications);
139- c.mute_until = mute_until;
139+ c.mute_until = to_epoch_seconds ( mute_until) ;
140140 c.exp_mode = static_cast <CONVO_EXPIRATION_MODE>(exp_mode);
141141 c.exp_seconds = exp_timer.count ();
142142 if (c.exp_seconds <= 0 && c.exp_mode != CONVO_EXPIRATION_NONE)
143143 c.exp_mode = CONVO_EXPIRATION_NONE;
144- c.created = created;
144+ c.created = to_epoch_seconds ( created) ;
145145}
146146
147147contact_info::contact_info (const contacts_contact& c) : session_id{c.session_id , 66 } {
@@ -159,12 +159,12 @@ contact_info::contact_info(const contacts_contact& c) : session_id{c.session_id,
159159 blocked = c.blocked ;
160160 priority = c.priority ;
161161 notifications = static_cast <notify_mode>(c.notifications );
162- mute_until = c.mute_until ;
162+ mute_until = to_epoch_seconds ( c.mute_until ) ;
163163 exp_mode = static_cast <expiration_mode>(c.exp_mode );
164164 exp_timer = exp_mode == expiration_mode::none ? 0s : std::chrono::seconds{c.exp_seconds };
165165 if (exp_timer <= 0s && exp_mode != expiration_mode::none)
166166 exp_mode = expiration_mode::none;
167- created = c.created ;
167+ created = to_epoch_seconds ( c.created ) ;
168168}
169169
170170std::optional<contact_info> Contacts::get (std::string_view pubkey_hex) const {
@@ -237,7 +237,7 @@ void Contacts::set(const contact_info& contact) {
237237 if (notify == notify_mode::mentions_only)
238238 notify = notify_mode::all;
239239 set_positive_int (info[" @" ], static_cast <int >(notify));
240- set_positive_int (info[" !" ], contact.mute_until );
240+ set_positive_int (info[" !" ], to_epoch_seconds ( contact.mute_until ) );
241241
242242 set_pair_if (
243243 contact.exp_mode != expiration_mode::none && contact.exp_timer > 0s,
@@ -246,7 +246,7 @@ void Contacts::set(const contact_info& contact) {
246246 info[" E" ],
247247 contact.exp_timer .count ());
248248
249- set_positive_int (info[" j" ], contact.created );
249+ set_positive_int (info[" j" ], to_epoch_seconds ( contact.created ) );
250250}
251251
252252LIBSESSION_C_API bool contacts_set (config_object* conf, const contacts_contact* contact) {
@@ -317,7 +317,7 @@ void Contacts::set_expiry(
317317
318318void Contacts::set_created (std::string_view session_id, int64_t timestamp) {
319319 auto c = get_or_construct (session_id);
320- c.created = timestamp;
320+ c.created = to_epoch_seconds ( timestamp) ;
321321 set (c);
322322}
323323
0 commit comments