From 60fdc40a21426a12f239cb3f58ab417ec2fc3a66 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 01:49:11 +0100 Subject: [PATCH] Fix incorrect room name in url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I naïvely implemented Display for RoomIdentifier, which lead to me passing room names like "&test@euphoria.leet.nu" to euphoxide instead of "test". Of course, no room of that name exists, so every attempted connection failed. To figure this out, I manually relaxed the verbosity filters to let through all euphoxide log messages and recompiled. Only implementing Debug led to compile errors whereever I misused the Disply instance, so at least the bug fix was nice and easy once I knew what happened. --- cove/src/euph/room.rs | 2 +- cove/src/ui/euph/room.rs | 4 ++-- cove/src/vault/euph.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 22bebb1..6ae3a17 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -187,7 +187,7 @@ impl Room { None => None, }; - debug!("{}: requesting logs", vault.room()); + debug!("{:?}: requesting logs", vault.room()); // &rl2dev's message history is broken and requesting old messages past // a certain point results in errors. By reducing the amount of messages diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 30d40a8..e27e2b6 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -101,8 +101,8 @@ impl EuphRoom { let instance_config = self .server_config .clone() - .room(self.vault().room().to_string()) - .name(format!("{room}-{}", next_instance_id)) + .room(self.vault().room().name.clone()) + .name(format!("{room:?}-{}", next_instance_id)) .human(true) .username(self.room_config.username.clone()) .force_username(self.room_config.force_username) diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 7a5ec3f..0e84ba1 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -46,13 +46,13 @@ impl FromSql for WTime { } } -#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct RoomIdentifier { pub domain: String, pub name: String, } -impl fmt::Display for RoomIdentifier { +impl fmt::Debug for RoomIdentifier { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "&{}@{}", self.name, self.domain) }