aboutsummaryrefslogtreecommitdiff
path: root/src/message/signalproxy/objects
diff options
context:
space:
mode:
Diffstat (limited to 'src/message/signalproxy/objects')
-rw-r--r--src/message/signalproxy/objects/mod.rs2
-rw-r--r--src/message/signalproxy/objects/network.rs22
-rw-r--r--src/message/signalproxy/objects/networkconfig.rs67
3 files changed, 70 insertions, 21 deletions
diff --git a/src/message/signalproxy/objects/mod.rs b/src/message/signalproxy/objects/mod.rs
index b3b2858..0fb16c6 100644
--- a/src/message/signalproxy/objects/mod.rs
+++ b/src/message/signalproxy/objects/mod.rs
@@ -12,6 +12,7 @@ mod ignorelistmanager;
mod ircchannel;
mod ircuser;
mod network;
+mod networkconfig;
mod networkinfo;
pub use aliasmanager::*;
@@ -28,6 +29,7 @@ pub use ignorelistmanager::*;
pub use ircchannel::*;
pub use ircuser::*;
pub use network::*;
+pub use networkconfig::*;
pub use networkinfo::*;
use libquassel_derive::From;
diff --git a/src/message/signalproxy/objects/network.rs b/src/message/signalproxy/objects/network.rs
index a8a882d..9f0150f 100644
--- a/src/message/signalproxy/objects/network.rs
+++ b/src/message/signalproxy/objects/network.rs
@@ -5,7 +5,7 @@ use log::{error, warn};
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
-use libquassel_derive::{sync, NetworkList, NetworkMap, Setters};
+use libquassel_derive::{sync, NetworkMap, Setters};
use crate::error::ProtocolError;
use crate::message::signalproxy::translation::NetworkMap;
@@ -616,26 +616,6 @@ pub struct NetworkServer {
pub proxy_pass: String,
}
-#[derive(Debug, Clone, PartialEq, NetworkList)]
-pub struct NetworkConfig {
- #[network(rename = "pingTimeoutEnabled")]
- ping_timeout_enabled: bool,
- #[network(rename = "pingInterval")]
- ping_interval: i32,
- #[network(rename = "maxPingCount")]
- max_ping_count: i32,
- #[network(rename = "autoWhoEnabled")]
- auto_who_enabled: bool,
- #[network(rename = "autoWhoInterval")]
- auto_who_interval: i32,
- #[network(rename = "autoWhoNickLimit")]
- auto_who_nick_limit: i32,
- #[network(rename = "autoWhoDelay")]
- auto_who_delay: i32,
- #[network(rename = "standardCtcp")]
- standard_ctcp: bool,
-}
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/message/signalproxy/objects/networkconfig.rs b/src/message/signalproxy/objects/networkconfig.rs
new file mode 100644
index 0000000..c4f5397
--- /dev/null
+++ b/src/message/signalproxy/objects/networkconfig.rs
@@ -0,0 +1,67 @@
+use libquassel_derive::{NetworkList, NetworkMap, Setters};
+
+use crate::message::{Class, Syncable};
+
+#[derive(Debug, Default, Clone, PartialEq, NetworkList, NetworkMap, Setters)]
+pub struct NetworkConfig {
+ #[network(rename = "pingTimeoutEnabled")]
+ ping_timeout_enabled: bool,
+ #[network(rename = "pingInterval")]
+ ping_interval: i32,
+ #[network(rename = "maxPingCount")]
+ max_ping_count: i32,
+ #[network(rename = "autoWhoEnabled")]
+ auto_who_enabled: bool,
+ #[network(rename = "autoWhoInterval")]
+ auto_who_interval: i32,
+ #[network(rename = "autoWhoNickLimit")]
+ auto_who_nick_limit: i32,
+ #[network(rename = "autoWhoDelay")]
+ auto_who_delay: i32,
+ #[network(rename = "standardCtcp")]
+ standard_ctcp: bool,
+}
+
+impl Syncable for NetworkConfig {
+ const CLASS: Class = Class::NetworkConfig;
+}
+
+#[cfg(feature = "client")]
+impl crate::message::StatefulSyncableClient for NetworkConfig {
+ fn sync_custom(&mut self, mut msg: crate::message::SyncMessage)
+ where
+ Self: Sized,
+ {
+ match msg.slot_name.as_str() {
+ "setAutoWhoDelay" => self.set_auto_who_delay(get_param!(msg)),
+ "setAutoWhoEnabled" => self.set_auto_who_enabled(get_param!(msg)),
+ "setAutoWhoInterval" => self.set_auto_who_interval(get_param!(msg)),
+ "setAutoWhoNickLimit" => self.set_auto_who_nick_limit(get_param!(msg)),
+ "setMaxPingCount" => self.set_max_ping_count(get_param!(msg)),
+ "setPingInterval" => self.set_ping_interval(get_param!(msg)),
+ "setPingTimeoutEnabled" => self.set_ping_timeout_enabled(get_param!(msg)),
+ "setStandardCtcp" => self.set_standard_ctcp(get_param!(msg)),
+ _ => (),
+ }
+ }
+}
+
+#[cfg(feature = "server")]
+impl crate::message::StatefulSyncableServer for NetworkConfig {
+ fn sync_custom(&mut self, mut msg: crate::message::SyncMessage)
+ where
+ Self: Sized,
+ {
+ match msg.slot_name.as_str() {
+ "requestSetAutoWhoDelay" => self.set_auto_who_delay(get_param!(msg)),
+ "requestSetAutoWhoEnabled" => self.set_auto_who_enabled(get_param!(msg)),
+ "requestSetAutoWhoInterval" => self.set_auto_who_interval(get_param!(msg)),
+ "requestSetAutoWhoNickLimit" => self.set_auto_who_nick_limit(get_param!(msg)),
+ "requestSetMaxPingCount" => self.set_max_ping_count(get_param!(msg)),
+ "requestSetPingInterval" => self.set_ping_interval(get_param!(msg)),
+ "requestSetPingTimeoutEnabled" => self.set_ping_timeout_enabled(get_param!(msg)),
+ "requestSetStandardCtcp" => self.set_standard_ctcp(get_param!(msg)),
+ _ => (),
+ }
+ }
+}
on is much reduced 2025-02-26add MsgId and BufferId to objects where neededMax Audron-141/+157 some objects where still handling BufferId or MsgId as their raw types which lead to errors now that the Types are properly parsed in the varinats 2025-02-25enable transparent repr for msgid and bufferidMax Audron-0/+2 2025-02-25Implement BacklogManagerTobias Deiminger-59/+113 2025-02-25Use BufferId in BufferInfoTobias Deiminger-10/+11 2025-02-25Use BufferId in VariantTobias Deiminger-2/+33 2025-02-25Add BufferId as Rust typeTobias Deiminger-0/+39 Up to now it was represented as i32. If we introduce a newtype for it, we can handle it idiomatically as dedicated Variant::BufferId variant (instead of having it mashed into Variant::UserType). 2025-02-25Use MsgId in MessageTobias Deiminger-18/+6 2025-02-25Use MsgId in VariantTobias Deiminger-20/+37 2025-02-25Add MsgId as Rust typeTobias Deiminger-0/+56 Up to now it was handled implicitely in Variant::UserType. Making it an explicit type allows to centralize the i32/i64 cfg dependency and to use the type for arguments in signalproxy::objects functions. 2025-02-24added session manager comments and log messageMax Audron-1/+3 2025-02-23add identity syncable to SessionManagerMax Audron-1/+8 2025-02-23add syncables for IrcUserMax Audron-2/+53 2025-02-23move network config to it's own file and impl it's syncMax Audron-23/+84 2025-02-23add basic network syncablesMax Audron-39/+420 2025-02-23clean up unused_import and unused_variables a bitMax Audron-2/+8 2025-02-23fix server feature errorsMax Audron-28/+23 2025-02-23fix ircchannel and maplist network representationMax Audron-154/+137 2025-02-22replace deprecated failure crate with thiserrorMax Audron-278/+194 this changes the public API in that all our methods now return a proper ProtocolError crate. Needed change anyways to properly deal with all our errors in the long run. Will still need to do a pass through the crate to remove all existing unwraps where it makes sense. 2025-02-22update dependencies and fix errorsMax Audron-508/+332 2025-02-22update flakeMax Audron-94/+117 2024-05-22add todos to readmeMax Audron-16/+35