aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/mailboxTest.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* vmime: prevent loss of a space during text::createFromString (#306)Jan Engelhardt2024-05-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` mailbox(text("Test München West", charsets::UTF_8), "[email protected]").generate(); ``` produces ``` =?us-ascii?Q?Test_?= =?utf-8?Q?M=C3=BCnchen?= =?us-ascii?Q?West?= <[email protected]> ``` The first space between ``Test`` and ``München`` is encoded as an underscore along with the first word: ``Test_``. The second space between ``München`` and ``West`` is encoded with neither of the two words and thus lost. Decoding the text results in ``Test MünchenWest`` instead of ``Test München West``. This is caused by how ``vmime::text::createFromString()`` handles transitions between 7-bit and 8-bit words: If an 8-bit word follows a 7-bit word, a space is appended to the previous word. The opposite case of a 7-bit word following an 8-bit word *misses* this behaviour. When one fixes this problem, a follow-up issue appears: ``text::createFromString("a b\xFFc d")`` tokenizes the input into ``m_words={word("a "), word("b\xFFc ", utf8), word("d")}``. This "right-side alignment" nature of the whitespace is a problem for word::generate(): As per RFC 2047, spaces between adjacent encoded words are just separators but not meant to be displayed. A space between an encoded word and a regular ASCII text is not just a separator but also meant to be displayed. When word::generate() outputs the b-word, it would have to strip one space, but only when there is a transition from encoded-word to unencoded word. word::generate() does not know whether d will be encoded or unencoded. The idea now is that we could change the tokenization of ``text::createFromString`` such that whitespace is at the *start* of words rather than at the end. With that, word::generate() need not know anything about the next word, but rather only the *previous* one. Thus, in this patch, 1. The tokenization of ``text::createFromString`` is changed to left-align spaces and the function is fixed to account for the missing space on transition. 2. ``word::generate`` learns how to steal a space character. 3. Testcases are adjusted to account for the shifted position of the space. Fixes: #283, #284 Co-authored-by: Vincent Richard <[email protected]>
* Avoid force-encoding display names that fit within qcontentJan Engelhardt2020-12-111-0/+14
| | | | | | | | | When the display name contains an At sign, or anything of the sort, libvmime would forcibly encode this to =?...?=, even if the line is fine ASCII which only needs quoting. rspamd takes excessive quoting as a sign of spam and penalizes such mails by raising the score (rule/match: TO_EXCESS_QP et al.)
* Improve address parser for malformed mailbox specificationsJan Engelhardt2019-01-251-6/+6
| | | | | | | | | | | | Spammers use "Name <addr> <addr>" to trick some parsers. My expectations as to what the outcome should be is presented in the updated mailboxTest.cpp. The DFA in mailbox::parseImpl is hereby redone so as to pick the rightmost address-looking portion as the address, rather than something in between. While doing so, it will also no longer mangle the name part anymore (it does this by keeping a "as_if_name" variable around until the end).
* tests: add more malformation tests to mailboxTestJan Engelhardt2019-01-241-4/+19
|
* Code style and clarity.Vincent Richard2018-09-051-14/+13
|
* Added unit test related to PR #192.Vincent Richard2018-03-121-0/+10
|
* Boost/C++11 shared pointers.Vincent Richard2013-11-211-3/+6
|
* Fixed mailbox and mailbox group parsing. Added unit tests.Vincent Richard2013-03-111-0/+18
|
* Refactored unit tests.Vincent Richard2013-03-081-5/+1
|
* Message generation/parsing context. Charset conversion options. Preliminary ↵Vincent Richard2013-02-241-1/+1
| | | | implementation of RFC-6532.
* Updated copyright year and maintainer email address.Vincent Richard2013-01-101-1/+1
|
* Added support for mailboxes that specify an (encoded) full name with an ↵Vincent Richard2011-06-191-0/+15
| | | | empty email address, set by a <> marker (Zarafa).
* Relicensed VMime under the GNU GPL version 3. Changed copyright year to 2009.Vincent Richard2009-09-061-2/+2
|
* Changed copyright year to 2008.Vincent Richard2008-01-041-1/+1
|
* Changed copyright year to 2007.Vincent Richard2007-01-011-1/+1
|
* Changed copyright year to 2006.Vincent Richard2006-02-051-1/+1
|
* Updated FSF address.Vincent Richard2005-09-171-3/+7
|
* Moved to CppUnit for unit tests framework.Vincent Richard2005-08-251-73/+57
|
* Added unit tests.Vincent Richard2005-06-171-0/+15
|
* Updated VMime website URL.Vincent Richard2005-03-181-1/+1
|
* Changed year to 2005 in copyright header.Vincent Richard2005-01-031-1/+1
|
* Autotools and libtool support.Vincent Richard2004-12-301-1/+1
|
* Moved all header files to 'vmime/' directory.Vincent Richard2004-12-261-3/+3
|
* Default platform handlers (currently only POSIX).Vincent Richard2004-12-181-2/+2
|
* New build system for unit tests.Vincent Richard2004-11-061-0/+114