aboutsummaryrefslogtreecommitdiff
path: root/src/message/signalproxy/objects
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-12-02 18:40:38 +0100
committerMax Audron <audron@cocaine.farm>2021-12-02 18:44:46 +0100
commit459944eaa35223f2094a9f61c04dea48e58b6367 (patch)
tree713c339d865788dcf402bf3196fc2bce7d910cd7 /src/message/signalproxy/objects
parentupgrade to rust 2021 edition (diff)
add certmanager impl
Diffstat (limited to 'src/message/signalproxy/objects')
-rw-r--r--src/message/signalproxy/objects/certmanager.rs62
1 files changed, 43 insertions, 19 deletions
diff --git a/src/message/signalproxy/objects/certmanager.rs b/src/message/signalproxy/objects/certmanager.rs
index d105fcf..c82d06c 100644
--- a/src/message/signalproxy/objects/certmanager.rs
+++ b/src/message/signalproxy/objects/certmanager.rs
@@ -1,26 +1,50 @@
-use libquassel_derive::NetworkList;
+use libquassel_derive::{NetworkList, NetworkMap};
-#[derive(Debug, Clone, PartialEq, NetworkList)]
+use crate::message::Syncable;
+#[allow(unused_imports)]
+use crate::primitive::Variant;
+
+#[derive(Debug, Clone, PartialEq, NetworkList, NetworkMap)]
pub struct CertManager {
#[network(rename = "sslKey", variant = "ByteArray")]
pub ssl_key: String,
#[network(rename = "sslCert", variant = "ByteArray")]
pub ssl_cert: String,
- // // C->S calls
-
- // /**
- // * Replaces all properties of the object with the content of the
- // * "properties" parameter. This parameter is in network representation.
- // */
- // requestUpdate(properties: QVariantMap)
-
- // // S->C calls
-
- // setSslCert(encoded: QByteBuffer | null)
- // setSslKey(encoded: QByteBuffer | null)
- // /**
- // * Replaces all properties of the object with the content of the
- // * "properties" parameter. This parameter is in network representation.
- // */
- // update(properties: QVariantMap)
+}
+
+impl CertManager {
+ pub fn set_ssl_cert(&mut self, cert: String) {
+ #[cfg(feature = "server")]
+ self.send_sync("setSslCert", vec![Variant::ByteArray(cert.clone())]);
+
+ self.ssl_cert = cert;
+ }
+
+ pub fn set_ssl_key(&mut self, key: String) {
+ #[cfg(feature = "server")]
+ self.send_sync("setSslKey", vec![Variant::ByteArray(key.clone())]);
+
+ self.ssl_key = key;
+ }
+}
+
+#[cfg(feature = "client")]
+impl crate::message::StatefulSyncableClient for CertManager {
+ fn sync_custom(&mut self, mut msg: crate::message::SyncMessage)
+ where
+ Self: Sized,
+ {
+ match msg.slot_name.as_str() {
+ "setSslCert" => self.set_ssl_cert(get_param!(msg)),
+ "setSslKey" => self.set_ssl_key(get_param!(msg)),
+ _ => (),
+ }
+ }
+}
+
+#[cfg(feature = "server")]
+impl crate::message::StatefulSyncableServer for CertManager {}
+
+impl Syncable for CertManager {
+ const CLASS: &'static str = "CertManager";
}
>+66 2021-07-21change IRC MessageType to be a bitflag instead of enumMax Audron-54/+94 the BufferSyncer object uses this type in a bitflag manner to indicate all the kinds of change that happened. bitflag still allows very enum esque usage so the change is okay for the Message object. 2021-07-21fix network objectMax Audron-18/+24 2021-07-21minor docs and cleanupMax Audron-4/+8 2021-04-05WIP: impl more signalproxy objectsMax Audron-1000/+1621 2021-03-09WIP: impl signalproxy typesMax Audron-253/+376 2021-01-21add to and from network deriveMax Audron-42/+2767 2021-01-21reorganize tests and add quassel featuresMax Audron-551/+850 2021-01-04add example program: quasselproxyclientMax Audron-0/+280 and inspection proxy for quassel 2021-01-04random stuffMax Audron-2/+9 2021-01-04add more signalproxy objectsMax Audron-40/+120 2021-01-04add message parsing feature flagsMax Audron-43/+96 2021-01-04fix parsing of datetime when value is -1Max Audron-1/+9 2021-01-02update dependenciesMax Audron-267/+27 2021-01-02rework handshakemessage parsingMax Audron-141/+278 2020-10-16updateMax Audron-1553/+294 2020-10-16update paperworkMax Audron-487/+391