|
|
|
@ -211,6 +211,7 @@ impl AttachmentBuilder {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let body_slice = {
|
|
|
|
|
let offset = (body.as_ptr() as usize).wrapping_sub(a.as_ptr() as usize);
|
|
|
|
|
SliceBuild::new(offset, body.len())
|
|
|
|
@ -298,7 +299,6 @@ impl Attachment {
|
|
|
|
|
MultipartType::Mixed | MultipartType::Digest => {
|
|
|
|
|
for a in sub_att_vec {
|
|
|
|
|
a.get_text_recursive(text);
|
|
|
|
|
text.extend_from_slice(b"\n\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -325,7 +325,7 @@ impl Attachment {
|
|
|
|
|
..
|
|
|
|
|
} => {
|
|
|
|
|
ret.push(att.clone());
|
|
|
|
|
// TODO: Fix this, wrong count
|
|
|
|
|
// FIXME: Wrong count
|
|
|
|
|
for a in sub_att_vec {
|
|
|
|
|
count_recursive(a, ret);
|
|
|
|
|
}
|
|
|
|
@ -356,11 +356,13 @@ impl Attachment {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn interpret_format_flowed(_t: &str) -> String {
|
|
|
|
|
//let mut n = String::with_capacity(t.len());
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn decode_rfc822(_raw: &[u8]) -> Attachment {
|
|
|
|
|
let builder = AttachmentBuilder::new(b"");
|
|
|
|
|
builder.build()
|
|
|
|
@ -382,6 +384,7 @@ fn decode_rfc822(_raw: &[u8]) -> Attachment {
|
|
|
|
|
|
|
|
|
|
type Filter = Box<Fn(&Attachment, &mut Vec<u8>) -> ()>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn decode_rec_helper(a: &Attachment, filter: &Option<Filter>) -> Vec<u8> {
|
|
|
|
|
let mut ret = match a.content_type {
|
|
|
|
|
ContentType::Unsupported { .. } => Vec::new(),
|
|
|
|
@ -405,7 +408,6 @@ fn decode_rec_helper(a: &Attachment, filter: &Option<Filter>) -> Vec<u8> {
|
|
|
|
|
let mut vec = Vec::new();
|
|
|
|
|
for a in sub_att_vec {
|
|
|
|
|
vec.extend(decode_rec_helper(a, filter));
|
|
|
|
|
vec.extend_from_slice(b"\n\n");
|
|
|
|
|
}
|
|
|
|
|
vec
|
|
|
|
|
},
|
|
|
|
@ -415,9 +417,13 @@ fn decode_rec_helper(a: &Attachment, filter: &Option<Filter>) -> Vec<u8> {
|
|
|
|
|
}
|
|
|
|
|
ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn decode_rec(a: &Attachment, filter: Option<Filter>) -> Vec<u8> {
|
|
|
|
|
decode_rec_helper(a, &filter)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn decode_helper(a: &Attachment, filter: &Option<Filter>) -> Vec<u8> {
|
|
|
|
|
let charset = match a.content_type {
|
|
|
|
|
ContentType::Text { charset: c, .. } => c,
|
|
|
|
@ -452,6 +458,8 @@ fn decode_helper(a: &Attachment, filter: &Option<Filter>) -> Vec<u8> {
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn decode(a: &Attachment, filter: Option<Filter>) -> Vec<u8> {
|
|
|
|
|
decode_helper(a, &filter)
|
|
|
|
|
}
|
|
|
|
|