aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock87
-rw-r--r--Cargo.toml2
-rw-r--r--ideas.md1
-rw-r--r--src/login_modal.rs5
-rw-r--r--src/main.rs59
-rw-r--r--src/message_view.rs2
6 files changed, 77 insertions, 79 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 0f11e5d..b11868d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1240,6 +1240,22 @@ dependencies = [
]
[[package]]
+name = "filamento"
+version = "0.1.0"
+dependencies = [
+ "chrono",
+ "futures",
+ "jid",
+ "lampada",
+ "sqlx",
+ "stanza",
+ "thiserror 2.0.11",
+ "tokio",
+ "tracing",
+ "uuid",
+]
+
+[[package]]
name = "flate2"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2101,30 +2117,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]]
-name = "jabber"
-version = "0.1.0"
-dependencies = [
- "async-recursion",
- "async-trait",
- "futures",
- "jid",
- "lazy_static",
- "nanoid",
- "peanuts",
- "pin-project",
- "pin-project-lite",
- "rsasl",
- "stanza",
- "take_mut",
- "thiserror 2.0.11",
- "tokio",
- "tokio-native-tls",
- "tracing",
- "trust-dns-resolver",
- "try_map",
-]
-
-[[package]]
name = "jid"
version = "0.1.0"
dependencies = [
@@ -2223,6 +2215,20 @@ dependencies = [
]
[[package]]
+name = "lampada"
+version = "0.1.0"
+dependencies = [
+ "futures",
+ "jid",
+ "luz",
+ "peanuts",
+ "stanza",
+ "thiserror 2.0.11",
+ "tokio",
+ "tracing",
+]
+
+[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2361,20 +2367,24 @@ dependencies = [
name = "luz"
version = "0.1.0"
dependencies = [
- "chrono",
+ "async-recursion",
+ "async-trait",
"futures",
- "jabber",
"jid",
+ "lazy_static",
+ "nanoid",
"peanuts",
- "sqlx",
+ "pin-project",
+ "pin-project-lite",
+ "rsasl",
"stanza",
+ "take_mut",
"thiserror 2.0.11",
"tokio",
- "tokio-stream",
- "tokio-util",
+ "tokio-native-tls",
"tracing",
- "tracing-subscriber",
- "uuid",
+ "trust-dns-resolver",
+ "try_map",
]
[[package]]
@@ -2385,11 +2395,11 @@ dependencies = [
"chrono-humanize",
"confy",
"dirs",
+ "filamento",
"iced",
"indexmap",
"jid",
"keyring",
- "luz",
"serde",
"thiserror 2.0.11",
"tokio",
@@ -4459,19 +4469,6 @@ dependencies = [
]
[[package]]
-name = "tokio-util"
-version = "0.7.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078"
-dependencies = [
- "bytes",
- "futures-core",
- "futures-sink",
- "pin-project-lite",
- "tokio",
-]
-
-[[package]]
name = "toml"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index b66da70..cb8f05d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2021"
[dependencies]
iced = { git = "https://github.com/iced-rs/iced", features = ["tokio"] }
-luz = { version = "0.1.0", path = "../luz/luz" }
+filamento = { version = "0.1.0", path = "../luz/filamento" }
jid = { version = "0.1.0", path = "../luz/jid" }
tokio = "1.43.0"
tokio-stream = "0.1.17"
diff --git a/ideas.md b/ideas.md
index 1b1772e..837a40e 100644
--- a/ideas.md
+++ b/ideas.md
@@ -12,6 +12,7 @@
- voice channels
- video streaming
- broadcast rooms
+- request message sync between devices (chat and global level) and with particular contacts (on a chat level)
- theme parts
- main application style (component styles) done through setting variables to do with components
- may include assets for borders, backgrounds, etc.
diff --git a/src/login_modal.rs b/src/login_modal.rs
index 5a63158..f61c204 100644
--- a/src/login_modal.rs
+++ b/src/login_modal.rs
@@ -1,3 +1,4 @@
+use filamento::presence::{Offline, Presence};
use iced::{
futures::StreamExt,
widget::{button, checkbox, column, container, text, text_input},
@@ -5,10 +6,6 @@ use iced::{
};
use jid::JID;
use keyring::Entry;
-use luz::{
- presence::{Offline, Presence},
- LuzHandle,
-};
use serde::{Deserialize, Serialize};
use tokio_stream::wrappers::ReceiverStream;
use tracing::info;
diff --git a/src/main.rs b/src/main.rs
index 37551c8..1a979c3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,6 +7,10 @@ use std::str::FromStr;
use std::sync::Arc;
use chrono::{Local, Utc};
+use filamento::chat::{Chat, Message as ChatMessage};
+use filamento::error::CommandError;
+use filamento::presence::{Offline, Presence, PresenceType};
+use filamento::{roster::Contact, user::User, UpdateMessage};
use iced::alignment::Horizontal::Right;
use iced::futures::{SinkExt, Stream, StreamExt};
use iced::keyboard::{on_key_press, on_key_release, Key, Modifiers};
@@ -26,11 +30,6 @@ use indexmap::{indexmap, IndexMap};
use jid::JID;
use keyring::Entry;
use login_modal::{Creds, LoginModal};
-use luz::chat::{Chat, Message as ChatMessage};
-use luz::error::CommandError;
-use luz::presence::{Offline, Presence, PresenceType};
-use luz::CommandMessage;
-use luz::{roster::Contact, user::User, LuzHandle, UpdateMessage};
use message_view::MessageView;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -125,7 +124,7 @@ impl Account {
#[derive(Clone, Debug)]
pub struct Client {
- client: LuzHandle,
+ client: filamento::Client,
jid: JID,
status: Presence,
connection_state: ConnectionState,
@@ -161,32 +160,36 @@ impl DerefMut for Client {
}
impl Deref for Client {
- type Target = LuzHandle;
+ type Target = filamento::Client;
fn deref(&self) -> &Self::Target {
&self.client
}
}
-async fn luz(jid: &JID, creds: &Creds, cfg: &Config) -> (LuzHandle, mpsc::Receiver<UpdateMessage>) {
- let luz;
+async fn filamento(
+ jid: &JID,
+ creds: &Creds,
+ cfg: &Config,
+) -> (filamento::Client, mpsc::Receiver<UpdateMessage>) {
+ let filamento;
if let Some(ref dburl) = cfg.dburl {
// TODO: have some sort of crash popup for this stuff
let db_path = dburl.strip_prefix("sqlite://").unwrap_or(&dburl);
let db_path = PathBuf::from_str(db_path).expect("invalid database path");
- let db = luz::db::Db::create_connect_and_migrate(db_path)
+ let db = filamento::db::Db::create_connect_and_migrate(db_path)
.await
.unwrap();
- luz = LuzHandle::new(jid.clone(), creds.password.to_string(), db);
+ filamento = filamento::Client::new(jid.clone(), creds.password.to_string(), db);
} else if let Some(ref dir) = cfg.storage_dir {
let mut data_dir = PathBuf::from_str(&dir).expect("invalid storage directory path");
data_dir.push(creds.jid.clone());
data_dir.push(creds.jid.clone());
data_dir.set_extension("db");
- let db = luz::db::Db::create_connect_and_migrate(data_dir)
+ let db = filamento::db::Db::create_connect_and_migrate(data_dir)
.await
.unwrap();
- luz = LuzHandle::new(jid.clone(), creds.password.to_string(), db);
+ filamento = filamento::Client::new(jid.clone(), creds.password.to_string(), db);
} else {
let mut data_dir = dirs::data_dir()
.expect("operating system does not support retreiving determining default data dir");
@@ -196,12 +199,12 @@ async fn luz(jid: &JID, creds: &Creds, cfg: &Config) -> (LuzHandle, mpsc::Receiv
// TODO: better lol
data_dir.set_extension("db");
info!("db_path: {:?}", data_dir);
- let db = luz::db::Db::create_connect_and_migrate(data_dir)
+ let db = filamento::db::Db::create_connect_and_migrate(data_dir)
.await
.unwrap();
- luz = LuzHandle::new(jid.clone(), creds.password.to_string(), db);
+ filamento = filamento::Client::new(jid.clone(), creds.password.to_string(), db);
}
- luz
+ filamento
}
#[tokio::main]
@@ -244,12 +247,12 @@ async fn main() -> iced::Result {
}
}
- let mut client: Option<(JID, LuzHandle, mpsc::Receiver<UpdateMessage>)> = None;
+ let mut client: Option<(JID, filamento::Client, mpsc::Receiver<UpdateMessage>)> = None;
if let Some(creds) = creds {
let jid = creds.jid.parse::<JID>();
match jid {
Ok(jid) => {
- let (handle, updates) = luz(&jid, &creds, &cfg).await;
+ let (handle, updates) = filamento(&jid, &creds, &cfg).await;
client = Some((jid, handle, updates));
}
Err(e) => client_creation_error = Some(Error::CredentialsLoad(e.into())),
@@ -394,13 +397,13 @@ pub enum Message {
#[derive(Debug, Error, Clone)]
pub enum Error {
#[error("failed to create Luz client: {0}")]
- ClientCreation(#[from] luz::error::DatabaseError),
+ ClientCreation(#[from] filamento::error::DatabaseError),
#[error("failed to save credentials: {0}")]
CredentialsSave(CredentialsSaveError),
#[error("failed to load credentials: {0}")]
CredentialsLoad(CredentialsLoadError),
#[error("failed to retreive messages for chat {0}")]
- MessageHistory(JID, CommandError<luz::error::DatabaseError>),
+ MessageHistory(JID, CommandError<filamento::error::DatabaseError>),
}
#[derive(Debug, Error, Clone)]
@@ -589,7 +592,7 @@ impl Macaw {
client.connection_state = ConnectionState::Connecting;
let client = client.client.clone();
Task::future(async move {
- client.send(CommandMessage::Connect).await;
+ client.connect().await;
})
.discard()
}
@@ -599,9 +602,7 @@ impl Macaw {
Account::LoggedIn(client) => {
let client = client.client.clone();
Task::future(async move {
- client
- .send(CommandMessage::Disconnect(Offline::default()))
- .await;
+ client.disconnect(Offline::default()).await;
})
.discard()
}
@@ -649,7 +650,7 @@ impl Macaw {
Ok(jid) => {
Task::perform(async move {
let (jid, creds, config) = (jid, creds, config);
- let (handle, recv) = luz(&jid, &creds, &config).await;
+ let (handle, recv) = filamento(&jid, &creds, &config).await;
(handle, recv, jid, creds, config)
}, move |(handle, recv, jid, creds, config)| {
let creds = creds;
@@ -767,9 +768,11 @@ impl Macaw {
return Task::none();
}
};
- Task::future(
- async move { client.send_message(jid, luz::chat::Body { body }).await },
- )
+ Task::future(async move {
+ client
+ .send_message(jid, filamento::chat::Body { body })
+ .await
+ })
.discard()
}
Message::Error(error) => {
diff --git a/src/message_view.rs b/src/message_view.rs
index 16e8ac1..5d27335 100644
--- a/src/message_view.rs
+++ b/src/message_view.rs
@@ -1,6 +1,7 @@
use std::borrow::Cow;
use chrono::NaiveDate;
+use filamento::chat::Message as ChatMessage;
use iced::{
alignment::Horizontal::{self, Right},
border::Radius,
@@ -16,7 +17,6 @@ use iced::{
};
use indexmap::IndexMap;
use jid::JID;
-use luz::chat::Message as ChatMessage;
use serde::{Deserialize, Serialize};
use uuid::Uuid;