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-260-g1e7a81a
Date: Tue, 07 Apr 2009 13:34:23 +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=1e7a81ad25005ac5268e43a39c9c9dd9d8906557

The branch, master has been updated
       via  1e7a81ad25005ac5268e43a39c9c9dd9d8906557 (commit)
      from  14e0fd63234afa62f413369009bb15073fcc5cfe (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 1e7a81ad25005ac5268e43a39c9c9dd9d8906557
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Apr 7 16:22:11 2009 +0300

    Allow to use mailer URLs as append-only mailboxes (deprecates remote+ 
mailboxes)
    
    * NEWS: Update.
    
    * configure.ac (MU_LIB_REMOTE): Remove.
    (AC_CONFIG_FILES): Remove libproto/remote/Makefile.
    * include/mailutils/registrar.h (mu_remote_mbox_record): Remove.
    (MU_REMOTE_MBOX_PRIO): Remove.
    
    * libproto/Makefile.am (SUBDIRS): Remove remote.
    * libproto/include/mailer0.h (_mu_mailer_mailbox_init)
    (_mu_mailer_folder_init): New protos.
    * libproto/include/registrar0.h (_url_smtp_init)
    (_mailer_smtp_init): Remove.
    (_mu_mailer_sendmail_init, _mu_mailer_prog_init): Add prototype.
    
    * libproto/include/url0.h (struct _mu_url._uplevel): New member.
    * libproto/mailer/Makefile.am (libmu_mailer_la_SOURCES): Remove
    url_sendmail.c and url_smtp.c.
    * libproto/mailer/mbox.c: Move from ../remote.
    * libproto/mailer/url_sendmail.c: Remove.
    * libproto/mailer/url_smtp.c: Remove.
    * libproto/mailer/prog.c: Fix namespace.
    * libproto/mailer/sendmail.c: Likewise.
    * libproto/mailer/smtp.c: Likewise.
    * libproto/mailer/remote.c: New file.
    
    * libproto/remote/: Remove.
    
    * maidag/Makefile.am (maidag_LDADD): Remove ${MU_LIB_REMOTE}.
    * maidag/deliver.c (deliver_url): Remove `remote+' hack.
    (deliver): Fix error message.
    * maidag/guile.c: Fix indentation.
    * maidag/maidag.c: Support `remote+' mailboxes for backward compatibility.
    * mailbox/mailbox.c (_create_mailbox0): Call u_init after ensuring that
    url->scheme coincides with record->scheme.
    * mailbox/url.c (mu_url_uplevel): Use url->_uplevel, if defined.
    
    * libmu_argp/mu_argp.h (mu_check_option): Remove duplicate and
    incorrect prototype.

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

Summary of changes:
 NEWS                               |   30 +++++++-
 configure.ac                       |    2 -
 include/mailutils/registrar.h      |    5 +-
 libmu_argp/mu_argp.h               |    3 +-
 libproto/Makefile.am               |    4 +-
 libproto/include/mailer0.h         |    6 +-
 libproto/include/registrar0.h      |   11 +--
 libproto/include/url0.h            |    1 +
 libproto/mailer/Makefile.am        |    6 +-
 libproto/{remote => mailer}/mbox.c |   36 +++------
 libproto/mailer/prog.c             |   20 +++--
 libproto/mailer/remote.c           |  148 ++++++++++++++++++++++++++++++++++++
 libproto/mailer/sendmail.c         |   59 +++++++++-----
 libproto/mailer/smtp.c             |   36 ++++++++-
 libproto/mailer/url_sendmail.c     |   60 ---------------
 libproto/mailer/url_smtp.c         |   52 -------------
 libproto/remote/.gitignore         |    9 --
 libproto/remote/Makefile.am        |   29 -------
 libproto/remote/folder.c           |   80 -------------------
 maidag/Makefile.am                 |    1 -
 maidag/deliver.c                   |   34 +--------
 maidag/guile.c                     |    4 +-
 maidag/maidag.c                    |   15 +++-
 mailbox/mailbox.c                  |   17 ++--
 mailbox/url.c                      |    3 +
 25 files changed, 315 insertions(+), 356 deletions(-)
 rename libproto/{remote => mailer}/mbox.c (89%)
 create mode 100644 libproto/mailer/remote.c
 delete mode 100644 libproto/mailer/url_sendmail.c
 delete mode 100644 libproto/mailer/url_smtp.c
 delete mode 100644 libproto/remote/.gitignore
 delete mode 100644 libproto/remote/Makefile.am
 delete mode 100644 libproto/remote/folder.c

diff --git a/NEWS b/NEWS
index 24a2faa..ae078c9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2009-03-04
+GNU mailutils NEWS -- history of user-visible changes. 2009-04-07
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 
 2008, 2009 Free Software Foundation, Inc.
 See the end of file for copying conditions.
@@ -15,6 +15,32 @@ All MU client utilities make use of the user ticket file,
 
 * API
 
+* New mailbox formats
+
+Three new append-only mailbox formats are introduced.  The URL syntax of
+each of them is the same as that of the corresponding mailer.
+
+** smtp
+
+Send message using the `smtp' mailer.  It is equivalent to
+`remote+smtp', introduced in previous version.
+
+** sendmail.
+
+Send message using the `sendmail' mailer.  It is equivalent to
+`remote+sendmail', introduced in previous version.
+
+** prog
+
+Send message using the `prog' mailer.  It is equivalent to
+`remote+prog', introduced in previous version.
+
+* Deprecated mailbox formats.
+
+The `remote+sendmail', `remote+prog' and `remote+smtp' mailbox formats
+are deprecated in favor of `sendmail', `prog' and `smtp',
+correspondingly.  
+
 ** Removed functions
 
 - mu_sieve_get_ticket
@@ -359,7 +385,7 @@ that can be done over them is mu_mailbox_append_message.  
E.g.,
 appending to the URL `remote+smtp://127.0.0.1:24' is equivalent to
 sending a message using mailer `smtp://127.0.0.1:24'.
 
-In addirion, "remote+prog" mailbox (abbreviated as "|") is useful for
+In addition, "remote+prog" mailbox (abbreviated as "|") is useful for
 piping messages to the standard input of an external program.
 
 ** New argcv functions.
diff --git a/configure.ac b/configure.ac
index 453e537..a675b11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,6 @@ 
AC_SUBST(MU_LIB_MBOX,'${top_builddir}/libproto/mbox/libmu_mbox.la')
 AC_SUBST(MU_LIB_MH,'${top_builddir}/libproto/mh/libmu_mh.la')
 AC_SUBST(MU_LIB_NNTP,'${top_builddir}/libproto/nntp/libmu_nntp.la')
 AC_SUBST(MU_LIB_POP,'${top_builddir}/libproto/pop/libmu_pop.la')
-AC_SUBST(MU_LIB_REMOTE,'${top_builddir}/libproto/remote/libmu_remotembox.la')
 AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la')
 AC_SUBST(MU_LIB_SCM,'${top_builddir}/libmu_scm/libmu_scm.la')
 AC_SUBST(MU_LIB_CPP,'${top_builddir}/libmu_cpp/libmu_cpp.la')
@@ -1308,7 +1307,6 @@ AC_CONFIG_FILES([Makefile
  libproto/nntp/Makefile
  libproto/imap/Makefile
  libproto/include/Makefile
- libproto/remote/Makefile
  maidag/Makefile
  mail/Makefile
  mail/testsuite/Makefile
diff --git a/include/mailutils/registrar.h b/include/mailutils/registrar.h
index 818badc..6462054 100644
--- a/include/mailutils/registrar.h
+++ b/include/mailutils/registrar.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2004, 2005, 2006,
-   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
@@ -114,8 +114,6 @@ extern mu_record_t mu_mbox_record;
 extern mu_record_t mu_mh_record;
 /* Maildir, "maildir:" */
 extern mu_record_t mu_maildir_record;
-/* Remote mailbox */
-extern mu_record_t mu_remote_mbox_record;
   
 #define MU_IMAP_PRIO        100
 #define MU_POP_PRIO         200
@@ -125,7 +123,6 @@ extern mu_record_t mu_remote_mbox_record;
 #define MU_NNTP_PRIO        600
 #define MU_PATH_PRIO        1000
   
-#define MU_REMOTE_MBOX_PRIO 10000
 #define MU_SMTP_PRIO        10000
 #define MU_SENDMAIL_PRIO    10000
 #define MU_PROG_PRIO        10000
diff --git a/libmu_argp/mu_argp.h b/libmu_argp/mu_argp.h
index 1b316fa..0c20be2 100644
--- a/libmu_argp/mu_argp.h
+++ b/libmu_argp/mu_argp.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005,
-   2007 Free Software Foundation, Inc.
+   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
@@ -37,7 +37,6 @@ extern void mu_argp_done (struct argp *argp);
 extern int mu_register_argp_capa (const char *name, struct argp_child *child);
 
 extern void mu_print_options (void);
-extern const char *mu_check_option (char *name);
   
 #ifdef __cplusplus
 }
diff --git a/libproto/Makefile.am b/libproto/Makefile.am
index 591ef65..2cc7634 100644
--- a/libproto/Makefile.am
+++ b/libproto/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+##   Copyright (C) 2006, 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
@@ -17,5 +17,5 @@
 ##   Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
 ##   02110-1301 USA
 
-SUBDIRS = include mbox pop nntp imap mh maildir mailer remote
+SUBDIRS = include mbox pop nntp imap mh maildir mailer
 
diff --git a/libproto/include/mailer0.h b/libproto/include/mailer0.h
index 40fd56d..49d1414 100644
--- a/libproto/include/mailer0.h
+++ b/libproto/include/mailer0.h
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2005, 2007  Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 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
@@ -57,6 +58,9 @@ struct _mu_mailer
   int (*_send_message) (mu_mailer_t, mu_message_t, mu_address_t, mu_address_t);
 };
 
+int _mu_mailer_mailbox_init (mu_mailbox_t mailbox);
+int _mu_mailer_folder_init (mu_folder_t folder MU_ARG_UNUSED);
+  
 #define MAILER_NOTIFY(mailer, type) \
   if (mailer->observer) observer_notify (mailer->observer, type)
 
diff --git a/libproto/include/registrar0.h b/libproto/include/registrar0.h
index a535846..89abb6f 100644
--- a/libproto/include/registrar0.h
+++ b/libproto/include/registrar0.h
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2004, 2005, 2007, 2008 Free Software Foundation, 
Inc.
+   Copyright (C) 1999, 2000, 2004, 2005, 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
@@ -73,16 +74,14 @@ extern int _folder_path_init      (mu_folder_t);
 #define MU_SMTP_SCHEME "smtp"
 #define MU_SMTP_SCHEME_LEN (sizeof (MU_SMTP_SCHEME) - 1)
 #define MU_SMTP_PORT 25
-extern int _url_smtp_init         (mu_url_t);
-extern int _mailer_smtp_init      (mu_mailer_t);
 
 #define MU_SENDMAIL_SCHEME "sendmail"
 #define MU_SENDMAIL_SCHEME_LEN (sizeof (MU_SENDMAIL_SCHEME) - 1)
-extern int _url_sendmail_init     (mu_url_t);
-extern int _mailer_sendmail_init  (mu_mailer_t);
-
+extern int _mu_mailer_sendmail_init (mu_mailer_t mailer);
+  
 #define MU_PROG_SCHEME "prog"
 #define MU_PROG_SCHEME_LEN (sizeof (MU_PROG_SCHEME) - 1)
+  extern int _mu_mailer_prog_init  (mu_mailer_t);  
   
 #define MU_MH_SCHEME "mh"
 #define MU_MH_SCHEME_LEN (sizeof (MU_MH_SCHEME) - 1)
diff --git a/libproto/include/url0.h b/libproto/include/url0.h
index d47af57..5931d0e 100644
--- a/libproto/include/url0.h
+++ b/libproto/include/url0.h
@@ -59,6 +59,7 @@ struct _mu_url
   int   (*_get_port)   (const mu_url_t, long *);
   int   (*_get_path)   (const mu_url_t, char *, size_t, size_t *);
   int   (*_get_query)  (const mu_url_t, char *, size_t, size_t *);
+  int   (*_uplevel)    (const mu_url_t, mu_url_t *);
 };
 
 
