aboutsummaryrefslogtreecommitdiff
path: root/src/message/signalproxy/objects/network.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/message/signalproxy/objects/network.rs39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/message/signalproxy/objects/network.rs b/src/message/signalproxy/objects/network.rs
index a606537..3d2ee8b 100644
--- a/src/message/signalproxy/objects/network.rs
+++ b/src/message/signalproxy/objects/network.rs
@@ -71,23 +71,19 @@ impl Network {
let default_prefixes = vec!['~', '&', '@', '%', '+'];
let default_prefix_modes = vec!['q', 'a', 'o', 'h', 'v'];
- match self.supports.get("PREFIX") {
- Some(prefix) => {
- if prefix.starts_with('(') {
- let (prefix_modes, prefixes) = prefix[1..].split_once(')').unwrap();
-
- self.prefix_modes = prefix_modes.chars().collect();
- self.prefixes = prefixes.chars().collect();
- } else {
- self.prefixes = default_prefixes;
- self.prefix_modes = default_prefix_modes;
- }
- }
- None => {
- self.prefixes = default_prefixes;
- self.prefix_modes = default_prefix_modes;
+ if let Some(prefix) = self.supports.get("PREFIX") {
+ if let Some(prefix) = prefix.strip_prefix('(') {
+ let (prefix_modes, prefixes) = prefix.split_once(')').unwrap();
+
+ self.prefix_modes = prefix_modes.chars().collect();
+ self.prefixes = prefixes.chars().collect();
+
+ return;
}
}
+
+ self.prefixes = default_prefixes;
+ self.prefix_modes = default_prefix_modes;
}
pub fn add_channel(&mut self, name: &str, channel: IrcChannel) {
@@ -280,6 +276,7 @@ impl crate::message::StatefulSyncableServer for Network {
impl crate::message::signalproxy::NetworkList for Network {
fn to_network_list(&self) -> VariantList {
+ #![allow(clippy::vec_init_then_push)]
let mut res = VariantList::new();
res.push(Variant::ByteArray(s!("myNick")));
@@ -449,7 +446,7 @@ impl crate::message::signalproxy::NetworkList for Network {
network.determine_channel_mode_types();
network.determine_prefixes();
- return network;
+ network
}
}
@@ -526,7 +523,7 @@ impl crate::message::signalproxy::NetworkMap for Network {
res.extend(self.network_info.to_network_map());
- return res;
+ res
}
fn from_network_map(input: &mut Self::Item) -> Self {
@@ -648,7 +645,7 @@ impl Deserialize for NetworkServer {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
@@ -802,9 +799,9 @@ impl Default for ConnectionState {
}
}
-impl Into<Variant> for ConnectionState {
- fn into(self) -> Variant {
- Variant::i32(self.to_i32().unwrap())
+impl From<ConnectionState> for Variant {
+ fn from(val: ConnectionState) -> Self {
+ Variant::i32(val.to_i32().unwrap())
}
}
an class='deletions'>-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