commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-595-gac04b91


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-595-gac04b91
Date: Wed, 09 May 2012 10:30:45 +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=ac04b91746a9192b6492fa43fe56200a8c21c65c

The branch, master has been updated
       via  ac04b91746a9192b6492fa43fe56200a8c21c65c (commit)
       via  0256b723be3917f3fd608900fe758065e6166555 (commit)
       via  655279cde3acb090140d2ef80cda110ceb1e526a (commit)
       via  a67f251ccff25204bce34a134adf5e1225dd18bb (commit)
      from  e6ae2852edb142fcf84dc489715f8984843dfe0c (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 ac04b91746a9192b6492fa43fe56200a8c21c65c
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed May 9 13:11:34 2012 +0300

    Fix handling of URL authentication credentials in SMTP AUTH.
    
    Provide special functions for storing and retrieving URL from
    mu_smtp_t object, instead of using MU_SMTP_PARAM_URL.  The major
    drawback of the latter is that URLs in textual form can contain
    obfuscated access credentials, which makes them unusable for
    authentication.
    
    * include/mailutils/smtp.h (mu_smtp_set_url)
    (mu_smtp_get_url)
    (mu_smtp_set_secret,mu_smtp_get_secret): New protos.
    * include/mailutils/sys/smtp.h (_mu_smtp) <url>: New member.
    * libproto/mailer/smtp_secret.c: New file.
    * libproto/mailer/smtp_url.c: New file.
    * libproto/mailer/Makefile.am (libmu_mailer_la_SOURCES): Add new files.
    * libproto/mailer/smtp.c (smtp_open): Use mu_smtp_set_url to preserve
    URL credentials.
    * libproto/mailer/smtp_auth.c (_mu_smtp_fixup_params): Use smtp->url.
    * libproto/mailer/smtp_create.c (mu_smtp_destroy): Destroy smtp->url.
    * libproto/mailer/smtp_param.c (mu_smtp_set_param): Special
    handling for MU_SMTP_PARAM_URL.
    (mu_smtp_get_param): Likewise.

commit 0256b723be3917f3fd608900fe758065e6166555
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed May 9 12:10:40 2012 +0300

    Fix quoted-printable and Q encodings.
    
    The Q encoding in RFC 2047 is not exactly the same as Quoted-Printable
    encoding: it differs in its handling of space characters (ASCII 32),
    which are encoded as underscores.
    
    * libmailutils/filter/qpflt.c (_qp_decoder): Use xd parameter
    to determine whether to treat underscores specially.
    (_qp_encoder): Likewise.
    (_qp_filter,_Q_filter): Allocate and initialize filter data
    accordingly to the kind of encoding.

commit 655279cde3acb090140d2ef80cda110ceb1e526a
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed May 9 12:04:29 2012 +0300

    Remove get_stream methods from folder and mailbox.
    
    * doc/texinfo/folder.texi: Update
    * include/mailutils/cpp/folder.h (Folder) <set_stream>
    <get_stream>: Remove.
    * include/mailutils/folder.h (mu_folder_get_stream)
    (mu_folder_get_streamref)
    (mu_folder_set_stream): Remove.
    * include/mailutils/mailbox.h (mu_folder_get_stream)
    (mu_folder_get_streamref)
    (mu_folder_set_stream): Remove protos.
    * include/mailutils/sys/folder.h (_mu_folder)<stream>: Remove.
    All uses updated.
    * libmailutils/mailbox/folder.c (mu_folder_set_stream)
    (mu_folder_get_stream,mu_folder_get_streamref): Remove.
    * libmailutils/mailbox/mailbox.c (mu_mailbox_get_stream)
    (mu_mailbox_get_streamref): Remove.
    * libmu_cpp/folder.cc (get_stream, set_stream): Remove.
    * libmu_scm/mu_mailbox.c (mu-mailbox-get-port): Remove.
    * python/libmu_py/folder.c (get_stream): Remove.

commit a67f251ccff25204bce34a134adf5e1225dd18bb
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed May 9 12:02:17 2012 +0300

    Minor fix
    
    * configure.ac: Fix quoting in FriBidi test.

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

Summary of changes:
 configure.ac                                   |    4 +-
 doc/texinfo/folder.texi                        |    6 ---
 include/mailutils/cpp/folder.h                 |    3 -
 include/mailutils/folder.h                     |    8 ----
 include/mailutils/mailbox.h                    |    6 ---
 include/mailutils/smtp.h                       |    5 ++
 include/mailutils/sys/folder.h                 |    1 -
 include/mailutils/sys/smtp.h                   |    1 +
 libmailutils/filter/qpflt.c                    |   47 ++++++++++++++++++----
 libmailutils/mailbox/folder.c                  |   36 -----------------
 libmailutils/mailbox/mailbox.c                 |   49 ------------------------
 libmu_cpp/folder.cc                            |   20 ----------
 libmu_scm/mu_mailbox.c                         |   29 --------------
 libproto/mailer/Makefile.am                    |    4 +-
 libproto/mailer/smtp.c                         |    3 +-
 libproto/mailer/smtp_auth.c                    |   21 +++-------
 libproto/mailer/smtp_create.c                  |    2 +
 libproto/mailer/smtp_param.c                   |   21 ++++++++++
 libproto/mailer/{smtp_open.c => smtp_secret.c} |   39 +++++++++++--------
 libproto/mailer/{smtp_capa.c => smtp_url.c}    |   35 +++++++++--------
 python/libmu_py/folder.c                       |   19 ---------
 21 files changed, 120 insertions(+), 239 deletions(-)
 copy libproto/mailer/{smtp_open.c => smtp_secret.c} (64%)
 copy libproto/mailer/{smtp_capa.c => smtp_url.c} (66%)

diff --git a/configure.ac b/configure.ac
index 221b6e0..cb07ad4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -763,8 +763,8 @@ if test "$use_fribidi" = "yes"; then
                   FRIBIDI_LIBS=-lfribidi],
                  [use_fribidi=no])
 
