aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-08-17 18:38:43 +0200
committerMax Audron <audron@cocaine.farm>2021-09-28 18:15:50 +0200
commita54398597d045d9ef6b363089811aa4811ba851d (patch)
tree7c2e402358ae25c8c333fee9849c8edec891a2da
parentadd NetworkList and NetworkMap derive macros (diff)
switch AliasManager to use split network translation traits
-rw-r--r--src/message/signalproxy/mod.rs1
-rw-r--r--src/message/signalproxy/objects/aliasmanager.rs9
-rw-r--r--src/message/signalproxy/objects/mod.rs6
-rw-r--r--src/message/signalproxy/translation/mod.rs11
4 files changed, 17 insertions, 10 deletions
diff --git a/src/message/signalproxy/mod.rs b/src/message/signalproxy/mod.rs
index b06bcee..23694c8 100644
--- a/src/message/signalproxy/mod.rs
+++ b/src/message/signalproxy/mod.rs
@@ -61,7 +61,6 @@ pub trait Syncable {
}
}
-// TODO handle client vs server with feature flag
/// A Stateful Syncable Object
#[allow(unused_variables)]
pub trait StatefulSyncable: Syncable {
diff --git a/src/message/signalproxy/objects/aliasmanager.rs b/src/message/signalproxy/objects/aliasmanager.rs
index d0e5d5b..2a29865 100644
--- a/src/message/signalproxy/objects/aliasmanager.rs
+++ b/src/message/signalproxy/objects/aliasmanager.rs
@@ -1,12 +1,15 @@
-use libquassel_derive::Network;
+use libquassel_derive::{Network, NetworkList, NetworkMap};
use crate::message::{StatefulSyncable, SyncProxy, Syncable};
+use crate::message::signalproxy::translation::Network;
+use crate::primitive::{VariantList, VariantMap};
+
/// AliasManager
/// keeps a list of all registered aliases
/// syncable
-#[derive(Clone, Debug, std::cmp::PartialEq, Network)]
-#[network(repr = "list")]
+#[derive(Clone, Debug, std::cmp::PartialEq, NetworkList, NetworkMap)]
+#[network]
pub struct AliasManager {
#[network(rename = "Aliases", variant = "VariantMap", network)]
pub aliases: Vec<Alias>,
diff --git a/src/message/signalproxy/objects/mod.rs b/src/message/signalproxy/objects/mod.rs
index 59c196d..124ed10 100644
--- a/src/message/signalproxy/objects/mod.rs
+++ b/src/message/signalproxy/objects/mod.rs
@@ -29,7 +29,7 @@ pub use networkinfo::*;
use libquassel_derive::From;
use log::debug;
-use super::Network;
+use super::{Network, NetworkList, NetworkMap};
use crate::primitive::VariantList;
/// Central Enum containing and identifying all Quassel Protocol Types:
@@ -72,7 +72,7 @@ impl Types {
pub fn to_network(&self) -> VariantList {
debug!("converting to network object: {:#?}", self);
match self {
- Types::AliasManager(val) => val.to_network(),
+ Types::AliasManager(val) => val.to_network_list(),
Types::BufferSyncer(val) => val.to_network(),
Types::BufferViewConfig(val) => val.to_network(),
Types::BufferViewManager(val) => val.to_network(),
@@ -94,7 +94,7 @@ impl Types {
class_name, input
);
match class_name {
- "AliasManager" => Types::AliasManager(AliasManager::from_network(input)),
+ "AliasManager" => Types::AliasManager(AliasManager::from_network_list(input)),
"BufferSyncer" => Types::BufferSyncer(BufferSyncer::from_network(input)),
"BufferViewConfig" => Types::BufferViewConfig(BufferViewConfig::from_network(input)),
"BufferViewManager" => Types::BufferViewManager(BufferViewManager::from_network(input)),
diff --git a/src/message/signalproxy/translation/mod.rs b/src/message/signalproxy/translation/mod.rs
index 6a21ec0..3587ab6 100644
--- a/src/message/signalproxy/translation/mod.rs
+++ b/src/message/signalproxy/translation/mod.rs
@@ -84,7 +84,7 @@ VariantMap({
})
```
**/
-use crate::primitive::VariantMap;
+use crate::primitive::{VariantList, VariantMap};
pub trait Network {
type Item;
@@ -94,6 +94,11 @@ pub trait Network {
}
pub trait NetworkMap {
- fn to_variantmap(&self) -> VariantMap;
- fn from_variantmap(input: &mut VariantMap) -> Self;
+ fn to_network_map(&self) -> VariantMap;
+ fn from_network_map(input: &mut VariantMap) -> Self;
+}
+
+pub trait NetworkList {
+ fn to_network_list(&self) -> VariantList;
+ fn from_network_list(input: &mut VariantList) -> Self;
}
0:59 +0200'>2021-10-20bump version to 1.6.2Max Audron-3/+2 2021-10-20prepare for release on crates.ioMax Audron-39/+65 2021-10-20add async docs to macro crate and bump versionMax Audron-9/+10 2021-10-20change hook errors to be logged as warningsMax Audron-3/+3 they in nearly all cases aren't critical enough to warrant an actual error messages 2021-10-20fix configuration not loading correctly on release buildsMax Audron-8/+23 2021-10-19replace sedregex crate8-rework-sedMax Audron-20/+358 This replaces the sedregex crate with our own implementation for multiple reasons: 1. We required to access the parsed regex, this required a patch to the sedregex crate which did not get merged due to an inactive dev, blocking us from publishing on crates.Io 2. We wanted to highlight the changes done in bold 3. We want to add execution of multiple chained sed commands in the future which would require more modification 2021-10-19add formatting trait for irc codesMax Audron-0/+129 add an impl off the formatting trait on String to format Strings with the typical irc formatting codes for bold, italic etc 2021-10-17fix links in readmeMax Audron-2/+2