Fix name extraction variables in message snippets
Variables like "%TOLNAME" in message snippets fail if the message's display name contains a comma, like
"LastName, FirstName" <mail@xx.yy>
The reason for this are two bugs addressed in this PR:
- the function
TemplateParser::Util::getLastNameFromEmail
returns an empty string for "LastName" because of an off-by-1 error in the parsing code. - The functions
ConvertSnippetVariablesJob::getFirstNameFromEmail
andConvertSnippetVariablesJob::getLastNameFromEmail
split the given list of addresses at comma characters usingQString::split
. However, this fails if the display name of an address contains a comma itself (as in the example above). The fix is to useKEmailAddress::splitAddressList
, which handles quoted display names correctly.
Edited by Frank Fischer