diff --git a/libproto/mailer/Makefile.am b/libproto/mailer/Makefile.am
index 592e9d8..3513f9e 100644
--- a/libproto/mailer/Makefile.am
+++ b/libproto/mailer/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+##   Copyright (C) 2007, 2008, 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
@@ -24,9 +24,9 @@ libmu_mailer_la_LDFLAGS=-version-info 
@VI_CURRENT@:@VI_REVISION@:@VI_AGE@
 libmu_mailer_la_LIBADD = ${MU_LIB_AUTH} ${MU_LIB_MAILUTILS} @INTLLIBS@
 
 libmu_mailer_la_SOURCES = \
+ mbox.c\
  prog.c\
  sendmail.c\
  smtp.c\
- url_sendmail.c\
- url_smtp.c
+ remote.c
 
diff --git a/libproto/remote/mbox.c b/libproto/mailer/mbox.c
similarity index 89%
rename from libproto/remote/mbox.c
rename to libproto/mailer/mbox.c
index d4741c5..008f72a 100644
--- a/libproto/remote/mbox.c
+++ b/libproto/mailer/mbox.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -31,6 +31,7 @@
 #include <mailutils/url.h>
 #include <mailutils/mutil.h>
 #include <mailbox0.h>
+#include <mailer0.h>
 
 struct remote_mbox_data
 {
@@ -200,10 +201,9 @@ remote_sync (mu_mailbox_t mbox)
 }
 
 int
