Skip to content

Commit 595258a

Browse files
authored
fix add multi-transport information to Context.get_info (#7583)
This adds information of all used transports to `Context.get_info` in the key `used_transport_settings`. The format is the same as in `used_account_settings`. The new property also contains the primary account, so we could remove `used_account_settings` now, though there is also `entered_account_settings` in which it stays in relation. - there is an alternative pr at #7584, which gives each transport it's own key, which improves readability. closes #7581
1 parent 06b2a89 commit 595258a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/context.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,16 @@ impl Context {
822822
|(_transport_id, param)| param.to_string(),
823823
);
824824
let secondary_addrs = self.get_secondary_self_addrs().await?.join(", ");
825+
let all_transports: Vec<String> = ConfiguredLoginParam::load_all(self)
826+
.await?
827+
.into_iter()
828+
.map(|(transport_id, param)| format!("{transport_id}: {param}"))
829+
.collect();
830+
let all_transports = if all_transports.is_empty() {
831+
"Not configured".to_string()
832+
} else {
833+
all_transports.join(",")
834+
};
825835
let chats = get_chat_cnt(self).await?;
826836
let unblocked_msgs = message::get_unblocked_msg_cnt(self).await;
827837
let request_msgs = message::get_request_msg_cnt(self).await;
@@ -902,6 +912,7 @@ impl Context {
902912
res.insert("proxy_enabled", proxy_enabled.to_string());
903913
res.insert("entered_account_settings", l.to_string());
904914
res.insert("used_account_settings", l2);
915+
res.insert("used_transport_settings", all_transports);
905916

906917
if let Some(server_id) = &*self.server_id.read().await {
907918
res.insert("imap_server_id", format!("{server_id:?}"));

0 commit comments

Comments
 (0)