aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.helix/languages.toml2
-rw-r--r--filamento/Cargo.toml2
-rw-r--r--filamento/src/chat.rs4
-rw-r--r--filamento/src/logic/process_stanza.rs1
-rw-r--r--filamento/src/roster.rs2
-rw-r--r--filamento/src/user.rs1
6 files changed, 10 insertions, 2 deletions
diff --git a/.helix/languages.toml b/.helix/languages.toml
index fc97b54..7662fff 100644
--- a/.helix/languages.toml
+++ b/.helix/languages.toml
@@ -5,5 +5,5 @@ environment = { "DATABASE_URL" = "sqlite://filamento/filamento.db" }
# check.overrideCommand="cargo check --message-format=json -p luz",
# check.workspace = false,
# cargo.target = "wasm32-unknown-unknown",
-config = { cargo.target = "wasm32-unknown-unknown", cargo.features = ["jid/rusqlite", "stanza/rfc_6121", "stanza/xep_0203", "stanza/rfc_7395", "stanza/xep_0030", "stanza/xep_0060", "stanza/xep_0172", "stanza/xep_0390", "stanza/xep_0128", "stanza/xep_0115", "stanza/xep_0084", "uuid/v4", "tokio/full", "rsasl/provider_base64", "rsasl/plain", "rsasl/config_builder", "rsasl/scram-sha-1"] }
+config = { cargo.target = "wasm32-unknown-unknown", cargo.features = ["jid/rusqlite", "stanza/rfc_6121", "stanza/xep_0203", "stanza/rfc_7395", "stanza/xep_0030", "stanza/xep_0060", "stanza/xep_0172", "stanza/xep_0390", "stanza/xep_0128", "stanza/xep_0115", "stanza/xep_0084", "uuid/v4", "tokio/full", "rsasl/provider_base64", "rsasl/plain", "rsasl/config_builder", "rsasl/scram-sha-1", "stanza/xep_0156"] }
# "sqlx/sqlite", "sqlx/runtime-tokio", "sqlx/uuid", "sqlx/chrono", "jid/sqlx",
diff --git a/filamento/Cargo.toml b/filamento/Cargo.toml
index cc05288..65ebcf4 100644
--- a/filamento/Cargo.toml
+++ b/filamento/Cargo.toml
@@ -5,6 +5,7 @@ edition = "2024"
[features]
serde = ["dep:serde", "jid/serde", "uuid/serde", "chrono/serde", "lampada/serde"]
+reactive_stores = ["dep:reactive_stores"]
[dependencies]
futures = "0.3.30"
@@ -25,6 +26,7 @@ sha1 = "0.10.6"
image = "0.25.6"
hex = "0.4.3"
serde = { version = "1.0.219", features = ["derive"], optional = true }
+reactive_stores = { version = "0.1.8", optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { workspace = true, features = ["sync", "time", "rt", "fs", "io-std"] }
diff --git a/filamento/src/chat.rs b/filamento/src/chat.rs
index 936613e..bb0793f 100644
--- a/filamento/src/chat.rs
+++ b/filamento/src/chat.rs
@@ -1,13 +1,14 @@
use chrono::{DateTime, Utc};
use jid::JID;
use rusqlite::{
- types::{FromSql, ToSqlOutput, Value},
ToSql,
+ types::{FromSql, ToSqlOutput, Value},
};
use uuid::Uuid;
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
+#[cfg_attr(feature = "reactive_stores", derive(reactive_stores::Store))]
pub struct Message {
pub id: Uuid,
// does not contain full user information
@@ -78,6 +79,7 @@ pub struct Body {
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
+#[cfg_attr(feature = "reactive_stores", derive(reactive_stores::Store))]
pub struct Chat {
pub correspondent: JID,
pub have_chatted: bool,
diff --git a/filamento/src/logic/process_stanza.rs b/filamento/src/logic/process_stanza.rs
index a5d40b2..81c3b1f 100644
--- a/filamento/src/logic/process_stanza.rs
+++ b/filamento/src/logic/process_stanza.rs
@@ -77,6 +77,7 @@ pub async fn recv_message<Fs: FileStore + Clone>(
},
delivery: None,
};
+ // TODO: process message type="error"
// save the message to the database
match logic.db().upsert_chat_and_user(&from).await {
diff --git a/filamento/src/roster.rs b/filamento/src/roster.rs
index 8f77086..284e2b8 100644
--- a/filamento/src/roster.rs
+++ b/filamento/src/roster.rs
@@ -12,6 +12,7 @@ pub struct ContactUpdate {
}
#[derive(Debug, Clone, PartialEq, Eq)]
+#[cfg_attr(feature = "reactive_stores", derive(reactive_stores::Store))]
pub struct Contact {
// jid is the id used to reference everything, but not the primary key
pub user_jid: JID,
@@ -21,6 +22,7 @@ pub struct Contact {
// TODO: avatar, nickname
/// nickname picked by contact
// nickname: Option<String>,
+ #[cfg_attr(feature = "reactive_stores", store(key: String = |group| group.clone()))]
pub groups: HashSet<String>,
}
diff --git a/filamento/src/user.rs b/filamento/src/user.rs
index f19a4ad..f30933c 100644
--- a/filamento/src/user.rs
+++ b/filamento/src/user.rs
@@ -2,6 +2,7 @@ use jid::JID;
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
+#[cfg_attr(feature = "reactive_stores", derive(reactive_stores::Store))]
pub struct User {
pub jid: JID,
pub nick: Option<String>,