-    AC_RUN_IFELSE(AC_LANG_PROGRAM([#include <fribidi/fribidi.h>],
-                                  [FriBidiCharSet s = 
FRIBIDI_CHARSET_CAP_RTL;]),
+    AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <fribidi/fribidi.h>],
+                                  [FriBidiCharSet s = 
FRIBIDI_CHARSET_CAP_RTL;])],
                   [AC_DEFINE(HAVE_FRIBIDI_CHARSET_CAP_RTL)])
                  
   else
diff --git a/doc/texinfo/folder.texi b/doc/texinfo/folder.texi
index dbb5390..3d62905 100644
--- a/doc/texinfo/folder.texi
+++ b/doc/texinfo/folder.texi
@@ -83,12 +83,6 @@ struct mu_list_response
 @c Stream Settings.
 @c
 
address@hidden  int mu_folder_get_stream (mu_folder_t, mu_stream_t *)
address@hidden deftypefun
-
address@hidden  int mu_folder_set_stream (mu_folder_t, mu_stream_t)
address@hidden deftypefun
-
 @c
 @c Notifications.
 @c
diff --git a/include/mailutils/cpp/folder.h b/include/mailutils/cpp/folder.h
index afa8b48..158e5fd 100644
--- a/include/mailutils/cpp/folder.h
+++ b/include/mailutils/cpp/folder.h
@@ -48,9 +48,6 @@ class Folder
                   int flags, size_t max_level,
                   mu_folder_enumerate_fp enumfun, void* enumdata);
 
-  Stream& get_stream ();
-  void set_stream (const Stream& stream);
-
   Url& get_url ();
 };
 
