mu: add user-agent property to msg plist

Add a user-agent property to the full message sexps (i.e., the ones
available in mu4e-view). This property contains either the User-Agent or
X-Mailer string (and is absent otherwise)
This commit is contained in:
djcb
2016-03-14 22:53:42 +02:00
parent 68f5dc3973
commit acd00a0b3f
2 changed files with 17 additions and 4 deletions

View File

@ -14,7 +14,7 @@
executing marks. executing marks.
- Remove the 'z' keybinding for leaving the headers - Remove the 'z' keybinding for leaving the headers
view. Keybindings are precious! view. Keybindings are precious!
- Make `shr' the default renderer for rich-text emails - Make `shr' the default renderer for rich-text emails (when available)
- Allow for resending existing messages, possibly editing them. M-x - Allow for resending existing messages, possibly editing them. M-x
mu4e-compose-resend, or use the menu; no shortcut. mu4e-compose-resend, or use the menu; no shortcut.
- Let `mu4e~read-char-choice' become case-insensitive if there is - Let `mu4e~read-char-choice' become case-insensitive if there is
@ -33,6 +33,13 @@
mu4e-view-message-with-message-id) use a headers buffer, then mu4e-view-message-with-message-id) use a headers buffer, then
view the message. This way, those linked message are just like view the message. This way, those linked message are just like
any other, and can be deleted, moved etc. any other, and can be deleted, moved etc.
- Increase the maximum default for message to index to 500 Mb; you
can customize this using the --max-msg-size parameter to mu
index.
- Allow for indexing in the background; see
`mu4e-index-update-in-background`.
- Add a :user-agent field to the message-sexp (in mu4e-view), which
is either the User-Agent or X-Mailer field, when present.
** 0.9.16 ** 0.9.16

View File

@ -415,11 +415,12 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
" :has-child t" : ""); " :has-child t" : "");
} }
static void static void
append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts) append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts)
{ {
GError *err; const char *str;
GError *err;
err = NULL; err = NULL;
if (!mu_msg_load_msg_file (msg, &err)) { if (!mu_msg_load_msg_file (msg, &err)) {
@ -432,6 +433,11 @@ append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts)
append_sexp_parts (gstr, msg, opts); append_sexp_parts (gstr, msg, opts);
append_sexp_contacts (gstr, msg); append_sexp_contacts (gstr, msg);
/* add the user-agent / x-mailer */
str = mu_msg_get_header (msg, "User-Agent");
if (str || (str = mu_msg_get_header (msg, "X-Mailer")))
append_sexp_attr (gstr, "user-agent", str);
append_sexp_body_attr (gstr, "body-txt", append_sexp_body_attr (gstr, "body-txt",
mu_msg_get_body_text(msg, opts)); mu_msg_get_body_text(msg, opts));
append_sexp_body_attr (gstr, "body-html", append_sexp_body_attr (gstr, "body-html",