-remote_mbox_init (mu_mailbox_t mailbox)
+_mu_mailer_mailbox_init (mu_mailbox_t mailbox)
 {
   struct remote_mbox_data *dat;
-  const char *s, *p;
   int rc;
   mu_mailer_t mailer;
   mu_url_t url;
@@ -212,35 +212,18 @@ remote_mbox_init (mu_mailbox_t mailbox)
     return EINVAL;
 
   MU_DEBUG1 (mailbox->debug, MU_DEBUG_TRACE1,
-            "remote_mbox_init (%s)\n", mu_url_to_string (mailbox->url));
-  rc = mu_url_sget_scheme (mailbox->url, &s);
-  if (rc)
-    return rc;
-  p = strchr (s, '+');
-  if (!p)
-    {
-      MU_DEBUG2 (mailbox->debug, MU_DEBUG_ERROR,
-                "remote_mbox_init(%s): invalid url: %s\n",
-                mu_url_to_string (mailbox->url),
-                mu_strerror (rc));
-      return MU_ERR_MAILER_BAD_URL;
-    }
+            "_mu_mailer_mailbox_init(%s)\n",
+            mu_url_to_string (mailbox->url));
 
   rc = mu_url_dup (mailbox->url, &url);
   if (rc)
     return rc;
-  rc = mu_url_set_scheme (url, p + 1);
-  if (rc)
-    {
-      mu_url_destroy (&url);
-      return rc;
-    }
 
   rc = mu_mailer_create_from_url (&mailer, url);
   if (rc)
     {
       MU_DEBUG2 (mailbox->debug, MU_DEBUG_ERROR,
-                "remote_mbox_init(%s): cannot create mailer: %s\n",
+                "_mu_mailer_mailbox_init(%s): cannot create mailer: %s\n",
                 mu_url_to_string (url), mu_strerror (rc));
       mu_url_destroy (&url);
       return rc;
@@ -264,4 +247,9 @@ remote_mbox_init (mu_mailbox_t mailbox)
 
   return 0;
 }
