mirror of https://github.com/djcb/mu.git
mime-object: ensure init_gmime is called
Was missing in some paths
This commit is contained in:
parent
6126d7ee62
commit
4b56b8779d
|
@ -219,6 +219,7 @@ MimeCryptoContext::setup_gpg_test(const std::string& testpath)
|
||||||
static Result<MimeMessage>
|
static Result<MimeMessage>
|
||||||
make_from_stream(GMimeStream* &&stream/*consume*/)
|
make_from_stream(GMimeStream* &&stream/*consume*/)
|
||||||
{
|
{
|
||||||
|
init_gmime();
|
||||||
GMimeParser *parser{g_mime_parser_new_with_stream(stream)};
|
GMimeParser *parser{g_mime_parser_new_with_stream(stream)};
|
||||||
g_object_unref(stream);
|
g_object_unref(stream);
|
||||||
if (!parser)
|
if (!parser)
|
||||||
|
@ -239,6 +240,7 @@ Result<MimeMessage>
|
||||||
MimeMessage::make_from_file(const std::string& path)
|
MimeMessage::make_from_file(const std::string& path)
|
||||||
{
|
{
|
||||||
GError* err{};
|
GError* err{};
|
||||||
|
init_gmime();
|
||||||
if (auto&& stream{g_mime_stream_file_open(path.c_str(), "r", &err)}; !stream)
|
if (auto&& stream{g_mime_stream_file_open(path.c_str(), "r", &err)}; !stream)
|
||||||
return Err(Error::Code::Message, &err,
|
return Err(Error::Code::Message, &err,
|
||||||
"failed to open stream for %s", path.c_str());
|
"failed to open stream for %s", path.c_str());
|
||||||
|
@ -249,6 +251,7 @@ MimeMessage::make_from_file(const std::string& path)
|
||||||
Result<MimeMessage>
|
Result<MimeMessage>
|
||||||
MimeMessage::make_from_text(const std::string& text)
|
MimeMessage::make_from_text(const std::string& text)
|
||||||
{
|
{
|
||||||
|
init_gmime();
|
||||||
if (auto&& stream{g_mime_stream_mem_new_with_buffer(
|
if (auto&& stream{g_mime_stream_mem_new_with_buffer(
|
||||||
text.c_str(), text.length())}; !stream)
|
text.c_str(), text.length())}; !stream)
|
||||||
return Err(Error::Code::Message,
|
return Err(Error::Code::Message,
|
||||||
|
|
Loading…
Reference in New Issue