switch to quoted-printable, which is already used by mailparse

This commit is contained in:
dignifiedquire
2019-12-05 13:23:31 +01:00
committed by holger krekel
parent c2e8cc9bd6
commit 3b8e37de58
3 changed files with 7 additions and 14 deletions

8
Cargo.lock generated
View File

@@ -639,12 +639,12 @@ dependencies = [
"pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-xml 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quoted_printable 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2_sqlite 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rfc2047 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustyline 4.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2287,11 +2287,6 @@ dependencies = [
"winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rfc2047"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ring"
version = "0.16.9"
@@ -3597,7 +3592,6 @@ dependencies = [
"checksum rental 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f"
"checksum rental-impl 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de"
"checksum reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650"
"checksum rfc2047 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6986b5de4fa30c92b50020fdedf45bf9296d9842df4355b62f92dcc18bcdee15"
"checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac"
"checksum ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad5112e0dbbb87577bfbc56c42450235e3012ce336e29c5befd7807bd626da4a"
"checksum rsa 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5108a8bbfb84fe77d829d77d5a89255dcd189dfe5c4de5a33d0a47f12808bb15"

View File

@@ -19,7 +19,6 @@ num-derive = "0.2.5"
num-traits = "0.2.6"
lettre = { git = "https://github.com/deltachat/lettre", branch = "feat/mail" }
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "feat/mail" }
rfc2047 = "0.1.1"
async-imap = { git = "https://github.com/async-email/async-imap", branch="master" }
async-tls = "0.6"
async-std = { version = "1.0", features = ["unstable"] }
@@ -55,6 +54,7 @@ rustls = "0.16.0"
webpki-roots = "0.18.0"
webpki = "0.21.0"
mailparse = "0.10.1"
quoted_printable = "0.4.1"
[dev-dependencies]
tempfile = "3.0"

View File

@@ -1,6 +1,5 @@
use chrono::TimeZone;
use lettre_email::{mime, Address, Header, MimeMultipartType, PartBuilder};
use rfc2047::rfc2047_encode;
use crate::chat::{self, Chat};
use crate::config::Config;
@@ -383,7 +382,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
let mut unprotected_headers: Vec<Header> = Vec::new();
let from = Address::new_mailbox_with_name(
rfc2047_encode(&self.from_displayname).into_owned(),
quoted_printable::encode_to_str(&self.from_displayname),
self.from_addr.clone(),
);
@@ -395,7 +394,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
to.push(Address::new_mailbox(addr.clone()));
} else {
to.push(Address::new_mailbox_with_name(
rfc2047_encode(name).into_owned(),
quoted_printable::encode_to_str(name),
addr.clone(),
));
}
@@ -451,7 +450,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
let e2ee_guranteed = self.is_e2ee_guranteed();
let mut encrypt_helper = EncryptHelper::new(self.context)?;
let subject = rfc2047_encode(&subject_str).into_owned();
let subject = quoted_printable::encode_to_str(&subject_str);
let mut message = match self.loaded {
Loaded::Message => {
@@ -611,7 +610,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup {
protected_headers.push(Header::new("Chat-Group-ID".into(), chat.grpid.clone()));
let encoded = rfc2047_encode(&chat.name).into_owned();
let encoded = quoted_printable::encode_to_str(&chat.name);
protected_headers.push(Header::new("Chat-Group-Name".into(), encoded));
match command {
@@ -994,7 +993,7 @@ fn build_body_file(
// XXX do we need to encode filenames?
format!(
"attachment; filename*=\"{}\"",
rfc2047_encode(&filename_to_send)
quoted_printable::encode_to_str(&filename_to_send)
)
};