From 989cfcc8778c840b0ca76e7dae71637a5ad990e7 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 24 Jul 2020 22:10:39 +0300 Subject: [PATCH] conf/accounts.rs: use mailbox alias if available in MailboxEntry::name() --- src/components/mail/listing.rs | 5 +++-- src/conf/accounts.rs | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs index 475a34f7..ddb7f95d 100644 --- a/src/components/mail/listing.rs +++ b/src/components/mail/listing.rs @@ -1165,7 +1165,8 @@ impl Component for Listing { match account[&mailbox_hash].status { MailboxStatus::Available | MailboxStatus::Parsing(_, _) => format!( "Mailbox: {}, Messages: {}, New: {}", - account[&mailbox_hash].ref_mailbox.name(), + account[&mailbox_hash].name(), + // FIXME account.collection.get_mailbox(mailbox_hash).len(), account[&mailbox_hash] .ref_mailbox @@ -1412,7 +1413,7 @@ impl Listing { None, ); let (x, _) = write_string_to_grid( - mailboxes[&mailbox_idx].name(), + context.accounts[a.index].mailbox_entries[&mailbox_idx].name(), grid, att.fg, att.bg, diff --git a/src/conf/accounts.rs b/src/conf/accounts.rs index 1f40b3b4..03702e1c 100644 --- a/src/conf/accounts.rs +++ b/src/conf/accounts.rs @@ -130,7 +130,11 @@ impl MailboxEntry { } pub fn name(&self) -> &str { - &self.name + if let Some(name) = self.conf.mailbox_conf.alias.as_ref() { + name + } else { + &self.ref_mailbox.name() + } } }