Compare commits

..
Author SHA1 Message Date
e99c9c169b Update Rust crate rand_core to 0.10
Some checks failed
renovate/artifacts Artifact file update failure
renovate/stability-days Updates have met minimum release age requirement
2026-08-08 00:01:43 +02:00
5a31055d61
Merge branch 'main' of ssh://git.methanium.net/tensamin/iota 2026-08-07 23:53:17 +02:00
45da43805a
[Fix] User States 2026-08-07 23:53:12 +02:00
4cac2d0151 Merge pull request 'Update Rust crate sysinfo to 0.39.0' (#19) from renovate/sysinfo-0.x into main 2026-08-06 21:03:18 +02:00
e4a33578eb Update Rust crate sysinfo to 0.39.0
Some checks failed
renovate/artifacts Artifact file update failure
renovate/stability-days Updates have met minimum release age requirement
2026-08-06 21:03:15 +02:00
dde495ded9 Merge pull request 'Update Rust crate strum to 0.28.0' (#17) from renovate/strum-0.x into main 2026-08-06 21:03:00 +02:00
7a0746893c Update Rust crate strum to 0.28.0
Some checks failed
renovate/artifacts Artifact file update failure
renovate/stability-days Updates have met minimum release age requirement
2026-08-06 21:02:54 +02:00
14 changed files with 131 additions and 44 deletions

85
Cargo.lock generated
View file

@ -811,7 +811,7 @@ dependencies = [
"rustls-pemfile", "rustls-pemfile",
"serde_json", "serde_json",
"sha2 0.11.0", "sha2 0.11.0",
"strum 0.27.2", "strum",
"strum_macros", "strum_macros",
"sysinfo", "sysinfo",
"tokio", "tokio",
@ -1264,6 +1264,16 @@ dependencies = [
"ctutils", "ctutils",
] ]
[[package]]
name = "dispatch2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
dependencies = [
"bitflags 2.13.1",
"objc2",
]
[[package]] [[package]]
name = "displaydoc" name = "displaydoc"
version = "0.2.7" version = "0.2.7"
@ -1353,7 +1363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -2234,7 +2244,7 @@ dependencies = [
"rustls-pemfile", "rustls-pemfile",
"serde_json", "serde_json",
"sha2 0.11.0", "sha2 0.11.0",
"strum 0.27.2", "strum",
"strum_macros", "strum_macros",
"sysinfo", "sysinfo",
"tokio", "tokio",
@ -2291,7 +2301,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_yaml", "serde_yaml",
"sha2 0.11.0", "sha2 0.11.0",
"strum 0.27.2", "strum",
"strum_macros", "strum_macros",
"sysinfo", "sysinfo",
"tempfile", "tempfile",
@ -3219,6 +3229,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "objc2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"
dependencies = [
"objc2-encode",
]
[[package]] [[package]]
name = "objc2-core-foundation" name = "objc2-core-foundation"
version = "0.3.2" version = "0.3.2"
@ -3226,6 +3245,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
dependencies = [ dependencies = [
"bitflags 2.13.1", "bitflags 2.13.1",
"dispatch2",
"objc2",
]
[[package]]
name = "objc2-encode"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
"bitflags 2.13.1",
"objc2",
] ]
[[package]] [[package]]
@ -3238,6 +3275,17 @@ dependencies = [
"objc2-core-foundation", "objc2-core-foundation",
] ]
[[package]]
name = "objc2-open-directory"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb82bed227edf5201dfedf072bba4015a33d3d4a98519837295a90f0a23f676d"
dependencies = [
"objc2",
"objc2-core-foundation",
"objc2-foundation",
]
[[package]] [[package]]
name = "octets" name = "octets"
version = "0.3.6" version = "0.3.6"
@ -3396,7 +3444,7 @@ dependencies = [
"rustls-pemfile", "rustls-pemfile",
"serde_json", "serde_json",
"sha2 0.11.0", "sha2 0.11.0",
"strum 0.27.2", "strum",
"strum_macros", "strum_macros",
"sysinfo", "sysinfo",
"tokio", "tokio",
@ -3853,7 +3901,7 @@ dependencies = [
"once_cell", "once_cell",
"socket2 0.6.5", "socket2 0.6.5",
"tracing", "tracing",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -3981,7 +4029,7 @@ dependencies = [
"lru", "lru",
"palette", "palette",
"serde", "serde",
"strum 0.28.0", "strum",
"thiserror 2.0.19", "thiserror 2.0.19",
"unicode-segmentation", "unicode-segmentation",
"unicode-truncate", "unicode-truncate",
@ -4045,7 +4093,7 @@ dependencies = [
"line-clipping", "line-clipping",
"ratatui-core", "ratatui-core",
"serde", "serde",
"strum 0.28.0", "strum",
"time", "time",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
@ -4221,7 +4269,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -4289,7 +4337,7 @@ dependencies = [
"security-framework", "security-framework",
"security-framework-sys", "security-framework-sys",
"webpki-root-certs", "webpki-root-certs",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -4695,12 +4743,6 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.28.0" version = "0.28.0"
@ -4783,15 +4825,16 @@ dependencies = [
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.38.4" version = "0.39.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" checksum = "d2071df9448915b71c4fe6d25deaf1c22f12bd234f01540b77312bb8e41361e6"
dependencies = [ dependencies = [
"libc", "libc",
"memchr", "memchr",
"ntapi", "ntapi",
"objc2-core-foundation", "objc2-core-foundation",
"objc2-io-kit", "objc2-io-kit",
"objc2-open-directory",
"windows", "windows",
] ]
@ -4826,7 +4869,7 @@ dependencies = [
"getrandom 0.4.3", "getrandom 0.4.3",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -5515,7 +5558,7 @@ dependencies = [
"rustls-pemfile", "rustls-pemfile",
"serde_json", "serde_json",
"sha2 0.11.0", "sha2 0.11.0",
"strum 0.27.2", "strum",
"strum_macros", "strum_macros",
"sysinfo", "sysinfo",
"tokio", "tokio",
@ -5631,7 +5674,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]

View file

@ -48,9 +48,9 @@ rustls = { version = "0.23.37", features = ["aws-lc-rs"] }
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
serde_json = "1.0.149" serde_json = "1.0.149"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }
tungstenite = "*" tungstenite = "*"

View file

@ -47,9 +47,9 @@ rustls = { version = "0.23.37", features = ["aws-lc-rs"] }
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
serde_json = "1.0.149" serde_json = "1.0.149"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }
tungstenite = "*" tungstenite = "*"

View file

@ -44,9 +44,9 @@ rustls = { version = "0.23.37", features = ["aws-lc-rs"] }
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
serde_json = "1.0.149" serde_json = "1.0.149"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }
tungstenite = "*" tungstenite = "*"

View file

@ -64,9 +64,9 @@ serde_json = "1.0.149"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9" serde_yaml = "0.9"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["rt"] } tokio-util = { version = "0.7", features = ["rt"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }

View file

@ -296,6 +296,45 @@ fn contact_value(
typed_container(fields) typed_container(fields)
} }
fn current_contact_ids(user_id: i64) -> DataValue {
contact_ids_value(
chats_util::get_users(user_id)
.into_iter()
.map(|contact| contact.user_id),
)
}
fn contact_ids_value(ids: impl IntoIterator<Item = i64>) -> DataValue {
let mut contact_ids = ids.into_iter().collect::<Vec<_>>();
contact_ids.sort_unstable();
contact_ids.dedup();
DataValue::Array(
contact_ids
.into_iter()
.map(|user_id| DataValue::SignedNumber(user_id as i128))
.collect(),
)
}
#[cfg(test)]
mod presence_tests {
use super::contact_ids_value;
use mtp::codec::DataValue;
#[test]
fn contact_snapshot_is_sorted_and_deduplicated() {
assert_eq!(
contact_ids_value([9, 3, 9, 4, 3]),
DataValue::Array(vec![
DataValue::SignedNumber(3),
DataValue::SignedNumber(4),
DataValue::SignedNumber(9),
])
);
}
}
fn sync_error(cv: &CommunicationValue) -> CommunicationValue { fn sync_error(cv: &CommunicationValue) -> CommunicationValue {
error_response(cv, CommunicationType::ErrorInvalidData).add_typed_default( error_response(cv, CommunicationType::ErrorInvalidData).add_typed_default(
DataType::SessionId, DataType::SessionId,
@ -356,10 +395,6 @@ pub fn handle_client_connected(cv: &CommunicationValue) -> CommunicationValue {
), ),
} }
}; };
let all_contact_ids = chats_util::get_users(user_id)
.into_iter()
.map(|contact| DataValue::SignedNumber(contact.user_id as i128))
.collect();
let message_values = messages let message_values = messages
.iter() .iter()
.map(|message| stored_message_value(message, user_id, message.external_user)) .map(|message| stored_message_value(message, user_id, message.external_user))
@ -408,7 +443,7 @@ pub fn handle_client_connected(cv: &CommunicationValue) -> CommunicationValue {
.collect(), .collect(),
), ),
) )
.add_typed_default(DataType::UserIds, DataValue::Array(all_contact_ids)) .add_typed_default(DataType::UserIds, current_contact_ids(user_id))
.add_typed_default(DataType::Calls, DataValue::Array(Vec::new())) .add_typed_default(DataType::Calls, DataValue::Array(Vec::new()))
} }
@ -511,6 +546,10 @@ pub fn handle_get_chats(cv: &CommunicationValue) -> CommunicationValue {
pub fn handle_add_conversation(cv: &CommunicationValue) -> CommunicationValue { pub fn handle_add_conversation(cv: &CommunicationValue) -> CommunicationValue {
let user_id = cv.get_sender(); let user_id = cv.get_sender();
let session_id = match data_i64(cv, DataType::SessionId) {
Some(id) if id > 0 => id,
_ => return sync_error(cv),
};
let other_id = match cv.get_data(DataType::ChatPartnerId).as_number() { let other_id = match cv.get_data(DataType::ChatPartnerId).as_number() {
Some(n) => n as i64, Some(n) => n as i64,
None => cv None => cv
@ -532,6 +571,11 @@ pub fn handle_add_conversation(cv: &CommunicationValue) -> CommunicationValue {
CommunicationValue::new(CommunicationType::AddConversation) CommunicationValue::new(CommunicationType::AddConversation)
.with_id(cv.get_id()) .with_id(cv.get_id())
.with_receiver(user_id) .with_receiver(user_id)
.add_typed_default(
DataType::SessionId,
DataValue::SignedNumber(session_id as i128),
)
.add_typed_default(DataType::UserIds, current_contact_ids(user_id as i64))
} }
pub fn handle_add_community(cv: &CommunicationValue) -> CommunicationValue { pub fn handle_add_community(cv: &CommunicationValue) -> CommunicationValue {

View file

@ -15,7 +15,7 @@ omikron-connector = { path = "../omikron-connector" }
mtp = { git = "https://git.methanium.net/Methanium/mtp.git" } mtp = { git = "https://git.methanium.net/Methanium/mtp.git" }
dashmap = "6.1.0" dashmap = "6.1.0"
libc = "0.2" libc = "0.2"
sysinfo = "0.38.3" sysinfo = "0.39.0"
serde_yaml = "0.9" serde_yaml = "0.9"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["rt"] } tokio-util = { version = "0.7", features = ["rt"] }

View file

@ -12,6 +12,6 @@ dashmap = "6.1.0"
once_cell = "1.21.3" once_cell = "1.21.3"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
json = "*" json = "*"
sysinfo = "0.38.3" sysinfo = "0.39.0"
mtp = { git = "https://git.methanium.net/Methanium/mtp.git" } mtp = { git = "https://git.methanium.net/Methanium/mtp.git" }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }

View file

@ -29,7 +29,7 @@ ratatui = "0.30.0"
reqwest = "0.13.2" reqwest = "0.13.2"
rusqlite = "0.40.0" rusqlite = "0.40.0"
sha2 = "0.11.0" sha2 = "0.11.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
uuid = { version = "*", features = ["v4"] } uuid = { version = "*", features = ["v4"] }
walkdir = "2.5.0" walkdir = "2.5.0"

View file

@ -14,7 +14,7 @@ pnet = "0.35.0"
ratatui = "0.30.0" ratatui = "0.30.0"
reqwest = "0.13.2" reqwest = "0.13.2"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
sysinfo = "0.38.3" sysinfo = "0.39.0"
uuid = { version = "*", features = ["v4"] } uuid = { version = "*", features = ["v4"] }
walkdir = "2.5.0" walkdir = "2.5.0"
zip = "6.0.0" zip = "6.0.0"

View file

@ -11,7 +11,7 @@ mtp = { git = "https://git.methanium.net/Methanium/mtp.git", features = [
reqwest = "0.13.2" reqwest = "0.13.2"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
sysinfo = "0.38.3" sysinfo = "0.39.0"
uuid = { version = "*", features = ["v4"] } uuid = { version = "*", features = ["v4"] }
walkdir = "2.5.0" walkdir = "2.5.0"
zip = "6.0.0" zip = "6.0.0"

@ -1 +1 @@
Subproject commit f430cd358b3d07a4cfd6982eb8917fec80c24a7d Subproject commit 486541b9483356ff49ff3ec7016f87d3ecbeaa0e

View file

@ -47,9 +47,9 @@ rustls = { version = "0.23.37", features = ["aws-lc-rs"] }
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
serde_json = "1.0.149" serde_json = "1.0.149"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }
tungstenite = "*" tungstenite = "*"

View file

@ -47,9 +47,9 @@ rustls = { version = "0.23.37", features = ["aws-lc-rs"] }
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
serde_json = "1.0.149" serde_json = "1.0.149"
sha2 = "0.11.0" sha2 = "0.11.0"
strum = "0.27.2" strum = "0.28.0"
strum_macros = "0.28.0" strum_macros = "0.28.0"
sysinfo = "0.38.3" sysinfo = "0.39.0"
tokio = { version = "1.50.0", features = ["full"] } tokio = { version = "1.50.0", features = ["full"] }
tokio-tungstenite = { version = "*", features = ["native-tls"] } tokio-tungstenite = { version = "*", features = ["native-tls"] }
tungstenite = "*" tungstenite = "*"