Skip to content

Commit 06b2a89

Browse files
authored
fix: multi-transport: all transports were shown as "inbox" in connectivity view, now they are shown by their hostname (#7582)
closes #7580
1 parent 95ed313 commit 06b2a89

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/scheduler.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ impl Drop for IoPausedGuard {
325325

326326
#[derive(Debug)]
327327
struct SchedBox {
328+
/// Hostname of used chatmail/email relay
329+
host: String,
328330
meaning: FolderMeaning,
329331
conn_state: ImapConnectionState,
330332

@@ -881,7 +883,14 @@ impl Scheduler {
881883
let ctx = ctx.clone();
882884
task::spawn(inbox_loop(ctx, inbox_start_send, inbox_handlers))
883885
};
886+
let host = configured_login_param
887+
.addr
888+
.split("@")
889+
.last()
890+
.context("address has no host")?
891+
.to_owned();
884892
let inbox = SchedBox {
893+
host: host.clone(),
885894
meaning: FolderMeaning::Inbox,
886895
conn_state,
887896
handle,
@@ -897,6 +906,7 @@ impl Scheduler {
897906
let meaning = FolderMeaning::Mvbox;
898907
let handle = task::spawn(simple_imap_loop(ctx, start_send, handlers, meaning));
899908
oboxes.push(SchedBox {
909+
host,
900910
meaning,
901911
conn_state,
902912
handle,

src/scheduler/connectivity.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,13 @@ impl Context {
373373
InnerSchedulerState::Started(ref sched) => (
374374
sched
375375
.boxes()
376-
.map(|b| (b.meaning, b.conn_state.state.connectivity.clone()))
376+
.map(|b| {
377+
(
378+
b.host.clone(),
379+
b.meaning,
380+
b.conn_state.state.connectivity.clone(),
381+
)
382+
})
377383
.collect::<Vec<_>>(),
378384
sched.smtp.state.connectivity.clone(),
379385
),
@@ -396,7 +402,7 @@ impl Context {
396402
let watched_folders = get_watched_folder_configs(self).await?;
397403
let incoming_messages = stock_str::incoming_messages(self).await;
398404
ret += &format!("<h3>{incoming_messages}</h3><ul>");
399-
for (folder, state) in &folders_states {
405+
for (host, folder, state) in &folders_states {
400406
let mut folder_added = false;
401407

402408
if let Some(config) = folder.to_config().filter(|c| watched_folders.contains(c)) {
@@ -407,7 +413,11 @@ impl Context {
407413
ret += "<li>";
408414
ret += &*detailed.to_icon();
409415
ret += " <b>";
410-
ret += &*escaper::encode_minimal(&foldername);
416+
if folder == &FolderMeaning::Inbox {
417+
ret += &*escaper::encode_minimal(host);
418+
} else {
419+
ret += &*escaper::encode_minimal(&foldername);
420+
}
411421
ret += ":</b> ";
412422
ret += &*escaper::encode_minimal(&detailed.to_string_imap(self).await);
413423
ret += "</li>";

0 commit comments

Comments
 (0)