implements settings, conversation dbus encoding
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::fmt::Display;
|
||||
use time::OffsetDateTime;
|
||||
use pretty::RcDoc;
|
||||
use dbus::arg::{self, RefArg};
|
||||
|
||||
pub struct PrintableConversation {
|
||||
pub guid: String,
|
||||
@@ -37,6 +38,25 @@ impl From<kordophone_db::models::Conversation> for PrintableConversation {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<arg::PropMap> for PrintableConversation {
|
||||
fn from(value: arg::PropMap) -> Self {
|
||||
Self {
|
||||
guid: value.get("guid").unwrap().as_str().unwrap().to_string(),
|
||||
date: OffsetDateTime::from_unix_timestamp(value.get("date").unwrap().as_i64().unwrap()).unwrap(),
|
||||
unread_count: value.get("unread_count").unwrap().as_i64().unwrap().try_into().unwrap(),
|
||||
last_message_preview: value.get("last_message_preview").unwrap().as_str().map(|s| s.to_string()),
|
||||
participants: value.get("participants")
|
||||
.unwrap()
|
||||
.0
|
||||
.as_iter()
|
||||
.unwrap()
|
||||
.map(|s| s.as_str().unwrap().to_string())
|
||||
.collect(),
|
||||
display_name: value.get("display_name").unwrap().as_str().map(|s| s.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PrintableMessage {
|
||||
pub guid: String,
|
||||
pub date: OffsetDateTime,
|
||||
|
||||
Reference in New Issue
Block a user