commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg-265-gdfae7b2
Date: Thu, 16 Apr 2009 14:46:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c

The branch, master has been updated
       via  dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c (commit)
      from  d971eaba5417d3a06c332d1a6bf1929bb51f4d90 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dfae7b2baeb620fe266e5ac6aa6000a7c3acfb5c
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Apr 16 17:46:16 2009 +0300

    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.

-----------------------------------------------------------------------

Summary of changes:
 examples/addr.c                   |    2 +-
 include/mailutils/address.h       |    4 +-
 include/mailutils/types.hin       |    6 +-
 libmu_sieve/extensions/vacation.c |   91 +++++++++++++++++++------------------
 libproto/mailer/mbox.c            |   15 +++---
 maidag/maidag.c                   |   11 +++--
 mail/from.c                       |   22 ++++-----
 mail/reply.c                      |    5 ++-
 mailbox/address.c                 |    2 +-
 mailbox/header.c                  |    6 +--
 mailbox/parse822.c                |    2 +-
 11 files changed, 85 insertions(+), 81 deletions(-)

diff --git a/examples/addr.c b/examples/addr.c
index f8b5874..74beaf2 100644
--- a/examples/addr.c
+++ b/examples/addr.c
@@ -31,7 +31,7 @@
 
 #define EPARSE MU_ERR_NOENT
 
-struct _mu_address hint;
+struct mu_address hint;
 int hflags;
 
 static int
