[MlMt] Gravatar-hack for MailMate

Benny Kjær Nielsen mailinglist at freron.com
Thu Feb 21 10:26:17 EST 2019


On 21 Feb 2019, at 16:24, Robert M. Münch wrote:

> On 21 Feb 2019, at 15:35, Benny Kjær Nielsen wrote:
>
>> … The attached file needs to be saved in this folder:

Sorry, that might be useful to include :)

-- 
Benny
-------------- next part --------------
{
	longFormatting =
	{
		children =
		(
			// Gravatar example with link (which becomes a bit messy because the md5 value is needed twice).
			{
				prefixString = "<a href=\"https://www.gravatar.com/";
				children = (
					{
						formatString = "${from.address.#md5}";
						suffixString = "\">";
					},
					{
						// Note: Could float it right instead
						prefixString = "<img style=\"float: left; height: 60px;\" src=\"https://www.gravatar.com/avatar/";
						formatString = "${from.address.#md5}";
						suffixString = "\"/>";
					},
				);
				suffixString = "</a>";
			},
			{
				separator = { string = "\n"; };
				placeholderString = "(No headers found)";
				// There is a lot of redundancy in the following. Need some way to simplify/template how this works.
				// For now, only Resent-From/To is displayed.
				// Note that this does not work well for multiple Resent headers, in particular, multiple Resent-To are hard to interpret/display.

				prefixString = "<table><tbody>";
				suffixString = "</tbody></table>";

				children =
				(
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Resent-From:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						children =
						(
							{
								formatString = "${resent-from.name.#nospoof}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "Resent from "; formatString = "“${resent-from.name}”"; };
									queryFormatting = { formatString = "resent-from.name = '${resent-from.name}'"; separatorString = " or "; escapeSingleQuotes = 1; };
								};
							},
							{
								prefix = { formatString = "${resent-from.name:+ <}";};
								formatString = "${resent-from.address}";
								escapeHTML = 1;
								suffix = { formatString = "${resent-from.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "Resent from "; formatString = "“${resent-from.address}”"; };
									queryFormatting = { formatString = "resent-from.address = '${resent-from.address}'"; separatorString = " or "; escapeSingleQuotes = 1; };
								};
							},
						);
						copyValues =
						(
							{ title = ''; valueFormatting = { formatString = '${resent-from.name:+${resent-from.name} <${resent-from.address}>}'; }; },
							{ title = 'Address Only'; valueFormatting = { formatString = '${resent-from.address}'; }; },
							{ title = 'Name Only'; valueFormatting = { formatString = '${resent-from.name}'; }; },
						);
						isAddress = :true;
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Resent-To:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						sharedPrefix = "resent-to";
						separatorString = ", ";
						children =
						(
							{
								formatString = "${resent-to.name.#nospoof}";
								escapeHTML = 1;
								// Need alternative `#recipient` definition since resent addresses should not be part of `#recipient`.
								//  Maybe an alternative which includes resents...
								// singleClick =
								// {
								// 	titleFormatting = { prefixString = "Resent to "; formatString = "“${resent-to.name}”"; };
								// 	queryFormatting = { formatString = "#recipient.name = '${resent-to.name}'"; escapeSingleQuotes = 1; };
								// };
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${resent-to.name:+${resent-to.name} <${resent-to.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${resent-to.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${resent-to.name}'; }; },
								);
								isAddress = :true;
							},
							{
								prefix = { formatString = "${to.name:+ <}";};
								formatString = "${to.address}";
								escapeHTML = 1;
								suffix = { formatString = "${to.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "Resent to "; formatString = "“${resent-to.address}”"; };
									queryFormatting = { formatString = "#recipient.address = '${to.address}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${to.name:+${to.name} <${to.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${to.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${to.name}'; }; },
								);
								isAddress = :true;
							},
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">From:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						children =
						(
							{
								formatString = "${from.name.#nospoof}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "From "; formatString = "“${from.name}”"; };
									queryFormatting = { formatString = "from.name = '${from.name}'"; separatorString = " or "; escapeSingleQuotes = 1; };
								};
							},
							{
								prefix = { formatString = "${from.name:+ <}";};
								formatString = "${from.address}";
								escapeHTML = 1;
								suffix = { formatString = "${from.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "From "; formatString = "“${from.address}”"; };
									queryFormatting = { formatString = "from.address = '${from.address}'"; separatorString = " or "; escapeSingleQuotes = 1; };
								};
							},
						);
						copyValues =
						(
							{ title = ''; valueFormatting = { formatString = '${from.name:+${from.name} <${from.address}>}'; }; },
							{ title = 'Address Only'; valueFormatting = { formatString = '${from.address}'; }; },
							{ title = 'Name Only'; valueFormatting = { formatString = '${from.name}'; }; },
						);
						isAddress = :true;
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Subject:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						children =
						(
							{
								formatString = "${subject.prefix}";
								escapeHTML = 1;
								suffix = { string = " "; };
								// link stuff
							},
							{
								prefix = { string = "["; };
								formatString = "${subject.blob}";
								escapeHTML = 1;
								suffix = { string = "] "; };
								singleClick =
								{
									titleFormatting = { prefixString = "Related to "; formatString = "${list-id.identifier:?“${list-id.identifier}”:[${subject.blob}]}"; };
									queryFormatting = { formatString = "${list-id.identifier:?list-id.identifier = '${list-id.identifier}':subject.blob = '${subject.blob}'}"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${subject}'; }; },
									{ title = 'Blob Only'; valueFormatting = { formatString = '${subject.blob}'; }; },
								);
							},
							{
								formatString = "${subject.body}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "Related to "; formatString = "“${subject.body}”"; };
									queryFormatting = { formatString = "subject.body = '${subject.body}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${subject}'; }; },
									{ title = 'Without Prefix'; valueFormatting = { formatString = '${subject.body}'; }; },
								);
							},
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Date:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						formatString = "${#date.formatted}";
						singleClick =
						{
							titleFormatting = { prefixString = "Date is "; formatString = "“${#date.day}”"; };
							queryFormatting = { formatString = "#date.day = '${#date.day}'"; escapeSingleQuotes = 1; };
						};
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">To:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						sharedPrefix = "to";
						separatorString = ", ";
						limitString = " and %td more...";
						children =
						(
							{
								formatString = "${to.name.#nospoof}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${to.name}”"; };
									queryFormatting = { formatString = "#recipient.name = '${to.name}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${to.name:+${to.name} <${to.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${to.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${to.name}'; }; },
								);
								isAddress = :true;
							},
							{
								prefix = { formatString = "${to.name:+ <}";};
								formatString = "${to.address}";
								escapeHTML = 1;
								suffix = { formatString = "${to.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${to.address}”"; };
									queryFormatting = { formatString = "#recipient.address = '${to.address}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${to.name:+${to.name} <${to.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${to.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${to.name}'; }; },
								);
								isAddress = :true;
							},
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Cc:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						sharedPrefix = "cc";
						limitString = " and %td more...";
						separatorString = ", ";
						children =
						(
							{
								formatString = "${cc.name.#nospoof}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${cc.name}”"; };
									queryFormatting = { formatString = "#recipient.name = '${cc.name}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${cc.name:+${cc.name} <${cc.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${cc.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${cc.name}'; }; },
								);
								isAddress = :true;
							},
							{
								prefix = { formatString = "${cc.name:+ <}";};
								formatString = "${cc.address}";
								escapeHTML = 1;
								suffix = { formatString = "${cc.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${cc.address}”"; };
									queryFormatting = { formatString = "#recipient.address = '${cc.address}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${cc.name:+${cc.name} <${cc.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${cc.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${cc.name}'; }; },
								);
								isAddress = :true;
							},
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Bcc:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						sharedPrefix = "bcc";
						limitString = " and %td more...";
						separatorString = ", ";
						children =
						(
							{
								formatString = "${bcc.name.#nospoof}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${bcc.name}”"; };
									queryFormatting = { formatString = "#recipient.name = '${bcc.name}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${bcc.name:+${bcc.name} <${bcc.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${bcc.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${bcc.name}'; }; },
								);
								isAddress = :true;
							},
							{
								prefix = { formatString = "${bcc.name:+ <}";};
								formatString = "${bcc.address}";
								escapeHTML = 1;
								suffix = { formatString = "${bcc.name:+>}";};
								singleClick =
								{
									titleFormatting = { prefixString = "To "; formatString = "“${bcc.address}”"; };
									queryFormatting = { formatString = "#recipient.address = '${bcc.address}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${bcc.name:+${bcc.name} <${bcc.address}>}'; }; },
									{ title = 'Address Only'; valueFormatting = { formatString = '${bcc.address}'; }; },
									{ title = 'Name Only'; valueFormatting = { formatString = '${bcc.name}'; }; },
								);
								isAddress = :true;
							},
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Security:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						separatorString = " ";
						children =
						(
							{
								// formatString = "${#encrypted:+🔒Encrypted (${#security-protocol:+Unknown protocol})}";
								formatString = "${#encrypted:+🔒Encrypted}";
								singleClick = { selector = "showDetails:"; };
								toolTip = { formatString = "This message is encrypted."; };
							},
							{
								// formatString = "${#signed:+✓Signed (${#security-protocol:+Unknown protocol})}";
								formatString = "${#signed:+✓Signed}";
								singleClick = { selector = "showDetails:"; };
								toolTip = { formatString = "This message is signed."; };
							}
						);
					},
					{
						prefix = { string = "<tr><td><span class=\"header_name\">Tags:</span></td><td><span class=\"header_body\">"; };
						suffixString = "</span></td></tr>";
						separatorString = " ";
						sharedPrefix = "##tags.tag";
						children =
						(
							{
								formatString = "${##tags.tag.#shortname}${##tags.tag.#name}";
								escapeHTML = 1;
								singleClick =
								{
									titleFormatting = { prefixString = "Tagged "; formatString = "“${##tags.tag.#name}”"; };
									queryFormatting = { formatString = "##tags.tag = '${##tags.tag}'"; escapeSingleQuotes = 1; };
								};
								copyValues =
								(
									{ title = ''; valueFormatting = { formatString = '${##tags.tag.#name}'; }; },
									{ titleFormatting = 'Server Keyword (${##tags.tag})'; valueFormatting = { formatString = '${##tags.tag}'; }; },
								);
							},
						);
					},
				);
			},
		);
	};
}


More information about the mailmate mailing list