diff options
| author | Max Audron <audron@cocaine.farm> | 2021-12-02 18:53:03 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-12-02 19:16:23 +0100 |
| commit | 0e79487daba38e7210be2b413faaf21c8d3d1052 (patch) | |
| tree | 58879eb221cbc4200e184b9552dc6945e53a97f4 /src | |
| parent | add certmanager impl (diff) | |
add coreinfo impl
Diffstat (limited to 'src')
| -rw-r--r-- | src/message/signalproxy/objects/coreinfo.rs | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/src/message/signalproxy/objects/coreinfo.rs b/src/message/signalproxy/objects/coreinfo.rs index f3282b6..ac493f1 100644 --- a/src/message/signalproxy/objects/coreinfo.rs +++ b/src/message/signalproxy/objects/coreinfo.rs @@ -1,22 +1,58 @@ use libquassel_derive::{NetworkList, NetworkMap}; use crate::message::signalproxy::translation::NetworkMap; +use crate::message::Syncable; use crate::primitive::{DateTime, StringList}; -#[derive(Debug, Clone, PartialEq, NetworkMap, NetworkList)] +#[derive(Debug, Clone, PartialEq, NetworkList, NetworkMap)] #[network(repr = "map")] pub struct CoreInfo { #[network(rename = "coreData", variant = "VariantMap", network)] core_data: CoreData, } -// // S->C calls -// setCoreData(coreData: QVariantMap) -// /** -// * Replaces all properties of the object with the content of the -// * "properties" parameter. This parameter is in network representation. -// */ -// update(properties: QVariantMap) +impl CoreInfo { + pub fn set_core_data(&mut self, data: CoreData) { + #[cfg(feature = "server")] + libquassel_derive::sync!("setCoreData", [data.to_network_map()]); + + self.core_data = data; + } +} + +#[cfg(feature = "client")] +impl crate::message::StatefulSyncableClient for CoreInfo { + fn sync_custom(&mut self, mut msg: crate::message::SyncMessage) + where + Self: Sized, + { + match msg.slot_name.as_str() { + "setCoreData" => self.set_core_data(CoreData::from_network_map(&mut get_param!(msg))), + _ => (), + } + } + + /// Not Implemented + fn request_update(&mut self) + where + Self: Sized, + { + } +} + +#[cfg(feature = "server")] +impl crate::message::StatefulSyncableServer for CoreInfo { + /// Not Implemented + fn request_update(&mut self, mut _param: <CoreInfo as NetworkMap>::Item) + where + Self: Sized, + { + } +} + +impl Syncable for CoreInfo { + const CLASS: &'static str = "CoreInfo"; +} #[derive(Debug, Clone, PartialEq, NetworkMap)] #[network(repr = "map")] |