diff --git a/include/mailutils/address.h b/include/mailutils/address.h
index c68811c..dfc3575 100644
--- a/include/mailutils/address.h
+++ b/include/mailutils/address.h
@@ -41,7 +41,7 @@ extern "C" {
  *  
  * Capitalized names are from RFC 822, section 6.1 (Address Syntax).
  */
-struct _mu_address
+struct mu_address
 {
   char *addr;
        /* the original string that this list of addresses was created
@@ -60,7 +60,7 @@ struct _mu_address
   char *route;
        /* the optional ROUTE in the ROUTE-ADDR form of MAILBOX */
 
-  struct _mu_address *next;
+  struct mu_address *next;
 };
 
 extern int mu_address_create_hint (mu_address_t *, const char *,
diff --git a/include/mailutils/types.hin b/include/mailutils/types.hin
index 77d9059..94fcc02 100644
--- a/include/mailutils/types.hin
+++ b/include/mailutils/types.hin
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail  -*- c -*-
    Copyright (C) 1999, 2000, 2001, 2005, 2007, 
-   2008 Free Software Foundation, Inc.
+   2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@
 extern "C" {
 #endif
 
-struct _mu_address;
+struct mu_address;
 struct _mu_attribute;
 struct _mu_authority;
 struct _mu_body;
@@ -73,7 +73,7 @@ struct _mu_tcp_server;
   
 typedef _MU_OFF_TYPE_ mu_off_t;
   
-typedef struct _mu_address *mu_address_t;
+typedef struct mu_address *mu_address_t;
 typedef struct _mu_attribute *mu_attribute_t;
 typedef struct _mu_authority *mu_authority_t;
 typedef struct _mu_body *mu_body_t;
diff --git a/libmu_sieve/extensions/vacation.c 
b/libmu_sieve/extensions/vacation.c
index fe6b511..72715d2 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -478,60 +478,63 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, 
mu_message_t msg,
     return -1;
   mu_mime_get_message (mime, &newmsg);
   mu_message_get_header (newmsg, &newhdr);
-
+  
   rc = mu_address_create (&to_addr, to);
   if (rc)
     {
       mu_sieve_error (mach,
                      _("%d: cannot create recipient address <%s>: %s"),
                      mu_sieve_get_message_num (mach), from, mu_strerror (rc));
-      return -1;
-    }
-
-  mu_header_set_value (newhdr, MU_HEADER_TO, to, 0);
-  
-  vacation_subject (mach, tags, msg, newhdr);
-    
-  if (from)
-    {
-      if (mu_address_create (&from_addr, from))
-       from_addr = NULL;
     }
   else
     {
-      from_addr = NULL;
-    }
-  
-  if (mu_rfc2822_in_reply_to (msg, &value) == 0)
-    {
-      mu_header_set_value (newhdr, MU_HEADER_IN_REPLY_TO, value, 1);
-      free (value);
-    }
-  
-  if (mu_rfc2822_references (msg, &value) == 0)
-    {
-      mu_header_set_value (newhdr, MU_HEADER_REFERENCES, value, 1);
-      free (value);
-    }
-  
-  mailer = mu_sieve_get_mailer (mach);
-  rc = mu_mailer_open (mailer, 0);
-  if (rc)
-    {
-      mu_url_t url = NULL;
-      mu_mailer_get_url (mailer, &url);
+      mu_header_set_value (newhdr, MU_HEADER_TO, to, 0);
       
-      mu_sieve_error (mach,
-                     _("%d: cannot open mailer %s: %s"),
-                     mu_sieve_get_message_num (mach),
-                     mu_url_to_string (url), mu_strerror (rc));
-      return -1;
-    }
-  else
-    {
-      rc = mu_mailer_send_message (mailer, newmsg, from_addr, to_addr);
-      mu_mailer_close (mailer);
+      vacation_subject (mach, tags, msg, newhdr);
+      
+      if (from)
+        {
+          if (mu_address_create (&from_addr, from))
+           from_addr = NULL;
+        }
+      else
+        {
+          from_addr = NULL;
+        }
+      
+      if (mu_rfc2822_in_reply_to (msg, &value) == 0)
+        {
+          mu_header_set_value (newhdr, MU_HEADER_IN_REPLY_TO, value, 1);
+          free (value);
+        }
+      
+      if (mu_rfc2822_references (msg, &value) == 0)
+        {
+          mu_header_set_value (newhdr, MU_HEADER_REFERENCES, value, 1);
+          free (value);
+        }
+      
+      mailer = mu_sieve_get_mailer (mach);
+      rc = mu_mailer_open (mailer, 0);
+      if (rc)
+       {
+         mu_url_t url = NULL;
+         mu_mailer_get_url (mailer, &url);
+      
+         mu_sieve_error (mach,
+                         _("%d: cannot open mailer %s: %s"),
+                         mu_sieve_get_message_num (mach),
+                         mu_url_to_string (url), mu_strerror (rc));
+       }
+      else
+       {
+         rc = mu_mailer_send_message (mailer, newmsg, from_addr, to_addr);
+         mu_mailer_close (mailer);
+       }
+      mu_mailer_destroy (&mailer);
     }
+  mu_address_destroy (&to_addr);
+  mu_address_destroy (&from_addr);
   mu_mime_destroy (&mime);
   return rc;
 }
diff --git a/libproto/mailer/mbox.c b/libproto/mailer/mbox.c
index 008f72a..8e09df3 100644
--- a/libproto/mailer/mbox.c
+++ b/libproto/mailer/mbox.c
@@ -138,12 +138,14 @@ remote_mbox_append_message (mu_mailbox_t mbox, 
mu_message_t msg)
   mkaddr (mbox, property, "TO", &to);
   if (!to)
     {
-      const char *rcpt, *host;
-      char *domain = NULL;
+      const char *rcpt;
       
       status = mu_url_sget_user (mbox->url, &rcpt);
       if (status != MU_ERR_NOENT)
        {
+         const char *host;
+         struct mu_address hint;
+         
          if (status)
            {
              MU_DEBUG1 (mbox->debug, MU_DEBUG_ERROR,
@@ -152,13 +154,10 @@ remote_mbox_append_message (mu_mailbox_t mbox, 
mu_message_t msg)
              return status;
            }
 
-         /* FIXME: Set before if? */
-         mu_aget_user_email_domain (&domain);
          mu_url_sget_host (mbox->url, &host);
-         mu_set_user_email_domain (host);
-         status = mu_address_create (&to, rcpt);
-         mu_set_user_email_domain (domain);
-         free (domain);
+         hint.domain = (char*) host;
+         status = mu_address_create_hint (&to, rcpt, &hint, 
+                                          MU_ADDR_HINT_DOMAIN);
       
          if (status)
            {
diff --git a/maidag/maidag.c b/maidag/maidag.c
index f0ccefc..460deda 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -481,6 +481,7 @@ int
 main (int argc, char *argv[])
 {
   int arg_index;
+  mu_debug_t debug;
 
   /* Preparative work: close inherited fds, force a reasonable umask
      and prepare a logging. */
@@ -535,16 +536,18 @@ main (int argc, char *argv[])
   if (log_to_stderr == -1)
     log_to_stderr = url_option || (!lmtp_mode && (current_uid != 0));
   
+  mu_diag_get_debug (&debug);
   if (!log_to_stderr)
     {
-      mu_debug_t debug;
-
       openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility);
-      mu_diag_get_debug (&debug);
       mu_debug_set_print (debug, mu_diag_syslog_printer, NULL);
-
       mu_debug_default_printer = mu_debug_syslog_printer;
     }
+  else
+    {
+      mu_debug_set_print (debug, mu_diag_stderr_printer, NULL);
+      mu_debug_default_printer = mu_debug_stderr_printer;
+    }
 
   argc -= arg_index;
   argv += arg_index;
diff --git a/mail/from.c b/mail/from.c
index de3928c..a148d3c 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 045a822..cdf6f75 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);
diff --git a/mailbox/address.c b/mailbox/address.c
index 115ee86..8c81f45 100644
--- a/mailbox/address.c
+++ b/mailbox/address.c
@@ -73,7 +73,7 @@ mu_address_create_hint (mu_address_t *a, const char *s, 
mu_address_t hint,
 int
 mu_address_create (mu_address_t *a, const char *s)
 {
-  struct _mu_address hint;
+  struct mu_address hint;
   const char *d;
   mu_get_user_email_domain (&d);
   hint.domain = (char*) d;
diff --git a/mailbox/header.c b/mailbox/header.c
index 94e28fd..5f805f7 100644
--- a/mailbox/header.c
+++ b/mailbox/header.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005,
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -761,9 +761,7 @@ mu_header_get_address_n (mu_header_t header, const char 
*name, int n,
   if (status)
     return status;
 
-  status = mu_address_create(addr, value);
-
-  return status;
+  return mu_address_create (addr, value);
 }
 
 
diff --git a/mailbox/parse822.c b/mailbox/parse822.c
index a26815d..837fe6b 100644
--- a/mailbox/parse822.c
+++ b/mailbox/parse822.c
@@ -705,7 +705,7 @@ mu_parse822_phrase (const char **p, const char *e, char 
**phrase)
 static mu_address_t
 new_mb (void)
 {
-  return calloc (1, sizeof (struct _mu_address));
+  return calloc (1, sizeof (struct mu_address));
 }
 
 static char *


hooks/post-receive
--
GNU Mailutils




reply via email to

[Prev in Thread] Current Thread [Next in Thread]