diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 7cc2add..37551c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; -use chrono::Local; +use chrono::{Local, Utc}; use iced::alignment::Horizontal::Right; use iced::futures::{SinkExt, Stream, StreamExt}; use iced::keyboard::{on_key_press, on_key_release, Key, Modifiers}; @@ -28,7 +28,7 @@ use keyring::Entry; use login_modal::{Creds, LoginModal}; use luz::chat::{Chat, Message as ChatMessage}; use luz::error::CommandError; -use luz::presence::{Offline, Presence}; +use luz::presence::{Offline, Presence, PresenceType}; use luz::CommandMessage; use luz::{roster::Contact, user::User, LuzHandle, UpdateMessage}; use message_view::MessageView; @@ -325,7 +325,10 @@ async fn main() -> iced::Result { // TODO: jid, // TODO: store cached status - status: Presence::Offline(Offline::default()), + status: Presence { + timestamp: Utc::now(), + presence: PresenceType::Offline(Offline::default()), + }, connection_state: ConnectionState::Offline, }), cfg, @@ -440,7 +443,10 @@ impl Macaw { } UpdateMessage::Online(online, vec) => match &mut self.client { Account::LoggedIn(client) => { - client.status = Presence::Online(online); + client.status = Presence { + timestamp: Utc::now(), + presence: PresenceType::Online(online), + }; client.connection_state = ConnectionState::Online; let mut roster = HashMap::new(); for contact in vec { @@ -455,7 +461,10 @@ impl Macaw { // TODO: update all contacts' presences to unknown (offline) match &mut self.client { Account::LoggedIn(client) => { - client.status = Presence::Offline(offline); + client.status = Presence { + timestamp: Utc::now(), + presence: PresenceType::Offline(offline), + }; client.connection_state = ConnectionState::Offline; Task::none() } @@ -649,9 +658,7 @@ impl Macaw { Client { client: handle, jid, - status: Presence::Offline( - Offline::default(), - ), + status: Presence { timestamp: Utc::now(), presence: PresenceType::Offline(Offline::default()) }, connection_state: ConnectionState::Offline, }, ))); |