diff --git a/include/mailutils/folder.h b/include/mailutils/folder.h
index 9036249..fe0d3b5 100644
--- a/include/mailutils/folder.h
+++ b/include/mailutils/folder.h
@@ -61,14 +61,6 @@ extern int  mu_folder_enumerate      (mu_folder_t, const 
char *,
 extern int  mu_folder_lsub           (mu_folder_t, const char *, const char *,
                                      mu_list_t *);
 
-/* Stream settings. Don't use these functions.
-   FIXME: To be removed. */
-extern int  mu_folder_get_stream     (mu_folder_t, mu_stream_t *)
-                                       __attribute__ ((deprecated));
-extern int  mu_folder_get_streamref  (mu_folder_t, mu_stream_t *);
-  
-extern int  mu_folder_set_stream     (mu_folder_t, mu_stream_t);
-
   /* Match function */
 extern int mu_folder_set_match (mu_folder_t folder, mu_folder_match_fp pmatch);
 extern int mu_folder_get_match (mu_folder_t folder,
diff --git a/include/mailutils/mailbox.h b/include/mailutils/mailbox.h
index 4a2d8c2..f2a6ecd 100644
--- a/include/mailutils/mailbox.h
+++ b/include/mailutils/mailbox.h
@@ -86,12 +86,6 @@ extern int  mu_mailbox_get_size        (mu_mailbox_t, 
mu_off_t *size);
 extern int  mu_mailbox_is_updated      (mu_mailbox_t);
 extern int  mu_mailbox_scan            (mu_mailbox_t, size_t no, size_t 
*count);
 
-/* Mailbox Stream.  */
-extern int  mu_mailbox_set_stream      (mu_mailbox_t, mu_stream_t);
-extern int  mu_mailbox_get_stream      (mu_mailbox_t, mu_stream_t *)
-                                         __attribute__ ((deprecated));
-extern int  mu_mailbox_get_streamref   (mu_mailbox_t, mu_stream_t *);
-
 /* Lock settings.  */
 extern int  mu_mailbox_get_locker      (mu_mailbox_t, mu_locker_t *);
 extern int  mu_mailbox_set_locker      (mu_mailbox_t, mu_locker_t);
diff --git a/include/mailutils/smtp.h b/include/mailutils/smtp.h
index 61911f0..4ae6a33 100644
--- a/include/mailutils/smtp.h
+++ b/include/mailutils/smtp.h
@@ -55,6 +55,11 @@ int mu_smtp_disconnect (mu_smtp_t smtp);
 int mu_smtp_ehlo (mu_smtp_t smtp);
 int mu_smtp_set_param (mu_smtp_t smtp, int code, const char *val);
 int mu_smtp_get_param (mu_smtp_t smtp, int code, const char **param);
+int mu_smtp_set_url (mu_smtp_t smtp, mu_url_t url);
+int mu_smtp_get_url (mu_smtp_t smtp, mu_url_t *purl);
+int mu_smtp_set_secret (mu_smtp_t smtp, mu_secret_t secret);
+int mu_smtp_get_secret (mu_smtp_t smtp, mu_secret_t *secret);
+
 int mu_smtp_capa_test (mu_smtp_t smtp, const char *capa, const char **pret);
 int mu_smtp_starttls (mu_smtp_t smtp);
 
diff --git a/include/mailutils/sys/folder.h b/include/mailutils/sys/folder.h
index 6f4b623..f550818 100644
--- a/include/mailutils/sys/folder.h
+++ b/include/mailutils/sys/folder.h
@@ -38,7 +38,6 @@ struct _mu_folder
   mu_authority_t authority;
   mu_observable_t observable;
   mu_property_t property;
-  mu_stream_t stream;
   mu_monitor_t monitor;
   mu_url_t url;
   int flags;
diff --git a/include/mailutils/sys/smtp.h b/include/mailutils/sys/smtp.h
index f9b01b8..82b566c 100644
--- a/include/mailutils/sys/smtp.h
+++ b/include/mailutils/sys/smtp.h
@@ -57,6 +57,7 @@ struct _mu_smtp
   
   /* User-supplied data */
   char *param[MU_SMTP_MAX_PARAM];
+  mu_url_t url;
   mu_list_t authmech;          /* List of allowed authentication mechs */
   mu_secret_t secret;
   
diff --git a/libmailutils/filter/qpflt.c b/libmailutils/filter/qpflt.c
index 32ae165..0af82a7 100644
--- a/libmailutils/filter/qpflt.c
+++ b/libmailutils/filter/qpflt.c
@@ -25,7 +25,7 @@
 #define ISWS(c) ((c)==' ' || (c)=='\t')
 
 static enum mu_filter_result
-_qp_decoder (void *xd MU_ARG_UNUSED,
+_qp_decoder (void *xd,
             enum mu_filter_command cmd,
             struct mu_filter_io *iobuf)
 {
@@ -37,7 +37,8 @@ _qp_decoder (void *xd MU_ARG_UNUSED,
   size_t isize;
   char *optr;
   size_t osize;
-
+  int underscore_special = *(int*)xd;
+  
   switch (cmd)
     {
     case mu_filter_init:
@@ -142,7 +143,7 @@ _qp_decoder (void *xd MU_ARG_UNUSED,
                  consumed += 2;
                }
            }
-         else if (c == '_')
+         else if (underscore_special && c == '_')
            {
              *optr++ = ' ';
              nbytes++;
@@ -162,7 +163,7 @@ _qp_decoder (void *xd MU_ARG_UNUSED,
 }
 
 static enum mu_filter_result
-_qp_encoder (void *xd MU_ARG_UNUSED,
+_qp_encoder (void *xd,
             enum mu_filter_command cmd,
             struct mu_filter_io *iobuf)
 {
@@ -174,6 +175,7 @@ _qp_encoder (void *xd MU_ARG_UNUSED,
   size_t isize;
   char *optr;
   size_t osize;
+  int underscore_special = *(int*)xd;
 
   switch (cmd)
     {
@@ -201,7 +203,10 @@ _qp_encoder (void *xd MU_ARG_UNUSED,
       
       /* candidate byte to convert */
       c = *(unsigned char*) iptr;
-      simple_char = (c >= 32 && c <= 60)
+      if (underscore_special && c == '_')
+       simple_char = 0;
+      else
+       simple_char = (c >= 32 && c <= 60)
                       || (c >= 62 && c <= 126)
                       || c == '\t'
                       || c == '\n';
@@ -211,8 +216,10 @@ _qp_encoder (void *xd MU_ARG_UNUSED,
          /* a non-quoted character uses up one byte */
          if (nbytes + 1 > osize) 
            break;
-
-         *optr++ = c;
+         if (underscore_special && c == ' ')
+           *optr++ = '_';
+         else
+           *optr++ = c;
          nbytes++;
            
          iptr++;
@@ -241,18 +248,40 @@ _qp_encoder (void *xd MU_ARG_UNUSED,
   return mu_filter_ok;
 }
 
+static int
+alloc_qp (void **pret, int mode MU_ARG_UNUSED, int argc, const char **argv)
+{
+  int *x = malloc (sizeof (*x));
+  if (!x)
+    return ENOMEM;
+  *x = 0;
+  *pret = x;
+  return 0;
+}
+
 static struct _mu_filter_record _qp_filter = {
   "quoted-printable",
-  NULL,
+  alloc_qp,
   _qp_encoder,
   _qp_decoder
 };
 
 mu_filter_record_t mu_qp_filter = &_qp_filter;
 
+static int
+alloc_Q (void **pret, int mode MU_ARG_UNUSED, int argc, const char **argv)
+{
+  int *x = malloc (sizeof (*x));
+  if (!x)
+    return ENOMEM;
+  *x = 1;
+  *pret = x;
+  return 0;
+}
+
 static struct _mu_filter_record _Q_filter = {
   "Q",
-  NULL,
+  alloc_Q,
   _qp_encoder,
   _qp_decoder
 };
diff --git a/libmailutils/mailbox/folder.c b/libmailutils/mailbox/folder.c
index a3fdb54..028b9cc 100644
--- a/libmailutils/mailbox/folder.c
+++ b/libmailutils/mailbox/folder.c
@@ -31,7 +31,6 @@
 #include <mailutils/monitor.h>
 #include <mailutils/observer.h>
 #include <mailutils/registrar.h>
-#include <mailutils/stream.h>
 #include <mailutils/url.h>
 #include <mailutils/errno.h>
 #include <mailutils/property.h>
@@ -212,8 +211,6 @@ mu_folder_destroy (mu_folder_t *pfolder)
          mu_monitor_wrlock (monitor);
          if (folder->authority)
            mu_authority_destroy (&folder->authority, folder);
-         if (folder->stream)
-           mu_stream_destroy (&folder->stream);
          if (folder->url)
            mu_url_destroy (&folder->url);
          if (folder->property)
@@ -274,39 +271,6 @@ mu_folder_close (mu_folder_t folder)
 }
 
 int
-mu_folder_set_stream (mu_folder_t folder, mu_stream_t stream)
-{
-  if (folder == NULL)
-    return EINVAL;
-  if (folder->stream)
-    mu_stream_destroy (&folder->stream);
-  folder->stream = stream;
-  return 0;
-}
-
-int
-mu_folder_get_stream (mu_folder_t folder, mu_stream_t *pstream)
-{
-  /* FIXME: Deprecation warning */
-  if (folder == NULL)
-    return EINVAL;
-  if (pstream == NULL)
-    return MU_ERR_OUT_PTR_NULL;
-  *pstream = folder->stream;
-  return 0;
-}
-
-int
-mu_folder_get_streamref (mu_folder_t folder, mu_stream_t *pstream)
-{
-  if (folder == NULL)
-    return EINVAL;
-  if (pstream == NULL)
-    return MU_ERR_OUT_PTR_NULL;
-  return mu_streamref_create (pstream, folder->stream);
-}
-
-int
 mu_folder_set_authority (mu_folder_t folder, mu_authority_t authority)
 {
   if (folder == NULL)
diff --git a/libmailutils/mailbox/mailbox.c b/libmailutils/mailbox/mailbox.c
index 1461af5..db775b4 100644
--- a/libmailutils/mailbox/mailbox.c
+++ b/libmailutils/mailbox/mailbox.c
@@ -648,55 +648,6 @@ mu_mailbox_set_stream (mu_mailbox_t mbox, mu_stream_t 
stream)
   return 0;
 }
 
-/* FIXME: This is a problem.  We provide a mu_mailbox_get_stream ()
-   and this stream is special: it should, in theory, represent
-   a "view" of a flow of messages.  However, providing this perspective
-   may make sense for local mailboxes, but downright impossible
-   for remote mailboxes, short on downloading entire mailbox
-   locally.
-
-   This function will be removed in the short run.  It is no longer
-   used by MU.  */
-int
-mu_mailbox_get_stream (mu_mailbox_t mbox, mu_stream_t *pstream)
-{
-  /* FIXME: Deprecation warning */
-  if (mbox == NULL)
-    return EINVAL;
-  if (pstream == NULL)
-    return MU_ERR_OUT_PTR_NULL;
-
-  /* If null two cases:
-     - it is no open yet.
-     - it a remote stream and the socket stream is on the folder.  */
-  if (mbox->stream == NULL)
-    {
-      if (mbox->folder)
-       return mu_folder_get_stream (mbox->folder, pstream);
-    }
-  *pstream = mbox->stream;
-  return 0;
-}
-
-int
-mu_mailbox_get_streamref (mu_mailbox_t mbox, mu_stream_t *pstream)
-{
-  if (mbox == NULL)
-    return EINVAL;
-  if (pstream == NULL)
-    return MU_ERR_OUT_PTR_NULL;
-
-  /* If null two cases:
-     - it is no open yet.
-     - it a remote stream and the socket stream is on the folder.  */
-  if (mbox->stream == NULL)
-    {
-      if (mbox->folder)
-       return mu_folder_get_streamref (mbox->folder, pstream);
-    }
-  return mu_streamref_create (pstream, mbox->stream);
-}
-
 int
 mu_mailbox_get_observable (mu_mailbox_t mbox, mu_observable_t *pobservable)
 {
diff --git a/libmu_cpp/folder.cc b/libmu_cpp/folder.cc
index e2fb99c..8e894ea 100644
--- a/libmu_cpp/folder.cc
+++ b/libmu_cpp/folder.cc
@@ -110,26 +110,6 @@ Folder :: enumerate (const std::string& name, void* 
pattern,
   return *new List (c_list);
 }
 
-Stream&
-Folder :: get_stream ()
-{
-  mu_stream_t c_stream;
-
-  int status = mu_folder_get_stream (folder, &c_stream);
-  if (status)
-    throw Exception ("Folder::get_stream", status);
-
-  return *new Stream (c_stream);
-}
-
-void
-Folder :: set_stream (const Stream& stream)
-{
-  int status = mu_folder_set_stream (folder, stream.stm);
-  if (status)
-    throw Exception ("Folder::set_stream", status);
-}
-
 Url&
 Folder :: get_url ()
 {
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 1af2bbb..9699b0d 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -307,35 +307,6 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, 
"mu-mailbox-get-url", 1, 0, 0,
 }
 #undef FUNC_NAME
 
-SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
-                  (SCM mbox, SCM mode),
-"Returns a port associated with the contents of the @var{mbox},\n"
-"which is a string defining operation mode of the stream. It may\n"
-"contain any of the two characters: @samp{r} for reading, @samp{w} for\n"
-"writing.\n")
-#define FUNC_NAME s_scm_mu_mailbox_get_port
-{
-  struct mu_mailbox *mum;
-  mu_stream_t stream;
-  int status;
-  char *s;
-  SCM ret;
-  
-  SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
-  SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
-  mum = (struct mu_mailbox *) SCM_CDR (mbox);
-  status = mu_mailbox_get_streamref (mum->mbox, &stream);
-  if (status)
-    mu_scm_error (FUNC_NAME, status,
-                 "Cannot get mailbox stream",
-                 scm_list_1 (mbox));
-  s = scm_to_locale_string (mode);
-  ret = mu_port_make_from_stream (mbox, stream, scm_mode_bits (s));
-  free (s);
-  return ret;
-}
-#undef FUNC_NAME
-
 SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 
0,
                   (SCM mbox, SCM msgno), 
 "Retrieve from message address@hidden from the mailbox @var{mbox}.")
diff --git a/libproto/mailer/Makefile.am b/libproto/mailer/Makefile.am
index 52361e4..5fae967 100644
--- a/libproto/mailer/Makefile.am
+++ b/libproto/mailer/Makefile.am
@@ -44,11 +44,13 @@ libmu_mailer_la_SOURCES = \
  smtp_mech.c\
  smtp_open.c\
  smtp_param.c\
+ smtp_quit.c\
  smtp_rcpt.c\
  smtp_rset.c\
+ smtp_secret.c\
  smtp_send.c\
  smtp_starttls.c\
  smtp_trace.c\
- smtp_quit.c\
+ smtp_url.c\
  remote.c
 
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index dbc5420..a7fea63 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -162,8 +162,7 @@ smtp_open (mu_mailer_t mailer, int flags)
     mu_smtp_trace_mask (smtp_mailer->smtp, MU_SMTP_TRACE_SET,
                        MU_XSCRIPT_PAYLOAD);
   
-  mu_smtp_set_param (smtp_mailer->smtp, MU_SMTP_PARAM_URL,
-                    mu_url_to_string (mailer->url));
+  mu_smtp_set_url (smtp_mailer->smtp, mailer->url);
 
   if (mu_url_sget_auth (mailer->url, &auth) == 0)
     smtp_mailer_add_auth_mech (smtp_mailer, auth);
diff --git a/libproto/mailer/smtp_auth.c b/libproto/mailer/smtp_auth.c
index e9e97d0..d015b6c 100644
--- a/libproto/mailer/smtp_auth.c
+++ b/libproto/mailer/smtp_auth.c
@@ -53,7 +53,6 @@ static int
 _mu_smtp_fixup_params (mu_smtp_t smtp)
 {
   const char *str;
-  mu_url_t url;
   mu_ticket_t ticket = NULL;
   int flags = 0;
   int rc;
@@ -67,26 +66,19 @@ _mu_smtp_fixup_params (mu_smtp_t smtp)
   if ((flags & (_HAS_USERNAME|_HAS_PASSWORD)) == (_HAS_USERNAME|_HAS_PASSWORD))
     return 0; /* Nothing to do */
   
-  if (!smtp->param[MU_SMTP_PARAM_URL])
+  if (!smtp->url)
     return 0;
   
-  rc = mu_url_create (&url, smtp->param[MU_SMTP_PARAM_URL]);
-  if (rc)
-    {
-      mu_diag_output (MU_DIAG_ERROR, "cannot create URL: %s",
-                     mu_strerror (rc));
-      return rc;
-    }
-
   if (!(flags & _HAS_USERNAME))
     {
-      rc = mu_url_sget_user (url, &str);
+      rc = mu_url_sget_user (smtp->url, &str);
       if (rc == 0 &&
          mu_smtp_set_param (smtp, MU_SMTP_PARAM_USERNAME, str) == 0)
        flags |= _HAS_USERNAME;
     }
 
-  if (!(flags & _HAS_PASSWORD) && mu_url_get_secret (url, &smtp->secret) == 0)
+  if (!(flags & _HAS_PASSWORD) &&
+      mu_url_get_secret (smtp->url, &smtp->secret) == 0)
     flags |= _HAS_PASSWORD;
 
   if ((!(flags & _HAS_USERNAME) ||
@@ -94,18 +86,17 @@ _mu_smtp_fixup_params (mu_smtp_t smtp)
       get_ticket (&ticket) == 0)
     {
       if (!(flags & _HAS_USERNAME) &&
-         mu_ticket_get_cred (ticket, url, "SMTP User: ",
+         mu_ticket_get_cred (ticket, smtp->url, "SMTP User: ",
                              &smtp->param[MU_SMTP_PARAM_USERNAME],
                              NULL) == 0)
        flags |= _HAS_USERNAME;
 
       if (!(flags & _HAS_PASSWORD) && !smtp->secret)
-       mu_ticket_get_cred (ticket, url, "SMTP Passwd: ",
+       mu_ticket_get_cred (ticket, smtp->url, "SMTP Passwd: ",
                            NULL, &smtp->secret);
       mu_ticket_destroy (&ticket);
     }
 
-  mu_url_destroy (&url);
   return 0;
 }
 
diff --git a/libproto/mailer/smtp_create.c b/libproto/mailer/smtp_create.c
index 7c6ec54..81481e2 100644
--- a/libproto/mailer/smtp_create.c
+++ b/libproto/mailer/smtp_create.c
@@ -22,6 +22,7 @@
 #include <mailutils/list.h>
 #include <mailutils/secret.h>
 #include <mailutils/smtp.h>
+#include <mailutils/url.h>
 #include <mailutils/stream.h>
 #include <mailutils/sys/smtp.h>
 
@@ -66,6 +67,7 @@ mu_smtp_destroy (mu_smtp_t *psmtp)
        mu_secret_password_unref (smtp->secret);
       mu_secret_destroy (&smtp->secret);
     }
+  mu_url_destroy (&smtp->url);
   
   for (i = 0; i < MU_SMTP_MAX_PARAM; i++)
     {
diff --git a/libproto/mailer/smtp_param.c b/libproto/mailer/smtp_param.c
index fbb2779..e9ceb1f 100644
--- a/libproto/mailer/smtp_param.c
+++ b/libproto/mailer/smtp_param.c
@@ -25,6 +25,7 @@
 #include <mailutils/cctype.h>
 #include <mailutils/list.h>
 #include <mailutils/secret.h>
+#include <mailutils/url.h>
 #include <mailutils/smtp.h>
 #include <mailutils/sys/smtp.h>
 
@@ -51,6 +52,18 @@ mu_smtp_set_param (mu_smtp_t smtp, int pcode, const char 
*newparam)
       MU_SMTP_FCLR (smtp, _MU_SMTP_CLNPASS);
       return mu_secret_create (&smtp->secret, newparam, strlen (newparam));
     }
+  else if (pcode == MU_SMTP_PARAM_URL)
+    {
+      mu_url_t url;
+      int rc;
+       
+      rc = mu_url_create (&url, newparam);
+      if (rc)
+       return rc;
+      mu_url_destroy (&smtp->url);
+      smtp->url = url;
+      return 0;
+    }
   
   param = strdup (newparam);
   if (!param)
@@ -73,6 +86,14 @@ mu_smtp_get_param (mu_smtp_t smtp, int pcode, const char 
**pparam)
       smtp->param[pcode] = (char*) mu_secret_password (smtp->secret);
       MU_SMTP_FSET (smtp, _MU_SMTP_CLNPASS);
     }
+  else if (pcode == MU_SMTP_PARAM_URL)
+    {
+      if (smtp->url)
+       {
+         *pparam = mu_url_to_string (smtp->url);
+         return 0;
+       }
+    }
   
   *pparam = smtp->param[pcode];
   return 0;
diff --git a/libproto/mailer/smtp_open.c b/libproto/mailer/smtp_secret.c
similarity index 64%
copy from libproto/mailer/smtp_open.c
copy to libproto/mailer/smtp_secret.c
index 2fc8320..0774aed 100644
--- a/libproto/mailer/smtp_open.c
+++ b/libproto/mailer/smtp_secret.c
@@ -18,30 +18,35 @@
 # include <config.h>
 #endif
 
-#include <errno.h>
-#include <stdlib.h>
 #include <mailutils/errno.h>
-#include <mailutils/cctype.h>
-#include <mailutils/list.h>
+#include <mailutils/secret.h>
 #include <mailutils/smtp.h>
 #include <mailutils/sys/smtp.h>
 
 int
-mu_smtp_open (mu_smtp_t smtp)
+mu_smtp_set_secret (mu_smtp_t smtp, mu_secret_t secret)
 {
-  int status;
-  
   if (!smtp)
     return EINVAL;
-  if (smtp->state != MU_SMTP_INIT)
-    return MU_ERR_SEQ;
-  status = mu_smtp_response (smtp);
-  MU_SMTP_CHECK_ERROR (smtp, status);
-  if (smtp->replcode[0] != '2')
-    /* There's no use doing anything in this session, so we set the
-       _MU_SMTP_ERR flag. */
-    MU_SMTP_CHECK_ERROR (smtp, MU_ERR_REPLY);
-  smtp->state = MU_SMTP_EHLO;
-  return 0;
+  if (smtp->secret)
+    {
+      if (MU_SMTP_FISSET (smtp, _MU_SMTP_CLNPASS))
+       mu_secret_password_unref (smtp->secret);
+      mu_secret_destroy (&smtp->secret);
+    }
+  if (!secret)
+    return 0;
+  return mu_secret_dup (secret, &smtp->secret);
 }
 
+int
+mu_smtp_get_secret (mu_smtp_t smtp, mu_secret_t *secret)
+{
+  if (!smtp)
+    return EINVAL;
+  if (!smtp->secret)
+    return MU_ERR_NOENT;
+  *secret = smtp->secret;
+  mu_secret_ref (smtp->secret);
+  return 0;
+}
diff --git a/libproto/mailer/smtp_capa.c b/libproto/mailer/smtp_url.c
similarity index 66%
copy from libproto/mailer/smtp_capa.c
copy to libproto/mailer/smtp_url.c
index 07b99cf..9d6c9ee 100644
--- a/libproto/mailer/smtp_capa.c
+++ b/libproto/mailer/smtp_url.c
@@ -18,27 +18,30 @@
 # include <config.h>
 #endif
 
-#include <errno.h>
-#include <stdlib.h>
 #include <mailutils/errno.h>
-#include <mailutils/list.h>
+#include <mailutils/url.h>
+#include <mailutils/secret.h>
 #include <mailutils/smtp.h>
 #include <mailutils/sys/smtp.h>
 
 int
-mu_smtp_capa_test (mu_smtp_t smtp, const char *name, const char **pret)
+mu_smtp_set_url (mu_smtp_t smtp, mu_url_t url)
 {
-  if (!smtp || !name)
+  if (!smtp)
     return EINVAL;
-  if (MU_SMTP_FISSET (smtp, _MU_SMTP_ERR))
-    return MU_ERR_FAILURE;
-  if (!smtp->capa)
-    {
-      int rc = mu_smtp_ehlo (smtp);
-      if (rc)
-       return rc;
-    }
-  if (!MU_SMTP_FISSET (smtp, _MU_SMTP_ESMTP))
-    return MU_ERR_FAILURE;
-  return mu_list_locate (smtp->capa, (void*) name, (void**)pret);
+  mu_url_destroy (&smtp->url);
+  if (!url)
+    return 0;
+  return mu_url_dup (url, &smtp->url);
+}
+
+int
+mu_smtp_get_url (mu_smtp_t smtp, mu_url_t *purl)
+{
+  if (!smtp || !purl)
+    return EINVAL;
+  if (!smtp->url)
+    return MU_ERR_NOENT;
+  *purl = smtp->url;
+  return 0;
 }
diff --git a/python/libmu_py/folder.c b/python/libmu_py/folder.c
index ce6f776..3919c81 100644
--- a/python/libmu_py/folder.c
+++ b/python/libmu_py/folder.c
@@ -129,22 +129,6 @@ api_folder_close (PyObject *self, PyObject *args)
 }
 
 static PyObject *
-api_folder_get_stream (PyObject *self, PyObject *args)
-{
-  int status;
-  PyFolder *py_folder;
-  PyStream *py_stm = PyStream_NEW ();
-
-  if (!PyArg_ParseTuple (args, "O!", &PyFolderType, &py_folder))
-    return NULL;
-
-  Py_INCREF (py_stm);
-
-  status = mu_folder_get_streamref (py_folder->folder, &py_stm->stm);
-  return status_object (status, (PyObject *)py_stm);
-}
-
-static PyObject *
 api_folder_get_authority (PyObject *self, PyObject *args)
 {
   int status;
@@ -253,9 +237,6 @@ static PyMethodDef methods[] = {
   { "close", (PyCFunction) api_folder_close, METH_VARARGS,
     "" },
 
-  { "get_stream", (PyCFunction) api_folder_get_stream, METH_VARARGS,
-    "" },
-
   { "get_authority", (PyCFunction) api_folder_get_authority, METH_VARARGS,
     "" },
 


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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