This commit is contained in:
Alex Emmet 2026-07-07 23:37:13 +02:00
commit 9b20d159b5
4 changed files with 159 additions and 89 deletions

48
Cargo.lock generated
View file

@ -886,18 +886,18 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
version = "0.5.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17"
[[package]]
name = "crossterm"
@ -2351,11 +2351,11 @@ dependencies = [
[[package]]
name = "jobserver"
version = "0.1.34"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
dependencies = [
"getrandom 0.3.4",
"getrandom 0.4.3",
"libc",
]
@ -2667,7 +2667,7 @@ dependencies = [
[[package]]
name = "mtp"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"mtp-client",
"mtp-codec",
@ -2681,7 +2681,7 @@ dependencies = [
[[package]]
name = "mtp-client"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"mtp-codec",
"mtp-common",
@ -2694,7 +2694,7 @@ dependencies = [
[[package]]
name = "mtp-codec"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"base64",
"byteorder",
@ -2707,7 +2707,7 @@ dependencies = [
[[package]]
name = "mtp-common"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"quinn",
"rustls",
@ -2718,7 +2718,7 @@ dependencies = [
[[package]]
name = "mtp-crypto"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"base64",
"chacha20poly1305",
@ -2737,7 +2737,7 @@ dependencies = [
[[package]]
name = "mtp-files"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"mtp-crypto",
"thiserror 1.0.69",
@ -2746,7 +2746,7 @@ dependencies = [
[[package]]
name = "mtp-host"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"mtp-codec",
"mtp-common",
@ -2759,11 +2759,12 @@ dependencies = [
[[package]]
name = "mtp-transport"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"log",
"mtp-codec",
"mtp-common",
"rcgen",
"rustls",
"rustls-native-certs",
"tokio",
@ -2773,7 +2774,7 @@ dependencies = [
[[package]]
name = "mtp-type-map"
version = "0.1.0"
source = "git+https://git.methanium.net/Methanium/mtp.git#515244ce6664b355f0a89b00c8c18c26c8b95dbd"
source = "git+https://git.methanium.net/Methanium/mtp.git#2126a142f44634ccfdcaa297633fdb63b1d9b46d"
dependencies = [
"serde",
"serde_yaml",
@ -3733,6 +3734,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57f6d249aad744e274e682777a50283a225a32705394ee6d5fcc01efa25e4055"
dependencies = [
"aws-lc-rs",
"pem",
"ring",
"rustls-pki-types",
"time",
"x509-parser",
@ -3985,9 +3988,9 @@ dependencies = [
[[package]]
name = "rustversion"
version = "1.0.22"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
[[package]]
name = "ryu"
@ -5584,6 +5587,7 @@ dependencies = [
"lazy_static",
"nom",
"oid-registry",
"ring",
"rusticata-macros",
"thiserror 2.0.18",
"time",
@ -5624,18 +5628,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.52"
version = "0.8.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
checksum = "75726053136156d419e285b9b7eddaaea9e3fea6ce32eed44a89901f0bd98de1"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.52"
version = "0.8.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
checksum = "4714fd92cf900833d49538023a9b3915155210801d1c1169eba513b2addefd71"
dependencies = [
"proc-macro2",
"quote",

View file

@ -527,7 +527,14 @@ impl ClientConnection {
msg_container.push((DataType::Content, DataValue::Str(content.clone())));
msg_container.push((DataType::MessageState, DataValue::Str(message_state)));
msg_container.push((DataType::Height, DataValue::SignedNumber(height as i128)));
msg_container.push((DataType::SentBySelf, DataValue::Bool(sent_by_self)));
msg_container.push((
DataType::SenderId,
DataValue::UnsignedNumber(if sent_by_self {
user_id as u128
} else {
contact.user_id as u128
}),
));
msg_array.push(typed_container(msg_container));
if msg_array.len() == 1 {
@ -642,9 +649,7 @@ impl ClientConnection {
DataType::SenderId,
DataValue::SignedNumber(*sender_id as i128),
)
.add_typed_default(
DataType::Message,
{
.add_typed_default(DataType::Message, {
let mut msg_fields = vec![
(DataType::Content, DataValue::Str(content.clone())),
(
@ -660,8 +665,7 @@ impl ClientConnection {
));
}
typed_container(msg_fields)
},
);
});
let user_resp = self
.clone()
@ -775,7 +779,14 @@ impl ClientConnection {
));
container.push((DataType::MessageState, DataValue::Str(message_state)));
container.push((DataType::Height, DataValue::SignedNumber(height as i128)));
container.push((DataType::SentBySelf, DataValue::Bool(sent_by_self)));
container.push((
DataType::SenderId,
DataValue::UnsignedNumber(if sent_by_self {
my_id as u128
} else {
partner_id as u128
}),
));
msg_array.push(typed_container(container));
}

View file

@ -1164,7 +1164,14 @@ impl OmikronConnection {
msg_container.push((DataType::Content, DataValue::Str(content.clone())));
msg_container.push((DataType::MessageState, DataValue::Str(message_state)));
msg_container.push((DataType::Height, DataValue::SignedNumber(height as i128)));
msg_container.push((DataType::SentBySelf, DataValue::Bool(sent_by_self)));
msg_container.push((
DataType::SenderId,
DataValue::UnsignedNumber(if sent_by_self {
user_id as u128
} else {
contact.user_id as u128
}),
));
msg_array.push(typed_container(msg_container));
if msg_array.len() == 1 {
@ -1390,9 +1397,7 @@ impl OmikronConnection {
DataType::SenderId,
DataValue::SignedNumber(sender_id as i128),
)
.add_typed_default(
DataType::Message,
{
.add_typed_default(DataType::Message, {
let mut msg_fields = vec![
(DataType::Content, DataValue::Str(content.clone())),
(
@ -1408,8 +1413,7 @@ impl OmikronConnection {
));
}
typed_container(msg_fields)
},
);
});
// Attempt delivery and await a response from the local client
let user_resp = self
@ -1558,9 +1562,7 @@ impl OmikronConnection {
DataType::SenderId,
DataValue::SignedNumber(*sender_id as i128),
)
.add_typed_default(
DataType::Message,
{
.add_typed_default(DataType::Message, {
let mut msg_fields = vec![
(DataType::Content, DataValue::Str(content.clone())),
(
@ -1576,8 +1578,7 @@ impl OmikronConnection {
));
}
typed_container(msg_fields)
},
);
});
let user_resp = self
.clone()
@ -1703,7 +1704,14 @@ impl OmikronConnection {
));
container.push((DataType::MessageState, DataValue::Str(message_state)));
container.push((DataType::Height, DataValue::SignedNumber(height as i128)));
container.push((DataType::SentBySelf, DataValue::Bool(sent_by_self)));
container.push((
DataType::SenderId,
DataValue::UnsignedNumber(if sent_by_self {
my_id as u128
} else {
partner_id as u128
}),
));
if let Some(rt) = m["reply_to"].as_i64() {
container.push((
DataType::ReplyId,

View file

@ -1,8 +1,46 @@
# The version a Client should use
protocol_version: "1.0"
# Note that markers 0 to 31 are reserved for default use, manually working with them is not recommended
# Fixed CommunicationType markers are:
# Error: 0
# ErrorParsing: 1
# ErrorBadVersion: 2
# Disconnect: 3
# Redirect: 4
# Shutdown: 5
# BadRequest: 6
# Unauthorized: 7
# Forbidden: 8
# NotFound: 9
# TooManyRequests: 10
# InternalServerError: 11
# BadGateway: 12
# ServiceUnavailable: 13
# GatewayTimeout: 14
# Identification: 15
# IdentificationResponse: 16
# Register: 17
# RegisterResponse: 18
# Ping: 19
# Pong: 20
# Fixed Data Type markers are:
# Error: 0
# ErrorParsing: 1
# ErrorMessage: 2
# Version: 3
# Description: 4
# Timestamp: 5
# Id: 6
# ClientNonce: 7
# ServerNonce: 8
# PublicKeys: 9
# Signature: 10
# Connected: 11
type_maps:
"1.0": # Protocol version 1.0
"1.0":
CommunicationTypes:
ErrorProtocol: 33
ErrorAnonymous: 34
@ -33,6 +71,7 @@ type_maps:
MessageLive: 59
MessageOtherIota: 60
MessageChunk: 61
MessageGet: 143
MessagesGet: 62
PushNotification: 63
ReadNotification: 64
@ -104,6 +143,11 @@ type_maps:
GetChatSecret: 140
ChatSecretResponse: 141
ChatSecretForward: 142
MessageEditLive: 144
MessageEdit: 145
MessageReactionAdd: 146
MessageReactionRemove: 147
MessageReactionLive: 148
DataTypes:
ErrorType: 32
ErrorProtocol: 33
@ -218,4 +262,7 @@ type_maps:
SenderUserId: 152
RecipientUserId: 153
Recipients: 154
ReplyId: 155
Edited: 155
Reactions: 156
Reaction: 157
ReplyId: 158