summaryrefslogtreecommitdiffstats
path: root/melib/src/email/attachment_types.rs
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-25 22:00:30 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-26 13:10:06 +0300
commit9305e543cf04ee2e53c989d2f29a6ea0b57092c4 (patch)
tree9b59f34505b0825ae6e8d003a190a8f3c30aac72 /melib/src/email/attachment_types.rs
parent5a53020f3d2d7819c5c24871d2dd126c5a2ec84c (diff)
melib: add a `body` field to Attachment
Attachment needs to know the range of bytes where the body part of the attachment is located. The Attachment.raw field contains the entire attachment, headers and body. The new Attachment.body fields contains a `StrBuilder` which contains the offset and length of the body part inside `raw`.
Diffstat (limited to 'melib/src/email/attachment_types.rs')
-rw-r--r--melib/src/email/attachment_types.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/melib/src/email/attachment_types.rs b/melib/src/email/attachment_types.rs
index 307474d5..f5287df6 100644
--- a/melib/src/email/attachment_types.rs
+++ b/melib/src/email/attachment_types.rs
@@ -20,6 +20,7 @@
*/
use crate::email::attachments::{Attachment, AttachmentBuilder};
use crate::email::parser::BytesExt;
+
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::str;
@@ -123,7 +124,7 @@ pub enum ContentType {
Multipart {
boundary: Vec<u8>,
kind: MultipartType,
- subattachments: Vec<Attachment>,
+ parts: Vec<Attachment>,
},
MessageRfc822,
PGPSignature,
@@ -178,7 +179,7 @@ impl ContentType {
}
}
- pub fn make_boundary(subattachments: &Vec<AttachmentBuilder>) -> String {
+ pub fn make_boundary(parts: &Vec<AttachmentBuilder>) -> String {
use crate::email::compose::random::gen_boundary;
let mut boundary = "bzz_bzz__bzz__".to_string();
let mut random_boundary = gen_boundary();
@@ -186,7 +187,7 @@ impl ContentType {
let mut loop_counter = 4096;
'loo: loop {
let mut flag = true;
- for sub in subattachments {
+ for sub in parts {
'sub_loop: loop {
if sub.raw().find(random_boundary.as_bytes()).is_some() {
random_boundary = gen_boundary();