-  
+
+int
+_mu_mailer_folder_init (mu_folder_t folder MU_ARG_UNUSED)
+{
+  return 0;
+}
diff --git a/libproto/mailer/prog.c b/libproto/mailer/prog.c
index 5884553..4f02b6b 100644
--- a/libproto/mailer/prog.c
+++ b/libproto/mailer/prog.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -39,16 +39,15 @@
 #include <registrar0.h>
 
 static int _url_prog_init     (mu_url_t);
-static int _mailer_prog_init  (mu_mailer_t);  
 
 static struct _mu_record _prog_record =
 {
   MU_PROG_PRIO,
   MU_PROG_SCHEME,
   _url_prog_init,    /* url init.  */
-  NULL,              /* Mailbox entry.  */
-  _mailer_prog_init, /* Mailer entry.  */
-  NULL, /* Folder entry.  */
+  _mu_mailer_mailbox_init,  /* Mailbox entry.  */
+  _mu_mailer_prog_init, /* Mailer entry.  */
+  _mu_mailer_folder_init, /* Folder entry.  */
   NULL, /* No need for a back pointer.  */
   NULL, /* _is_scheme method.  */
   NULL, /* _get_url method.  */
@@ -61,6 +60,12 @@ mu_record_t mu_prog_record = &_prog_record;
 
 
 static int
+_url_prog_uplevel (const mu_url_t orig, mu_url_t *up)
+{
+  return MU_ERR_NOENT;
+}
+
+static int
 _url_prog_init (mu_url_t url)
 {
   /* not valid in a prog url */
@@ -68,6 +73,7 @@ _url_prog_init (mu_url_t url)
     return EINVAL;
   if (!url->path)
     return EINVAL;
+  url->_uplevel = _url_prog_uplevel;
   return 0;
 }
 
@@ -78,8 +84,8 @@ static int prog_close (mu_mailer_t);
 static int prog_send_message (mu_mailer_t, mu_message_t, mu_address_t,
                              mu_address_t);
 
-static int
-_mailer_prog_init (mu_mailer_t mailer)
+int
+_mu_mailer_prog_init (mu_mailer_t mailer)
 {
   int status;
   mu_progmailer_t pm;
diff --git a/libproto/mailer/remote.c b/libproto/mailer/remote.c
new file mode 100644
index 0000000..b6fa83a
--- /dev/null
+++ b/libproto/mailer/remote.c
@@ -0,0 +1,148 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 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
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General
+   Public License along with this library.  If not,
+   see <http://www.gnu.org/licenses/>. */
+
+/* This file provides backward-compatible "remote+" mailbox types,
+   introduced in v. 2.0.
+
+   They are only used by maidag.
+
+   This file will be removed in v. 2.2
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef ENABLE_SMTP
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <mailutils/errno.h>
+#include <mailutils/error.h>
+#include <mailutils/diag.h>
+
+#include <url0.h>
+#include <mailer0.h>
+#include <registrar0.h>
+
+static int
+_url_remote_init (mu_url_t url, const char *new_scheme)
+{
+  char *scheme;
+  mu_record_t record;
+  int rc;
+  
+  mu_diag_output (MU_DIAG_WARNING,
+                 "%s: this URL scheme is deprecated, use %s instead",
+                 url->name, new_scheme);
+
+  rc = mu_registrar_lookup_scheme (new_scheme, &record);
+  if (rc)
+    return rc;
+
+  scheme = strdup (new_scheme);
+  if (!scheme)
+    return ENOMEM;
+  
+  free (url->scheme);
+  url->scheme = scheme;
+  
+  return record->_url ? record->_url (url) : 0;
+}
+
+
+static int
+_url_remote_smtp_init (mu_url_t url)
+{
+  return _url_remote_init (url, "smtp");
+}
+
+static struct _mu_record _mu_remote_smtp_record = {
+  MU_SMTP_PRIO,
+  "remote+smtp",
+  _url_remote_smtp_init,       /* url init.  */
+  _mu_mailer_mailbox_init,      /* Mailbox init.  */
+  NULL,                                /* Mailer init.  */
+  _mu_mailer_folder_init,      /* Folder init.  */
+  NULL,                                /* No need for a back pointer.  */
+  NULL,                                /* _is_scheme method.  */
+  NULL,                                /* _get_url method.  */
+  NULL,                                /* _get_mailbox method.  */
+  NULL,                                /* _get_mailer method.  */
+  NULL                         /* _get_folder method.  */
+};
+
+mu_record_t mu_remote_smtp_record = &_mu_remote_smtp_record;
+
+
+static int
+_url_remote_sendmail_init (mu_url_t url)
+{
+  return _url_remote_init (url, "sendmail");
+}
+
+static struct _mu_record _mu_remote_sendmail_record =
+{
+  MU_SENDMAIL_PRIO,
+  "remote+sendmail",
+  _url_remote_sendmail_init,    /* url init.  */
+  _mu_mailer_mailbox_init,      /* Mailbox entry.  */
+  _mu_mailer_sendmail_init, /* Mailer entry.  */
+  _mu_mailer_folder_init, /* Folder entry.  */
+  NULL, /* No need for a back pointer.  */
+  NULL, /* _is_scheme method.  */
+  NULL, /* _get_url method.  */
+  NULL, /* _get_mailbox method.  */
+  NULL, /* _get_mailer method.  */
+  NULL  /* _get_folder method.  */
+};
+
+
+mu_record_t mu_remote_sendmail_record = &_mu_remote_sendmail_record;
+
+
+static int
+_url_remote_prog_init (mu_url_t url)
+{
+  return _url_remote_init (url, "prog");
+}
+
+static struct _mu_record _mu_remote_prog_record =
+{
+  MU_PROG_PRIO,
+  "remote+prog",
+  _url_remote_prog_init,    /* url init.  */
+  _mu_mailer_mailbox_init,  /* Mailbox entry.  */
+  _mu_mailer_prog_init, /* Mailer entry.  */
+  _mu_mailer_folder_init, /* Folder entry.  */
+  NULL, /* No need for a back pointer.  */
+  NULL, /* _is_scheme method.  */
+  NULL, /* _get_url method.  */
+  NULL, /* _get_mailbox method.  */
+  NULL, /* _get_mailer method.  */
+  NULL  /* _get_folder method.  */
+};
+
+mu_record_t mu_remote_prog_record = &_mu_remote_prog_record;
+
+
+#else
+mu_record_t mu_remote_smtp_record = NULL;
+mu_record_t mu_remote_sendmail_record = NULL;
+mu_record_t mu_remote_prog_record = NULL;
+#endif
diff --git a/libproto/mailer/sendmail.c b/libproto/mailer/sendmail.c
index 7773a7e..8588267 100644
--- a/libproto/mailer/sendmail.c
+++ b/libproto/mailer/sendmail.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005, 
-   2006, 2007, 2008 Free Software Foundation, Inc.
+   2006, 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
@@ -38,36 +38,34 @@
 #include <mailutils/errno.h>
 #include <mailutils/progmailer.h>
 
+#include <url0.h>
 #include <mailer0.h>
 #include <registrar0.h>
 
-static struct _mu_record _sendmail_record =
-{
-  MU_SENDMAIL_PRIO,
-  MU_SENDMAIL_SCHEME,
-  _url_sendmail_init,    /* url init.  */
-  NULL,                  /* Mailbox entry.  */
-  _mailer_sendmail_init, /* Mailer entry.  */
-  NULL, /* Folder entry.  */
-  NULL, /* No need for a back pointer.  */
-  NULL, /* _is_scheme method.  */
-  NULL, /* _get_url method.  */
-  NULL, /* _get_mailbox method.  */
-  NULL, /* _get_mailer method.  */
-  NULL  /* _get_folder method.  */
-};
-/* We export, url parsing and the initialisation of
-   the mailbox, via the register entry/record.  */
-mu_record_t mu_sendmail_record = &_sendmail_record;
-
 static void sendmail_destroy (mu_mailer_t);
 static int sendmail_open (mu_mailer_t, int);
 static int sendmail_close (mu_mailer_t);
 static int sendmail_send_message (mu_mailer_t, mu_message_t, mu_address_t,
                                  mu_address_t);
 
+
+static int
+_url_sendmail_init (mu_url_t url)
+{
+  /* not valid in a sendmail url */
+  if (url->user || url->passwd || url->auth || url->qargc
+      || url->host || url->port)
+    return EINVAL;
+
+  if (url->path == 0)
+    if ((url->path = strdup (_PATH_SENDMAIL)) == 0)
+      return ENOMEM;
+
+  return 0;
+}
+
 int
-_mailer_sendmail_init (mu_mailer_t mailer)
+_mu_mailer_sendmail_init (mu_mailer_t mailer)
 {
   int status;
   mu_progmailer_t pm;
@@ -272,6 +270,25 @@ sendmail_send_message (mu_mailer_t mailer, mu_message_t 
msg, mu_address_t from,
   return status;
 }
 
+static struct _mu_record _sendmail_record =
+{
+  MU_SENDMAIL_PRIO,
+  MU_SENDMAIL_SCHEME,
+  _url_sendmail_init,    /* url init.  */
+  _mu_mailer_mailbox_init,     /* Mailbox entry.  */
+  _mu_mailer_sendmail_init, /* Mailer entry.  */
+  _mu_mailer_folder_init, /* Folder entry.  */
+  NULL, /* No need for a back pointer.  */
+  NULL, /* _is_scheme method.  */
+  NULL, /* _get_url method.  */
+  NULL, /* _get_mailbox method.  */
+  NULL, /* _get_mailer method.  */
+  NULL  /* _get_folder method.  */
+};
+/* We export, url parsing and the initialisation of
+   the mailbox, via the register entry/record.  */
+mu_record_t mu_sendmail_record = &_sendmail_record;
+
 #else
 #include <stdio.h>
 #include <registrar0.h>
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index 9e184cd..da5e820 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005,
-   2006, 2007 Free Software Foundation, Inc.
+   2006, 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
@@ -51,15 +51,38 @@
 #include <mailutils/tls.h>
 
 #include <mailer0.h>
+#include <url0.h>
 #include <registrar0.h>
 
+static int _mailer_smtp_init (mu_mailer_t);
+
+static int
+_url_smtp_init (mu_url_t url)
+{
+  /* host isn't optional */
+  if (!url->host)
+    return EINVAL;
+
+  /* accept url->user, pass, and auth
+     for the ESMTP authentication */
+
+  /* all other fields must be NULL */
+  if (url->path || url->qargc)
+    return EINVAL;
+
+  if (url->port == 0)
+    url->port = MU_SMTP_PORT;
+  
+  return 0;
+}
+
 static struct _mu_record _smtp_record = {
   MU_SMTP_PRIO,
   MU_SMTP_SCHEME,
   _url_smtp_init,              /* url init.  */
-  NULL,                                /* Mailbox init.  */
-  &_mailer_smtp_init,          /* Mailer init.  */
-  NULL,                                /* Folder init.  */
+  _mu_mailer_mailbox_init,      /* Mailbox init.  */
+  _mailer_smtp_init,           /* Mailer init.  */
+  _mu_mailer_folder_init,      /* Folder init.  */
   NULL,                                /* No need for a back pointer.  */
   NULL,                                /* _is_scheme method.  */
   NULL,                                /* _get_url method.  */
@@ -248,7 +271,7 @@ do \
    }  \
 while (0)
 
-int
+static int
 _mailer_smtp_init (mu_mailer_t mailer)
 {
   smtp_t smtp;
@@ -486,6 +509,7 @@ smtp_close (mu_mailer_t mailer)
   return mu_stream_close (mailer->stream);
 }
 
+#ifdef WITH_TLS
 /*
   Client side STARTTLS support.
  */
@@ -524,6 +548,7 @@ smtp_stream_ctl (void *iodata, mu_stream_t *pold, 
mu_stream_t new)
   if (new)
     iop->mailer->stream = new;
 }
+#endif
 
 static int
 smtp_starttls (smtp_t smtp)
@@ -1195,4 +1220,5 @@ smtp_readline (smtp_t smtp)
 #include <stdio.h>
 #include <registrar0.h>
 mu_record_t mu_smtp_record = NULL;
+mu_record_t mu_remote_smtp_record = NULL;
 #endif
diff --git a/libproto/mailer/url_sendmail.c b/libproto/mailer/url_sendmail.c
deleted file mode 100644
index 8ad8e70..0000000
--- a/libproto/mailer/url_sendmail.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2007 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
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General
-   Public License along with this library; if not, write to the
-   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301 USA */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef ENABLE_SENDMAIL
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_PATHS_H
-# include <paths.h>
-#endif
-
-#ifndef _PATH_SENDMAIL
-# define _PATH_SENDMAIL "/usr/lib/sendmail"
-#endif
-
-#include <registrar0.h>
-#include <url0.h>
-
-/*
-  Sendmail URL:
-    sendmail:/path/to/sendmail
-*/
-
-int
-_url_sendmail_init (mu_url_t url)
-{
-  /* not valid in a sendmail url */
-  if (url->user || url->passwd || url->auth || url->qargc
-      || url->host || url->port)
-    return EINVAL;
-
-  if (url->path == 0)
-    if ((url->path = strdup (_PATH_SENDMAIL)) == 0)
-      return ENOMEM;
-
-  return 0;
-}
-
-#endif /* ENABLE_SENDMAIL */
diff --git a/libproto/mailer/url_smtp.c b/libproto/mailer/url_smtp.c
deleted file mode 100644
index 13eb436..0000000
--- a/libproto/mailer/url_smtp.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2005, 2007 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
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General
-   Public License along with this library; if not, write to the
-   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301 USA */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef ENABLE_SMTP
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <registrar0.h>
-#include <url0.h>
-
-int
-_url_smtp_init (mu_url_t url)
-{
-  /* host isn't optional */
-  if (!url->host)
-    return EINVAL;
-
-  /* accept url->user, pass, and auth
-     for the ESMTP authentication */
-
-  /* all other fields must be NULL */
-  if (url->path || url->qargc)
-    return EINVAL;
-
-  if (url->port == 0)
-    url->port = MU_SMTP_PORT;
-  
-  return 0;
-}
-
-#endif /* ENABLE_SMTP */
diff --git a/libproto/remote/.gitignore b/libproto/remote/.gitignore
deleted file mode 100644
index a343739..0000000
--- a/libproto/remote/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.la
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
-T
-_*
-.gdbinit
diff --git a/libproto/remote/Makefile.am b/libproto/remote/Makefile.am
deleted file mode 100644
index 11423c2..0000000
--- a/libproto/remote/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2007 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 the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-INCLUDES = @MU_COMMON_INCLUDES@ -I${top_srcdir}/libproto/include 
-
-lib_LTLIBRARIES = libmu_remotembox.la
-libmu_remotembox_la_LDFLAGS=-version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
-libmu_remotembox_la_LIBADD = ${MU_LIB_MAILUTILS} ${MU_LIB_MAILER}
-libmu_remotembox_la_SOURCES = \
- folder.c\
- mbox.c
-
-
diff --git a/libproto/remote/folder.c b/libproto/remote/folder.c
deleted file mode 100644
index a9fa675..0000000
--- a/libproto/remote/folder.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007, 2008 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
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General
-   Public License along with this library; if not, write to the
-   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301 USA */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <mailutils/errno.h>
-#include <mailutils/error.h>
-#include <mailutils/url.h>
-#include <mailbox0.h>
-#include <url0.h>
-#include <folder0.h>
-#include <registrar0.h>
-
-#define MU_REMOTE_MBOX_PREFIX "remote+"
-#define MU_REMOTE_MBOX_PREFIX_LEN (sizeof (MU_REMOTE_MBOX_PREFIX) - 1)
-
-extern int remote_mbox_init (mu_mailbox_t mailbox);
-
-static int
-remote_folder_init (mu_folder_t folder MU_ARG_UNUSED)
-{
-  return 0;
-}
-
-static int
-_remote_is_scheme (mu_record_t record, mu_url_t url, int flags)
-{
-  char *scheme = url->scheme;
-  size_t scheme_len = scheme ? strlen (scheme) : 0;
-  struct _mu_url s_url;
-  
-  if (!scheme
-      || scheme_len < MU_REMOTE_MBOX_PREFIX_LEN
-      || memcmp (MU_REMOTE_MBOX_PREFIX, scheme,
-                MU_REMOTE_MBOX_PREFIX_LEN) != 0)
-    return 0;
-
-  
-  memcpy (&s_url, url, sizeof (s_url));
-  s_url.scheme = scheme + MU_REMOTE_MBOX_PREFIX_LEN;
-  if (mu_registrar_lookup_url (&s_url, 0, NULL, NULL) == 0)
-    return MU_FOLDER_ATTRIBUTE_FILE;
-  return 0;
-}
-
-static struct _mu_record _remote_mbox_record =
-{
-  MU_REMOTE_MBOX_PRIO,
-  MU_REMOTE_MBOX_PREFIX,
-  NULL, /* URL init.  */
-  remote_mbox_init, /* Mailbox init.  */
-  NULL, /* Mailer init.  */
-  remote_folder_init, /* Folder init.  */
-  NULL, /* No need for back pointer.  */
-  _remote_is_scheme, /* _is_scheme method.  */
-  NULL, /* _get_url method.  */
-  NULL, /* _get_mailbox method.  */
-  NULL, /* _get_mailer method.  */
-  NULL  /* _get_folder method.  */
-};
-mu_record_t mu_remote_mbox_record = &_remote_mbox_record;
diff --git a/maidag/Makefile.am b/maidag/Makefile.am
index cb4a8ff..24b73bc 100644
--- a/maidag/Makefile.am
+++ b/maidag/Makefile.am
@@ -47,7 +47,6 @@ maidag_LDADD = \
  ${MU_LIB_MAILDIR}\
  ${MU_LIB_AUTH}\
  ${MU_LIB_MAILER}\
- ${MU_LIB_REMOTE}\
  @address@hidden
  ${MU_LIB_MAILUTILS} \
  @address@hidden
diff --git a/maidag/deliver.c b/maidag/deliver.c
index e8a5b07..87e3cd0 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2005,
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 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
@@ -285,9 +285,6 @@ is_mailer_url (mu_url_t url)
          && pfn;
 }
 
