-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch mailparsing to mailparse #904
Conversation
dc9d85e
to
0bc755c
Compare
@dignifiedquire Remove This file alone adds 3k lines |
f01ed5d
to
19afe31
Compare
just played around a bit, i could sent out unencrypted mails! whats came over my way is that the |
9f3bcb0
to
62a2f70
Compare
#[fail(display = "Building invalid Email: {:?}", _0)] | ||
LettreError(#[cause] lettre_email::error::Error), | ||
#[fail(display = "FromStr error: {:?}", _0)] | ||
FromStr(#[cause] mime::FromStrError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsafe { | ||
dc_receive_imf(context, &body, folder.as_ref(), server_uid, flags as u32); | ||
} | ||
dc_receive_imf(context, &body, folder.as_ref(), server_uid, flags as u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w.o.n.d.e.r.full :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incredible. awesome. just great.
.body(encrypted) | ||
.build(), | ||
) | ||
.header(("Subject".to_string(), "...".to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful 💯
src/mimeparser.rs
Outdated
|
||
if let Some(raw) = raw { | ||
mail_raw = raw; | ||
info!(context, "decrypted: {:?}", std::str::from_utf8(&mail_raw)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this not crash if the mail_raw is invalid utf8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can, and it should not be there, I need to go and cleanup all my debugging logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there many debugging logs? I think what's more important is going through all from_utf8
if any.
src/mimeparser.rs
Outdated
// Handle gossip headers | ||
let gossip_headers = mail.headers.get_all_values("Autocrypt-Gossip")?; | ||
parser.gossipped_addr = | ||
update_gossip_peerstates(context, message_time, &mail, gossip_headers)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems wrong. We can only use and process gossip headers if they are in the encrypted part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great to me. Remaining from my side:
- check all utf8 handling (maybe also in mailparse).
- move the gossip header updates into the decryption part
ead3e05
to
1c5a3e6
Compare
This uses
mailparse
for parsing and `lettre_email for mime generation.mime
, instead of manually parsing content types inmimeparser.rs
mimeparser.rs