fix: make pst recipient_table optional

This commit is contained in:
rustmailer
2026-02-01 16:32:42 +08:00
parent ba8ecdd899
commit 57afa30b5b
4 changed files with 49 additions and 46 deletions
+7 -5
View File
@@ -1,5 +1,7 @@
use bichon::modules::cli::{
BichonCli, BichonCtlConfig, auth::verify_user_and_get_account, eml::handle_eml_directory_import, mbox::handle_mbox_single_file_import, pst::handle_pst_import, thunderbird::handle_thunderbird_import
auth::verify_user_and_get_account, eml::handle_eml_directory_import,
mbox::handle_mbox_single_file_import, pst::handle_pst_import,
thunderbird::handle_thunderbird_import, BichonCli, BichonCtlConfig,
};
use clap::Parser;
use console::style;
@@ -72,10 +74,10 @@ async fn main() {
let target_account_id = verify_user_and_get_account(&final_config, &theme).await;
let import_modes = &[
"EML: Scan directory recursively (Maintains folder structure)",
"MBOX: Single archive file (Stream from one file)",
"Thunderbird: Import from local profile directory",
"PST: Outlook Personal Storage (Single .pst file)",
"1. EML: Scan directory recursively (Maintains folder structure)",
"2. MBOX: Single archive file (Stream from one file)",
"3. Thunderbird: Import from local profile directory",
"4. PST: Outlook Personal Storage (Single .pst file)",
];
let mode_idx = Select::with_theme(&theme)
+27 -26
View File
@@ -342,38 +342,39 @@ fn extract_recipients_list(message: &Rc<dyn Message>) -> (Vec<String>, Vec<Strin
let mut bcc = Vec::new();
let recipient_table = message.recipient_table();
let context = recipient_table.context();
if let Some(recipient_table) = recipient_table {
let context = recipient_table.context();
for row in recipient_table.rows_matrix() {
if let Ok(cols) = row.columns(context) {
let mut r_type = 0;
let mut email = String::new();
for row in recipient_table.rows_matrix() {
if let Ok(cols) = row.columns(context) {
let mut r_type = 0;
let mut email = String::new();
for (col, val) in context.columns().iter().zip(cols) {
let prop_val = val
.as_ref()
.and_then(|v| recipient_table.read_column(v, col.prop_type()).ok());
match col.prop_id() {
0x0C15 => {
if let Some(PropertyValue::Integer32(t)) = prop_val {
r_type = t;
for (col, val) in context.columns().iter().zip(cols) {
let prop_val = val
.as_ref()
.and_then(|v| recipient_table.read_column(v, col.prop_type()).ok());
match col.prop_id() {
0x0C15 => {
if let Some(PropertyValue::Integer32(t)) = prop_val {
r_type = t;
}
}
}
0x39FE | 0x3003 => {
if let Some(s) = prop_val.and_then(|v| extract_string(&v)) {
email = s;
0x39FE | 0x3003 => {
if let Some(s) = prop_val.and_then(|v| extract_string(&v)) {
email = s;
}
}
_ => {}
}
_ => {}
}
}
if !email.is_empty() {
match r_type {
1 => to.push(email),
2 => cc.push(email),
3 => bcc.push(email),
_ => {}
if !email.is_empty() {
match r_type {
1 => to.push(email),
2 => cc.push(email),
3 => bcc.push(email),
_ => {}
}
}
}
}