-#define REMOTE_PREFIX "remote+"
-#define REMOTE_PREFIX_LEN (sizeof(REMOTE_PREFIX)-1)
-
 int
 deliver_url (mu_url_t url, mu_message_t msg, const char *name, char **errp)
 {
@@ -352,33 +349,6 @@ deliver_url (mu_url_t url, mu_message_t msg, const char 
*name, char **errp)
        }
     }      
 
-  if (is_mailer_url (url))
-    {
-      const char *scheme;
-      size_t len;
-      char *new_scheme;
-      
-      mu_url_sget_scheme (url, &scheme);
-      len = REMOTE_PREFIX_LEN + strlen (scheme);
-      new_scheme = malloc (len + 1);
-      if (!new_scheme)
-       {
-         mu_error (_("Not enough memory"));
-         exit (EX_SOFTWARE);
-       }
-      strcat (strcpy (new_scheme, REMOTE_PREFIX), scheme);
-      status = mu_url_set_scheme (url, new_scheme);
-      free (new_scheme);
-      if (status)
-       {
-         errno = status;
-         maidag_error (_("Cannot modify URL %s: %s"),
-                       mu_url_to_string (url),
-                       mu_strerror (status));
-         mu_auth_data_free (auth);
-         return EX_TEMPFAIL;
-       }
-    }
   status = mu_mailbox_create_from_url (&mbox, url);
 
   if (status)
