aboutsummaryrefslogtreecommitdiff
path: root/src/message
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2025-07-27 01:51:14 +0200
committerMax Audron <audron@cocaine.farm>2025-07-27 01:51:14 +0200
commitd45e0a687ed5aa78f3e80bc5c335312bd81b2d4c (patch)
treec93c3cb6839b707202f678d25dab0752182948c4 /src/message
parentfix sessioninit message wrongly using NetworkMap to convert a field (diff)
temporarly fix nested network repr parsing for variant types
Diffstat (limited to '')
-rw-r--r--src/message/signalproxy/objects/bufferviewconfig.rs10
-rw-r--r--src/message/signalproxy/objects/network.rs16
-rw-r--r--src/message/signalproxy/objects/networkinfo.rs2
3 files changed, 19 insertions, 9 deletions
diff --git a/src/message/signalproxy/objects/bufferviewconfig.rs b/src/message/signalproxy/objects/bufferviewconfig.rs
index 8ca6b82..286e83a 100644
--- a/src/message/signalproxy/objects/bufferviewconfig.rs
+++ b/src/message/signalproxy/objects/bufferviewconfig.rs
@@ -11,15 +11,11 @@ use crate::primitive::{BufferId, NetworkId, VariantList};
#[derive(Debug, Default, Clone, PartialEq, NetworkList, NetworkMap)]
pub struct BufferViewConfig {
- #[network(rename = "BufferList", network = "map", variant = "VariantList")]
+ #[network(rename = "BufferList", network = "list", variant = "VariantList")]
pub buffers: Vec<BufferId>,
- #[network(rename = "RemovedBuffers", network = "map", variant = "VariantList")]
+ #[network(rename = "RemovedBuffers", network = "list", variant = "VariantList")]
pub removed_buffers: Vec<BufferId>,
- #[network(
- rename = "TemporarilyRemovedBuffers",
- network = "map",
- variant = "VariantList"
- )]
+ #[network(rename = "TemporarilyRemovedBuffers", network = "list", variant = "VariantList")]
pub temporarily_removed_buffers: Vec<BufferId>,
#[network(rename = "bufferViewId", default, skip)]
diff --git a/src/message/signalproxy/objects/network.rs b/src/message/signalproxy/objects/network.rs
index 693abfe..138f63f 100644
--- a/src/message/signalproxy/objects/network.rs
+++ b/src/message/signalproxy/objects/network.rs
@@ -9,7 +9,7 @@ use libquassel_derive::{sync, NetworkMap, Setters};
use crate::error::ProtocolError;
use crate::message::signalproxy::translation::NetworkMap;
-use crate::message::{Class, Syncable};
+use crate::message::{Class, NetworkList, Syncable};
use crate::primitive::{Variant, VariantList, VariantMap};
use crate::serialize::{Deserialize, Serialize, UserType};
@@ -617,6 +617,20 @@ pub struct NetworkServer {
pub proxy_pass: String,
}
+// TODO this is not correct usage, it's technically not really network repr were converting from
+// but just the conversion of VariantList -> Self directly
+// we have this problem since now we have generic VariantList impls
+// for all the variants and this type is now also directly a variant
+impl NetworkList for Vec<NetworkServer> {
+ fn to_network_list(&self) -> super::VariantList {
+ self.iter().map(|b| Variant::NetworkServer(b.clone())).collect()
+ }
+
+ fn from_network_list(input: &mut super::VariantList) -> Self {
+ input.iter().map(|b| match_variant!(b, Variant::NetworkServer)).collect()
+ }
+}
+
impl UserType for NetworkServer {
const NAME: &str = "Network::Server";
}
diff --git a/src/message/signalproxy/objects/networkinfo.rs b/src/message/signalproxy/objects/networkinfo.rs
index f81a3e7..4cd84dc 100644
--- a/src/message/signalproxy/objects/networkinfo.rs
+++ b/src/message/signalproxy/objects/networkinfo.rs
@@ -14,7 +14,7 @@ pub struct NetworkInfo {
pub network_name: String,
#[setter(skip)]
- #[network(rename = "ServerList", variant = "VariantList", network = "map")]
+ #[network(rename = "ServerList", variant = "VariantList", network = "list")]
pub server_list: Vec<NetworkServer>,
#[network(rename = "perform")]
pub perform: StringList,