diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-16 17:46:16 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-16 17:46:16 +0300 |
commit | dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c (patch) | |
tree | 7bed66dea227346bd194f3f4885546807d145786 /mail | |
parent | d971eaba5417d3a06c332d1a6bf1929bb51f4d90 (diff) | |
download | mailutils-dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c.tar.gz mailutils-dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c.tar.bz2 |
Minor changes.
* include/mailutils/address.h (struct _mu_address): Rename to
struct mu_address: it is public interface.
* include/mailutils/types.hin: Likewise.
* examples/addr.c: Likewise.
* mailbox/address.c: Likewise.
* mailbox/parse822.c: Likewise.
* libmu_sieve/extensions/vacation.c (vacation_reply): Fix memory leaks.
* libproto/mailer/mbox.c (remote_mbox_append_message): Use
mu_address_create_hint instead of mu_set_user_email_domain/mu_address_create.
* maidag/maidag.c (main): Set both diag and debug printers explicitly.
* mail/from.c (mail_from0): minor change.
* mail/reply.c (reply0): Fix memory leak.
* mailbox/header.c: minor change.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/from.c | 22 | ||||
-rw-r--r-- | mail/reply.c | 5 |
2 files changed, 14 insertions, 13 deletions
diff --git a/mail/from.c b/mail/from.c index de3928cf8..a148d3c66 100644 --- a/mail/from.c +++ b/mail/from.c @@ -1,6 +1,6 @@ /* GNU Mailutils -- a suite of utilities for electronic mail Copyright (C) 1999, 2000, 2001, 2002, 2003, - 2005, 2007 Free Software Foundation, Inc. + 2005, 2007, 2009 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,8 +42,7 @@ mail_from0 (msgset_t *mspec, mu_message_t msg, void *data) mu_address_t address = NULL; if (mu_address_create (&address, from) == 0) { - char name[128]; - size_t len; + char *name; const char *email; if (mu_address_sget_email (address, 1, &email) == 0) @@ -53,7 +52,8 @@ mail_from0 (msgset_t *mspec, mu_message_t msg, void *data) { char *tmp; - if (mu_header_aget_value_unfold (hdr, MU_HEADER_TO, &tmp) == 0) + if (mu_header_aget_value_unfold (hdr, MU_HEADER_TO, + &tmp) == 0) { mu_address_t addr_to; if (mu_address_create (&addr_to, tmp) == 0) @@ -66,16 +66,14 @@ mail_from0 (msgset_t *mspec, mu_message_t msg, void *data) } } - len = strlen (from) + 1; - *name = '\0'; - mu_address_get_personal (address, 1, name, sizeof name, NULL); - if (*name && len) + if ((mu_address_aget_personal (address, 1, &name) == 0 + && name) + || (mu_address_aget_email (address, 1, &name) == 0 + && name)) { - strncpy (from, name, len - 1); - from[len - 1] = '\0'; + free (from); + from = name; } - else - mu_address_get_email (address, 1, from, len, NULL); mu_address_destroy (&address); } } diff --git a/mail/reply.c b/mail/reply.c index 045a8229b..cdf6f7527 100644 --- a/mail/reply.c +++ b/mail/reply.c @@ -1,5 +1,6 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2005, 2007, + 2009 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,6 +92,8 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) COMPOSE_SINGLE_LINE); } + mu_address_destroy (&addr); + /* Finally, add any Ccs */ if (mu_header_aget_value (hdr, MU_HEADER_CC, &str) == 0) compose_header_set (&env, MU_HEADER_TO, str, COMPOSE_SINGLE_LINE); |