@@ -439,7 +409,7 @@ deliver (mu_message_t msg, char *dest_id, char **errp)
            {
              maidag_error (_("no user name"));
              if (errp)
-               asprintf (errp, "no user such");
+               asprintf (errp, "no such user");
              exit_code = EX_NOUSER;
              return EX_NOUSER;
            }
diff --git a/maidag/guile.c b/maidag/guile.c
index ce374be..44b08a6 100644
--- a/maidag/guile.c
+++ b/maidag/guile.c
@@ -39,9 +39,9 @@ scheme_check_msg (mu_message_t msg, struct mu_auth_data *auth,
          
          mu_diag_get_debug (&debug);
          port = mu_scm_make_debug_port (debug, MU_DIAG_ERROR);
-         scm_set_current_error_port(port);
+         scm_set_current_error_port (port);
          port = mu_scm_make_debug_port (debug, MU_DIAG_INFO);
-         scm_set_current_output_port(port);
+         scm_set_current_output_port (port);
        }
       initialized = 1;
     }
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 94aaa03..f0ccefc 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 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
@@ -470,6 +470,12 @@ maidag_cfg_init ()
     }
 }
 
+/* FIXME: These are for compatibility with MU 2.0.
+   Remove in 2.2 */
+extern mu_record_t mu_remote_smtp_record;
+extern mu_record_t mu_remote_sendmail_record;
+extern mu_record_t mu_remote_prog_record;
+
 
 int
 main (int argc, char *argv[])
