const auto *p = in.data();
const auto *end = p + in.size();
+ /* Skip spaces */
while (p < end && g_ascii_isspace (*p)) {
p++;
}
+ /* And SMTP comments */
+ if (*p == '(') {
+ auto obraces = 0, ebraces = 0;
+
+ while (p < end) {
+ if (*p == ')') {
+ ebraces ++;
+ }
+ else if (*p == '(') {
+ obraces ++;
+ }
+
+ p ++;
+
+ if (obraces == ebraces) {
+ /* Skip spaces after */
+ while (p < end && g_ascii_isspace (*p)) {
+ p++;
+ }
+ break;
+ }
+ }
+ }
+
auto len = end - p;
+ if (len == 0) {
+ return {};
+ }
+
auto maybe_process_part = [&](received_part_type what) -> bool {
parts.emplace_back(what);
auto &rcvd_part = parts.back();
{"by_hostname", "mail.832zsu.cn"},
}
},
+ // From part is in the comment
+ {"(from asterisk@localhost)\n"
+ " by pbx.xxx.com (8.14.7/8.14.7/Submit) id 076Go4wD014562;\n"
+ " Thu, 6 Aug 2020 11:50:04 -0500"sv,
+ {
+ {"by_hostname", "pbx.xxx.com"},
+ }
+ },
};
rspamd_mempool_t *pool = rspamd_mempool_new_default("rcvd test", 0);