diff options
Diffstat (limited to 'src/message')
| -rw-r--r-- | src/message/signalproxy/objects/bufferview.rs | 87 | ||||
| -rw-r--r-- | src/message/signalproxy/objects/mod.rs | 8 |
2 files changed, 95 insertions, 0 deletions
diff --git a/src/message/signalproxy/objects/bufferview.rs b/src/message/signalproxy/objects/bufferview.rs new file mode 100644 index 0000000..512a5b9 --- /dev/null +++ b/src/message/signalproxy/objects/bufferview.rs @@ -0,0 +1,87 @@ +use libquassel_derive::Network; +use std::{collections::HashMap, convert::TryInto}; + +use crate::primitive::{Variant, VariantList}; + +#[derive(Debug, Clone, PartialEq)] +// #[network(repr = "list")] +pub struct BufferViewManager { + // #[network(rename = "bufferViewConfigs", network, variant = "VariantMap")] + pub buffer_view_configs: HashMap<i32, BufferViewConfig>, + // // C->S calls + + // requestCreateBufferView(properties: QVariantMap) + // requestCreateBufferViews(properties: QVariantList) + // requestDeleteBufferView(bufferViewId: Int) + // requestDeleteBufferViews(bufferViews: QVariantList) + + // // S->C calls + + // addBufferViewConfig(bufferViewConfigId: Int) + // deleteBufferViewConfig(bufferViewConfigId: Int) + // newBufferViewConfig(bufferViewConfigId: Int) + // /** + // * Replaces all properties of the object with the content of the + // * "properties" parameter. This parameter is in network representation. + // */ + // update(properties: QVariantMap) +} + +impl super::Network for BufferViewManager { + type Item = VariantList; + + fn to_network(&self) -> Self::Item { + let mut res = Vec::with_capacity(2); + + res.push(Variant::ByteArray(s!("bufferViewIds"))); + res.push(Variant::VariantList( + self.buffer_view_configs + .iter() + .map(|(k, _)| i32::try_into(*k).unwrap()) + .collect(), + )); + + return res; + } + + fn from_network(_input: &mut Self::Item) -> Self { + // TODO Somehow do the initrequests for all the IDs we get here + Self { + buffer_view_configs: HashMap::new(), + } + } +} + +#[derive(Debug, Clone, PartialEq, Network)] +#[network(repr = "list")] +pub struct BufferViewConfig { + #[network(rename = "BufferList", network, variant = "VariantList")] + pub buffers: Vec<i32>, + #[network(rename = "RemovedBuffers", network, variant = "VariantList")] + pub removed_buffers: Vec<i32>, + #[network(rename = "TemporarilyRemovedBuffers", network, variant = "VariantList")] + pub temporarily_removed_buffers: Vec<i32>, + + // #[network(rename = "bufferViewId")] + // pub buffer_view_id: i32, + #[network(rename = "bufferViewName")] + pub buffer_view_name: String, + #[network(rename = "networkId")] + pub network_id: i32, + #[network(rename = "addNewBuffersAutomatically")] + pub add_new_buffers_automatically: bool, + #[network(rename = "sortAlphabetically")] + pub sort_alphabetically: bool, + #[network(rename = "hideInactiveBuffers")] + pub hide_inactive_buffers: bool, + #[network(rename = "hideInactiveNetworks")] + pub hide_inactive_networks: bool, + #[network(rename = "disableDecoration")] + pub disable_decoration: bool, + #[network(rename = "allowedBufferTypes")] + pub allowed_buffers_types: i32, + #[network(rename = "minimumActivity")] + pub minimum_activity: i32, + #[network(rename = "showSearch")] + pub show_search: bool, +} diff --git a/src/message/signalproxy/objects/mod.rs b/src/message/signalproxy/objects/mod.rs index bc07dca..24c244d 100644 --- a/src/message/signalproxy/objects/mod.rs +++ b/src/message/signalproxy/objects/mod.rs @@ -1,5 +1,6 @@ mod aliasmanager; mod buffersyncer; +mod bufferview; mod coreinfo; mod highlightrulemanager; mod identity; @@ -12,6 +13,7 @@ use std::convert::TryInto; pub use aliasmanager::*; pub use buffersyncer::*; +pub use bufferview::*; pub use coreinfo::*; pub use highlightrulemanager::*; pub use identity::*; @@ -29,6 +31,8 @@ use crate::primitive::VariantList; pub enum Types { AliasManager(AliasManager), BufferSyncer(BufferSyncer), + BufferViewConfig(BufferViewConfig), + BufferViewManager(BufferViewManager), Network(network::Network), NetworkInfo(NetworkInfo), NetworkConfig(NetworkConfig), @@ -42,6 +46,8 @@ impl Types { match self { Types::AliasManager(val) => val.to_network(), Types::BufferSyncer(val) => val.to_network(), + Types::BufferViewConfig(val) => val.to_network(), + Types::BufferViewManager(val) => val.to_network(), Types::Network(val) => val.to_network(), Types::NetworkInfo(val) => val.to_network(), Types::NetworkConfig(val) => val.to_network(), @@ -61,6 +67,8 @@ impl Types { "NetworkConfig" => Types::NetworkConfig(NetworkConfig::from_network(input)), "AliasManager" => Types::AliasManager(AliasManager::from_network(input)), "BufferSyncer" => Types::BufferSyncer(BufferSyncer::from_network(input)), + "BufferViewConfig" => Types::BufferViewConfig(BufferViewConfig::from_network(input)), + "BufferViewManager" => Types::BufferViewManager(BufferViewManager::from_network(input)), "CoreData" => Types::CoreData(CoreData::from_network( &mut input.remove(0).try_into().unwrap(), )), |