@@ -497,8 +503,11 @@ main (int argc, char *argv[])
   mu_register_all_formats ();
   mu_registrar_record (mu_smtp_record);
 
-  /* Register a special mailbox */
-  mu_registrar_record (mu_remote_mbox_record);
+  /* FIXME: These are for compatibility with MU 2.0.
+     Remove in 2.1 */
+  mu_registrar_record (mu_remote_smtp_record);
+  mu_registrar_record (mu_remote_sendmail_record);
+  mu_registrar_record (mu_remote_prog_record);
   
   mu_gocs_register ("sieve", mu_sieve_module_init);
 
diff --git a/mailbox/mailbox.c b/mailbox/mailbox.c
index 6864bef..aeb22c6 100644
--- a/mailbox/mailbox.c
+++ b/mailbox/mailbox.c
@@ -101,20 +101,12 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, 
const char *name)
              return status;
            }
 
-         mu_record_get_url (record, &u_init);
-         if (u_init && (status = u_init (url)) != 0)
-           {
-             mu_mailbox_destroy (&mbox);
-             return status;
-           }
-
          /* Make sure scheme contains actual mailbox scheme */
          /* FIXME: It is appropriate not for all record types.  For now we
             assume that if the record scheme ends with a plus sign, this
             should not be done.  Probably it requires some flag in struct
             _mu_record? */
-         if (record->scheme[strlen(record->scheme)-1] != '+' 
-             && strcmp (url->scheme, record->scheme))
+         if (strcmp (url->scheme, record->scheme))
            {
              char *p = strdup (record->scheme);
              if (!p)
@@ -126,6 +118,13 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const 
char *name)
              url->scheme = p;
            }
 
+         mu_record_get_url (record, &u_init);
+         if (u_init && (status = u_init (url)) != 0)
+           {
+             mu_mailbox_destroy (&mbox);
+             return status;
+           }
+
          mbox->url = url;
 
          /* Create the folder before initializing the concrete mailbox.
diff --git a/mailbox/url.c b/mailbox/url.c
index 3bbea29..8bbdfba 100644
--- a/mailbox/url.c
+++ b/mailbox/url.c
@@ -188,6 +188,9 @@ mu_url_uplevel (mu_url_t url, mu_url_t *upurl)
   int rc;
   char *p;
   mu_url_t new_url;
+
+  if (url->_uplevel)
+    return url->_uplevel (url, upurl);
   
   if (!url->path)
     return MU_ERR_NOENT;


hooks/post-receive
--
GNU Mailutils




reply via email to

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