Since the AH can comprise multiple lines, parse each line individually
until we found all data.
The parsing is complicated, but naïve field splitting leads to incorrect
results.
Generally, scan up to the next "dkim=" part, extract the state (which is
the value) and then look for the reason, which might or might not be
parenthesis-enclosed or start with a "reason=" key or both.
All other data up to the next "dkim=" part or end of the line or
semicolon will be treated as extrainfo and shown if the preference has
been enabled.
We handle "spf=" parts in about the same way.
Instead of dropping additional links in the presentation layer, iterate
over all links in the parsing layer and add each link individually.
Some MTAs wrap the links in angle brackets (<>), so make sure to remove
those, since they wouldn't parse as valid XHTML (and also aren't valid
link targets).
Instead of just extracting the state itself, we'll also fetch the reason
(typically parenthesis-enclosed) and use the rest of the header as
additional data, which is only shown if the extrainfo preference has
been turned on.
The current code only shows the basic auth status and a description of
what it means. Some users (i.e., me) would like to see more information,
typically the whole header part that is responsible for the decision, so
prepare to show this information.
This commit does NOT hook it up just yet. This will be done in a later
commit.
Auth data needs only be processed once and is independent from the
actual route data.
This has the added benefit that auth data, which is entirely local, is
shown even if the API returned an error.
Currently, on error (rate limit, unable to reach Mailhops API), an error
message is shown and all additional information is bypassed.
This also means that the theme is not being applied.
Change the code to show local data even in error cases, and also apply
the theme option.
Actually, links containing a comma character are just multiple links,
the current code wants to fetch the first element and drop all others.
We'll change this at a later time, but for now, just fix the bug at
hand.