mirror of https://github.com/djcb/mu.git
server/message-part: restore forwarding attachments
This commit is contained in:
parent
62e546a4e2
commit
e0d047105b
|
@ -95,6 +95,15 @@ MessagePart::mime_type() const noexcept
|
||||||
return Nothing;
|
return Nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Option<std::string>
|
||||||
|
MessagePart::content_description() const noexcept
|
||||||
|
{
|
||||||
|
if (!mime_object().is_part())
|
||||||
|
return Nothing;
|
||||||
|
else
|
||||||
|
return MimePart{mime_object()}.content_description();
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
MessagePart::size() const noexcept
|
MessagePart::size() const noexcept
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,14 @@ public:
|
||||||
*/
|
*/
|
||||||
Option<std::string> mime_type() const noexcept;
|
Option<std::string> mime_type() const noexcept;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the content description for this part, or Nothing
|
||||||
|
*
|
||||||
|
* @return the content description
|
||||||
|
*/
|
||||||
|
Option<std::string> content_description() const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of the (unencoded) MIME-part.
|
* Get the length of the (unencoded) MIME-part.
|
||||||
*
|
*
|
||||||
|
|
|
@ -456,9 +456,14 @@ maybe_add_attachment(Message& message, const MessagePart& part, size_t index)
|
||||||
throw res.error();
|
throw res.error();
|
||||||
|
|
||||||
Sexp::List pi;
|
Sexp::List pi;
|
||||||
pi.add_prop(":file-name", Sexp::make_string(*cache_path));
|
|
||||||
pi.add_prop(":mime-type", Sexp::make_string(part.mime_type()
|
if (auto cdescr = part.content_description(); cdescr)
|
||||||
.value_or("application/data")));
|
pi.add_prop(":description", Sexp::make_string(*cdescr));
|
||||||
|
|
||||||
|
pi.add_prop(":file-name", Sexp::make_string(fname));
|
||||||
|
pi.add_prop(":mime-type", Sexp::make_string(
|
||||||
|
part.mime_type().value_or("application/octet-stream")));
|
||||||
|
|
||||||
return Some(Sexp::make_list(std::move(pi)));
|
return Some(Sexp::make_list(std::move(pi)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,9 +498,12 @@ Server::Private::compose_handler(const Parameters& params)
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!attseq.empty())
|
if (!attseq.empty()) {
|
||||||
comp_lst.add_prop(":include",
|
comp_lst.add_prop(":include",
|
||||||
Sexp::make_list(std::move(attseq)));
|
Sexp::make_list(std::move(attseq)));
|
||||||
|
comp_lst.add_prop(":cache-path",
|
||||||
|
Sexp::make_string(*msg->cache_path()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ctype != "new")
|
} else if (ctype != "new")
|
||||||
|
|
Loading…
Reference in New Issue