message: remove x-ms-has-attach check

Apparently, it's not very useful (marks sigs as attachments).
pull/2275/head
Dirk-Jan C. Binnema 8 months ago
parent f69ad37e7a
commit 1f9172a008
  1. 10
      lib/message/mu-message.cc
  2. 43
      lib/message/test-mu-message.cc

@ -533,16 +533,6 @@ process_message(const MimeMessage& mime_msg, const std::string& path,
info.mailing_list = get_mailing_list(mime_msg);
if (info.mailing_list)
info.flags |= Flags::MailingList;
// Microsoft override; outlook message can tell us directly
// wther
const auto ms_atthdr{mime_msg.header("X-MS-Has-Attach")};
if (ms_atthdr) {
if (*ms_atthdr == "yes")
info.flags |= Flags::HasAttachment;
else
info.flags &= ~Flags::HasAttachment;
}
}
static Mu::Result<std::string>

@ -570,46 +570,6 @@ Moi,
part.mime_type().value_or("boo").c_str());
}
static void
test_message_ms_attach()
{
const std::string msgtext =
R"(Date: Thu, 31 Jul 2008 14:57:25 -0400
From: "John Milton" <jm@example.com>
Subject: Fere libenter homines id quod volunt credunt
To: "Julius Caesar" <jc@example.com>
Message-id: <3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com>
X-MS-Has-Attach:
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
With loss of Eden, till one greater Man
)";
{
auto message{Message::make_from_text(msgtext)};
g_assert_true(!!message);
g_assert_true(message->flags() == (Flags::None));
}
{
const auto text2 = std::regex_replace(
msgtext, std::regex{"X-MS-Has-Attach:"},
"X-MS-Has-Attach: yes");
g_message("%s", text2.c_str());
auto message{Message::make_from_text(text2)};
g_assert_true(!!message);
g_assert_true(message->flags() == (Flags::HasAttachment));
}
}
static void
test_message_calendar(void)
@ -880,13 +840,10 @@ main(int argc, char* argv[])
test_message_multipart_mixed_rfc822);
g_test_add_func("/message/message/detect-attachment",
test_message_detect_attachment);
g_test_add_func("/message/message/x-ms-has-attach",
test_message_ms_attach);
g_test_add_func("/message/message/calendar",
test_message_calendar);
g_test_add_func("/message/message/fail",
test_message_fail);
return g_test_run();
}

Loading…
Cancel
Save