From acd00a0b3fb8b9dfc41f65687b84ca49e804d9ea Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Mar 2016 22:53:42 +0200 Subject: [PATCH] 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) --- NEWS.org | 9 ++++++++- lib/mu-msg-sexp.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS.org b/NEWS.org index afa2a9ed..a76941f1 100644 --- a/NEWS.org +++ b/NEWS.org @@ -14,7 +14,7 @@ executing marks. - Remove the 'z' keybinding for leaving the headers 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 mu4e-compose-resend, or use the menu; no shortcut. - 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 view the message. This way, those linked message are just like 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 diff --git a/lib/mu-msg-sexp.c b/lib/mu-msg-sexp.c index 934b3ac6..aa211fed 100644 --- a/lib/mu-msg-sexp.c +++ b/lib/mu-msg-sexp.c @@ -415,11 +415,12 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti) " :has-child t" : ""); } - static void append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts) { - GError *err; + const char *str; + GError *err; + err = NULL; if (!mu_msg_load_msg_file (msg, &err)) { @@ -431,7 +432,12 @@ append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts) append_sexp_parts (gstr, msg, opts); 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", mu_msg_get_body_text(msg, opts)); append_sexp_body_attr (gstr, "body-html",