[MlMt] Gravatar-hack for MailMate
Benny Kjær Nielsen
mailinglist at freron.com
Fri Feb 22 05:16:55 EST 2019
On 22 Feb 2019, at 1:20, Charlie Garrison wrote:
To everyone: Sorry about the missing attachment *and* the wrong path.
I've attached a new file, because the other one was actually much more
complex than it needed to be (because I was trying out different
approaches to the problem). They are functionally equivalent though.
> On 22 Feb 2019, at 1:35, Benny Kjær Nielsen wrote:
>
>> The attached file needs to be saved in this folder:
>>
>> /Users/<username>/Application
>> Support/MailMate/Resources/Layouts/headersFormatting.plist
Just to emphasize, it should have been:
/Users/<username>/Library/Application
Support/MailMate/Resources/Layouts/headersFormatting.plist
(And `Resources/Layouts` likely do not exist for most users.)
> I've already got a custom headersFormatting.plist which is quite
> different from the one you supplied. Would you be willing to point out
> what the differences are for the Gravatar icon? Or, is there any docco
> to explain the structure of the headersFormatting.plist file?
There is no documentation. It really is just for users that would rather
tinker with low level files than wait for me to implement some specific
feature. (There are no guarantees I won't change the format of one or
more of these files in the future.)
In this case, it's fairly simple what you need to do if you already have
the `longFormatting` key defined. The file should start with this:
~~~
{
longFormatting =
{
children =
(
// Gravatar example with link
{
formatString = "<a
href=\"https://www.gravatar.com/${from.address.#md5}\"><img
style=\"float: left; height: 60px;\"
src=\"https://www.gravatar.com/avatar/${from.address.#md5}\"/></a>";
},
~~~
And then continue with its current content. In other words, the
`children` group above just got a new “first child”.
The above also shows you that it's possible to click on the avatar to go
to the corresponding Gravatar page.
--
Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20190222/ad02bf27/attachment-0001.html>
-------------- next part --------------
{
longFormatting =
{
children =
(
// Gravatar example with link
{
formatString = "<a href=\"https://www.gravatar.com/${from.address.#md5}\"><img style=\"float: left; height: 60px;\" src=\"https://www.gravatar.com/avatar/${from.address.#md5}\"/></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