unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: Sebastian Spaeth <Sebastian@SSpaeth.de>, notmuch@notmuchmail.org
Subject: Re: [PATCH] notmuch-reply: Use a shorter 'On, X Y wrote:' line
Date: Wed, 03 Mar 2010 07:20:47 +0100	[thread overview]
Message-ID: <878waaexj4.fsf@steelpick.localdomain> (raw)
In-Reply-To: <1267533462-15682-1-git-send-email-Sebastian@SSpaeth.de>

On Tue,  2 Mar 2010 13:37:42 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:
> Previously, we would output:
> 'On Thu, 25 Feb 2010 14:32:54 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:' now it is:
> 'On 2010-02-25, Sebastian Spaeth wrote:'
> 
> In case we don't find a '<' (as indicator for 'Realname <email>'), we still use the whole from address.
> 
> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
> ---
> This probably shows my lack of C skills quite nicely but it does the job for me.
> 
>  notmuch-reply.c |   21 ++++++++++++++++++---
>  1 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index 98f6442..929572f 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -288,9 +288,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
>      GMimeMessage *reply;
>      notmuch_messages_t *messages;
>      notmuch_message_t *message;
> -    const char *subject, *from_addr = NULL;
> +    const char *subject, *from_addr = NULL, *short_from;
>      const char *in_reply_to, *orig_references, *references;
>      char *reply_headers;
> +    time_t date;
> +    struct tm *datetm;
> +    char *datestr;
>  
>      for (messages = notmuch_query_search_messages (query);
>  	 notmuch_messages_has_more (messages);
> @@ -346,10 +349,21 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
>  	g_object_unref (G_OBJECT (reply));
>  	reply = NULL;
>  
> +	date = notmuch_message_get_date(message);
> +	datetm = gmtime( &date );
> +	datestr = talloc_array(ctx, char, 11);
> +	strftime(datestr, 11, "%Y-%m-%d", datetm);
> +
> +	/* If from contains '<' (not as first char),
> +	 * only use the preceding real name */
> +	short_from = talloc_strdup(ctx, from_addr);

I do not see, where do you assign a value to from_addr (besides the
initial NULL).

Michal

  parent reply	other threads:[~2010-03-03  6:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 12:37 [PATCH] notmuch-reply: Use a shorter 'On, X Y wrote:' line Sebastian Spaeth
2010-03-02 14:01 ` martin f krafft
2010-03-02 18:38   ` Sebastian Spaeth
2010-03-03  7:14   ` Michal Sojka
2010-03-03  6:20 ` Michal Sojka [this message]
2010-03-03 12:01   ` Sebastian Spaeth
2010-03-04 14:41 ` Michal Sojka
2010-03-05 12:51   ` Sebastian Spaeth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878waaexj4.fsf@steelpick.localdomain \
    --to=sojkam1@fel.cvut.cz \
    --cc=Sebastian@SSpaeth.de \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).