Преглед изворни кода

Merge pull request #4933 from rspamd/vstakhov-utf8-received

Support UTF8 flag for the received headers
pull/4935/head
Vsevolod Stakhov пре 4 недеља
родитељ
комит
13899e1786
No account linked to committer's email address
2 измењених фајлова са 20 додато и 6 уклоњено
  1. 16
    3
      src/libmime/received.cxx
  2. 4
    3
      src/libmime/received.hxx

+ 16
- 3
src/libmime/received.cxx Прегледај датотеку

/*-
* Copyright 2021 Vsevolod Stakhov
/*
* Copyright 2024 Vsevolod Stakhov
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,


static constexpr const auto protos_map = frozen::make_unordered_map<frozen::string, received_flags>({{"smtp", received_flags::SMTP}, static constexpr const auto protos_map = frozen::make_unordered_map<frozen::string, received_flags>({{"smtp", received_flags::SMTP},
{"esmtp", received_flags::ESMTP}, {"esmtp", received_flags::ESMTP},
{"utf8esmtp", received_flags::ESMTP |
received_flags::UTF8},
{"esmtpa", received_flags::ESMTPA | {"esmtpa", received_flags::ESMTPA |
received_flags::AUTHENTICATED}, received_flags::AUTHENTICATED},
{"utf8esmtpa", received_flags::ESMTPA |
received_flags::AUTHENTICATED |
received_flags::UTF8},
{"esmtpsa", received_flags::ESMTPSA | {"esmtpsa", received_flags::ESMTPSA |
received_flags::SSL | received_flags::SSL |
received_flags::AUTHENTICATED}, received_flags::AUTHENTICATED},
{"utf8esmtpsa", received_flags::ESMTPSA |
received_flags::SSL |
received_flags::AUTHENTICATED |
received_flags::UTF8},
{"esmtps", received_flags::ESMTPS | {"esmtps", received_flags::ESMTPS |
received_flags::SSL}, received_flags::SSL},
{"utf8esmtps", received_flags::ESMTPS |
received_flags::SSL |
received_flags::UTF8},
{"lmtp", received_flags::LMTP}, {"lmtp", received_flags::LMTP},
{"imap", received_flags::IMAP}, {"imap", received_flags::IMAP},
{"imaps", received_flags::IMAP | {"imaps", received_flags::IMAP |
push_flag(rh, received_flags::ARTIFICIAL, "artificial"); push_flag(rh, received_flags::ARTIFICIAL, "artificial");
push_flag(rh, received_flags::AUTHENTICATED, "authenticated"); push_flag(rh, received_flags::AUTHENTICATED, "authenticated");
push_flag(rh, received_flags::SSL, "ssl"); push_flag(rh, received_flags::SSL, "ssl");
push_flag(rh, received_flags::UTF8, "utf8");
lua_setfield(L, -2, "flags"); lua_setfield(L, -2, "flags");


auto push_nullable_string = [L](const mime_string &st, const char *field) { auto push_nullable_string = [L](const mime_string &st, const char *field) {

+ 4
- 3
src/libmime/received.hxx Прегледај датотеку

/*-
* Copyright 2021 Vsevolod Stakhov
/*
* Copyright 2024 Vsevolod Stakhov
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
ARTIFICIAL = (1u << 11u), ARTIFICIAL = (1u << 11u),
SSL = (1u << 12u), SSL = (1u << 12u),
AUTHENTICATED = (1u << 13u), AUTHENTICATED = (1u << 13u),
UTF8 = 1u << 14u,
}; };


constexpr received_flags operator|(received_flags lhs, received_flags rhs) constexpr received_flags operator|(received_flags lhs, received_flags rhs)

Loading…
Откажи
Сачувај