From MAILER-DAEMON Thu Aug 04 09:17:39 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Qoxnv-0000vV-AV
	for mharc-commit-mailutils@gnu.org; Thu, 04 Aug 2011 09:17:39 -0400
Received: from eggs.gnu.org ([140.186.70.92]:36353)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qoxns-0000vI-44
	for commit-mailutils@gnu.org; Thu, 04 Aug 2011 09:17:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qoxnm-0001H5-24
	for commit-mailutils@gnu.org; Thu, 04 Aug 2011 09:17:36 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:48999)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qoxnl-0001H1-RT
	for commit-mailutils@gnu.org; Thu, 04 Aug 2011 09:17:30 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qoxnl-00038L-Ie
	for commit-mailutils@gnu.org; Thu, 04 Aug 2011 13:17:29 +0000
Date: Thu, 04 Aug 2011 13:17:29 +0000
Message-Id: <E1Qoxnl-00038L-Ie@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-379-geb851fb
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6060ab1110b1a1c27c1f88e22581a50b3930bf4b
X-Git-Newrev: eb851fbc9fec91c1bd095500d3e9b24829ee53cc
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Aug 2011 13:17:37 -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=eb851fbc9fec91c1bd095500d3e9b24829ee53cc

The branch, master has been updated
       via  eb851fbc9fec91c1bd095500d3e9b24829ee53cc (commit)
      from  6060ab1110b1a1c27c1f88e22581a50b3930bf4b (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 eb851fbc9fec91c1bd095500d3e9b24829ee53cc
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Aug 4 16:13:21 2011 +0300

    Various bugfixes.
    
    * libmailutils/base/assoc.c (first): Set index to max value
    if tab is NULL to indicate immediate end of iteration.
    * libmu_auth/sql.c (mu_auth_sql_by_name)
    (mu_auth_sql_by_uid): Check the return from mu_sql_num_tuples.
    (mu_sql_getpass): Check the number of returned tuples.
    Return failure if returned a NULL password.
    * libmu_scm/mu_message.c (string_sloppy_member): Remove.
    (mu-message-get-header-fields): Use scm_member instead of
    string_sloppy_member.
    * sql/postgres.c (chop): Handle NULL argument.

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

Summary of changes:
 libmailutils/base/assoc.c |   10 ++++++--
 libmu_auth/sql.c          |   53 +++++++++++++++++++++++++++++++++++++++++---
 libmu_scm/mu_message.c    |   19 ++-------------
 sql/postgres.c            |    4 ++-
 4 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/libmailutils/base/assoc.c b/libmailutils/base/assoc.c
index 5c1e213..2d21fa8 100644
--- a/libmailutils/base/assoc.c
+++ b/libmailutils/base/assoc.c
@@ -393,9 +393,13 @@ first (void *owner)
   unsigned i;
 
   if (assoc->tab)
-    for (i = 0; i < hash_max; i++)
-      if ((ASSOC_ELEM (assoc, i))->name)
-	break;
+    {
+      for (i = 0; i < hash_max; i++)
+        if ((ASSOC_ELEM (assoc, i))->name)
+	  break;
+    }
+  else
+    i = hash_max;
   itr->index = i;
   return 0;
 }
diff --git a/libmu_auth/sql.c b/libmu_auth/sql.c
index ddf1e12..4bd2e55 100644
--- a/libmu_auth/sql.c
+++ b/libmu_auth/sql.c
@@ -392,7 +392,17 @@ mu_auth_sql_by_name (struct mu_auth_data **return_data,
       return MU_ERR_FAILURE;
     }
 
-  mu_sql_num_tuples (conn, &n);
+  status = mu_sql_num_tuples (conn, &n);
+  if (status)
+    {
+      mu_error (_("cannot get number of tuples: %s"),
+                (status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
+                                          mu_strerror (status));
+      mu_sql_release_result (conn);
+      mu_sql_connection_destroy (&conn);
+      return MU_ERR_FAILURE;
+    }
+  
   if (n == 0)
     rc = MU_ERR_AUTH_FAILURE;
   else
@@ -476,7 +486,16 @@ mu_auth_sql_by_uid (struct mu_auth_data **return_data,
       return MU_ERR_FAILURE;
     }
 
-  mu_sql_num_tuples (conn, &n);
+  status = mu_sql_num_tuples (conn, &n);
+  if (status)
+    {
+      mu_error (_("cannot get number of tuples: %s"),
+                (status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
+                                          mu_strerror (status));
+      mu_sql_release_result (conn);
+      mu_sql_connection_destroy (&conn);
+      return MU_ERR_FAILURE;
+    }
 
   if (n == 0)
     rc = MU_ERR_AUTH_FAILURE;
@@ -497,7 +516,8 @@ mu_sql_getpass (const char *username, char **passwd)
   char *query_str;
   int status;
   char *sql_pass;
-  
+  size_t nt;
+
   query_str = mu_sql_expand_query (mu_sql_module_config.getpass_query, username);
 
   if (!query_str)
@@ -540,7 +560,7 @@ mu_sql_getpass (const char *username, char **passwd)
       mu_sql_connection_destroy (&conn);
       return MU_ERR_FAILURE;
     }
-
+  
   status = mu_sql_store_result (conn);
 
   if (status)
@@ -552,6 +572,23 @@ mu_sql_getpass (const char *username, char **passwd)
       return MU_ERR_FAILURE;
     }
 
+  status = mu_sql_num_tuples (conn, &nt);
+  if (status)
+    {
+      mu_error (_("cannot get number of tuples: %s"),
+                (status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
+                                          mu_strerror (status));
+      mu_sql_release_result (conn);
+      mu_sql_connection_destroy (&conn);
+      return MU_ERR_FAILURE;
+    }
+  if (nt == 0)
+    {
+      mu_sql_release_result (conn);
+      mu_sql_connection_destroy (&conn);
+      return MU_ERR_FAILURE;
+    }
+
   status = mu_sql_get_column (conn, 0, 0, &sql_pass);
   if (status)
     {
@@ -563,6 +600,14 @@ mu_sql_getpass (const char *username, char **passwd)
       return MU_ERR_FAILURE;
     }
 
+  if (!sql_pass)
+    {
+      mu_error (_("SQL returned NULL password"));
+      mu_sql_release_result (conn);
+      mu_sql_connection_destroy (&conn);
+      return MU_ERR_FAILURE;
+    }
+
   *passwd = strdup (sql_pass);
 
   mu_sql_disconnect (conn);
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 4a99a8e..4ee603e 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -495,20 +495,6 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0,
 }
 #undef FUNC_NAME
 
-static int
-string_sloppy_member (SCM lst, char *name)
-{
-  for(; SCM_CONSP (lst); lst = SCM_CDR(lst))
-    {
-      SCM car = SCM_CAR (lst);
-      if (scm_is_string (car)
-	  && mu_c_strncasecmp (scm_i_string_chars (car), name,
-			       scm_i_string_length (car)) == 0)
-	return 1;
-    }
-  return 0;
-}
-
 SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1, 0,
 		   (SCM mesg, SCM headers),
 "Returns list of headers in the message @var{mesg}. optional argument\n" 
@@ -547,8 +533,9 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel
 	mu_scm_error (FUNC_NAME, status,
 		      "Cannot get header field ~A, message ~A",
 		      scm_list_2 (scm_from_size_t (i), mesg));
-      
-      if (!scm_is_null (headers) && string_sloppy_member (headers, name) == 0)
+
+      if (!scm_is_null (headers) &&
+	  scm_member (headers, scm_from_locale_string (name)) == SCM_BOOL_F)
 	continue;
       status = mu_header_aget_field_value (hdr, i, &value);
       if (status)
diff --git a/sql/postgres.c b/sql/postgres.c
index dda3434..bf48bc3 100644
--- a/sql/postgres.c
+++ b/sql/postgres.c
@@ -32,7 +32,9 @@ chop (char *str)
 {
   int len;
   
-  for (len = strlen(str); len > 0 && mu_isspace(str[len-1]); len--)
+  if (!str)
+    return NULL;
+  for (len = strlen (str); len > 0 && mu_isspace (str[len-1]); len--)
     ;
   str[len] = 0;
   return str;


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Sat Aug 27 05:06:21 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1QxEqK-0002y7-VL
	for mharc-commit-mailutils@gnu.org; Sat, 27 Aug 2011 05:06:20 -0400
Received: from eggs.gnu.org ([140.186.70.92]:59876)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxEqH-0002xi-8q
	for commit-mailutils@gnu.org; Sat, 27 Aug 2011 05:06:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxEqE-0005y5-SZ
	for commit-mailutils@gnu.org; Sat, 27 Aug 2011 05:06:17 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49028)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxEqE-0005xx-QP
	for commit-mailutils@gnu.org; Sat, 27 Aug 2011 05:06:14 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxEqE-0002cL-3O
	for commit-mailutils@gnu.org; Sat, 27 Aug 2011 09:06:14 +0000
Date: Sat, 27 Aug 2011 09:06:14 +0000
Message-Id: <E1QxEqE-0002cL-3O@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-382-gab2982d
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: bdf3c6cf36fd7781c9a59babda57c5eb9261de45
X-Git-Newrev: ab2982d891ee8b788ec464dadedf8657c753735a
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 27 Aug 2011 09:06:19 -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=ab2982d891ee8b788ec464dadedf8657c753735a

The branch, master has been updated
       via  ab2982d891ee8b788ec464dadedf8657c753735a (commit)
       via  a71c4b6be03d60b9db1d878a912f23a3864c548a (commit)
      from  bdf3c6cf36fd7781c9a59babda57c5eb9261de45 (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 ab2982d891ee8b788ec464dadedf8657c753735a
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Aug 27 12:04:08 2011 +0300

    Version 2.99.93

commit a71c4b6be03d60b9db1d878a912f23a3864c548a
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Aug 26 16:22:09 2011 +0300

    Improve mime support, introduce ref/unref functions for mu_message_t and mu_mime_t.
    
    * include/mailutils/message.h (mu_message_ref): Change proto.
    (mu_message_unref): New proto (instead of macro).
    * include/mailutils/mime.h (mu_mime_ref)
    (mu_mime_unref, mu_mime_to_message): New protos.
    * include/mailutils/sys/message.h (MESSAGE_MODIFIED)
    (MESSAGE_INTERNAL_STREAM): New constants (from mime.c)
    (MESSAGE_MIME_OWNER): New constant.
    (_mu_message) <ref_count>: Rename from ref.
    * include/mailutils/sys/mime.h (MIME_SEEK_ACTIVE): New constant.
    (_mu_mime) <ref_count>: New member.
    * libmailutils/mailbox/message.c (MESSAGE_MODIFIED)
    (MESSAGE_INTERNAL_STREAM): Removed (see above).
    * libmailutils/mailer/mailer.c (mu_message_unref): New function.
    (mu_message_destroy): Rewrite.
    (mu_message_ref): Returns void.
    (mu_message_lines): Don't access header and body directly to
    give virtual functions a chance to initialize them.
    (mu_message_quick_lines): likewise.
    * libmailutils/mailer/mailer.c (send_fragments): Use mu_mime_to_message
    instead of mu_message_unref.
    * libmailutils/mime/mime.c (_mime_append_part): Set offset only if
    mime->stream is not null.
    (_mime_body_stream_seek): Implement (albeit inefficiently).
    (mu_mime_create): Set ref_count.
    (mu_mime_ref, mu_mime_unref): New functions.
    (mu_mime_destroy): Reimplement as a wrapper over _mu_mime_free.
    (mu_mime_get_message): Increase refcount of the message being returned.
    (mu_mime_to_message): New function.
    * libmailutils/stream/message_stream.c (_message_open): Handle arbitrary
    text as RFC822 without headers.
    
    * libmu_sieve/actions.c: Unref the message returned by mu_mime_get_message.
    * libmu_sieve/extensions/vacation.c: Likewise.
    * mh/mhn.c: Likewise.
    
    * libmailutils/stream/stream.c (mu_stream_seek) <MU_SEEK_CUR>: Bugfix.

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

Summary of changes:
 NEWS                                 |    2 +-
 configure.ac                         |    2 +-
 include/mailutils/message.h          |    4 +-
 include/mailutils/mime.h             |    4 +
 include/mailutils/sys/message.h      |   10 ++-
 include/mailutils/sys/mime.h         |    2 +
 libmailutils/mailbox/message.c       |  153 ++++++++++++++++++++--------------
 libmailutils/mailer/mailer.c         |    4 +-
 libmailutils/mime/mime.c             |  130 +++++++++++++++++++++--------
 libmailutils/stream/message_stream.c |   72 ++++++++++++----
 libmailutils/stream/stream.c         |    2 +-
 libmu_sieve/actions.c                |    2 +-
 libmu_sieve/extensions/vacation.c    |    1 +
 mh/mhn.c                             |    8 +-
 14 files changed, 268 insertions(+), 128 deletions(-)

diff --git a/NEWS b/NEWS
index aa31dd9..c96bda1 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ See the end of file for copying conditions.
 Please send mailutils bug reports to <bug-mailutils@gnu.org>.
 
 
-Version 2.99.92 (Git)
+Version 2.99.93 (Git)
 
 This version is highly experimental.  It features a rewrite from
 scratch of the stream subsystem and other vital parts of the
diff --git a/configure.ac b/configure.ac
index 18ea434..8adfb8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl You should have received a copy of the GNU General Public License along
 dnl with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
 AC_PREREQ(2.63)
-AC_INIT([GNU Mailutils], [2.99.92], [bug-mailutils@gnu.org], [mailutils])
+AC_INIT([GNU Mailutils], [2.99.93], [bug-mailutils@gnu.org], [mailutils])
 AC_CONFIG_SRCDIR([libmailutils/mailbox/mailbox.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([gnits 1.11 dist-bzip2 dist-xz std-options silent-rules])
diff --git a/include/mailutils/message.h b/include/mailutils/message.h
index 4ad984f..605817c 100644
--- a/include/mailutils/message.h
+++ b/include/mailutils/message.h
@@ -58,8 +58,8 @@ extern int mu_message_clear_modified (mu_message_t);
 extern int mu_message_get_mailbox (mu_message_t, mu_mailbox_t *);
 extern int mu_message_set_mailbox (mu_message_t, mu_mailbox_t, void *);
 
-extern int mu_message_ref (mu_message_t);
-#define mu_message_unref(msg) mu_message_destroy (&msg, NULL)
+extern void mu_message_ref (mu_message_t);
+extern void mu_message_unref (mu_message_t);
 
 extern int mu_message_get_envelope (mu_message_t, mu_envelope_t *);
 extern int mu_message_set_envelope (mu_message_t, mu_envelope_t, void *);
diff --git a/include/mailutils/mime.h b/include/mailutils/mime.h
index fcb8413..d41ed38 100644
--- a/include/mailutils/mime.h
+++ b/include/mailutils/mime.h
@@ -31,6 +31,9 @@ extern "C" {
 
 int mu_mime_create	(mu_mime_t *pmime, mu_message_t msg, int flags);
 void mu_mime_destroy	(mu_mime_t *pmime);
+void mu_mime_ref        (mu_mime_t mime);
+void mu_mime_unref      (mu_mime_t mime);
+	
 int mu_mime_is_multipart	(mu_mime_t mime);
 int mu_mime_get_num_parts	(mu_mime_t mime, size_t *nparts);
 
@@ -39,6 +42,7 @@ int mu_mime_get_part	(mu_mime_t mime, size_t part, mu_message_t *msg);
 int mu_mime_add_part	(mu_mime_t mime, mu_message_t msg);
 
 int mu_mime_get_message	(mu_mime_t mime, mu_message_t *msg);
+int mu_mime_to_message (mu_mime_t mime, mu_message_t *msg);
 
 int mu_rfc2047_decode   (const char *tocode, const char *fromstr, 
                          char **ptostr);
diff --git a/include/mailutils/sys/message.h b/include/mailutils/sys/message.h
index 6f90485..f538fc9 100644
--- a/include/mailutils/sys/message.h
+++ b/include/mailutils/sys/message.h
@@ -30,8 +30,15 @@
 extern "C" {
 #endif
 
+#define MESSAGE_MODIFIED        0x10000
+#define MESSAGE_INTERNAL_STREAM 0x20000
+#define MESSAGE_MIME_OWNER      0x40000
+
 struct _mu_message
 {
+  /* Reference count.  */
+  int ref_count;
+
   /* Who is the owner.  */
   void *owner;
 
@@ -48,9 +55,6 @@ struct _mu_message
   mu_mailbox_t mailbox;
   size_t orig_header_size;
   
-  /* Reference count.  */
-  int ref;
-
   int (*_get_stream)     (mu_message_t, mu_stream_t *);
   int (*_get_uidl)       (mu_message_t, char *, size_t, size_t *);
   int (*_get_uid)        (mu_message_t, size_t *);
diff --git a/include/mailutils/sys/mime.h b/include/mailutils/sys/mime.h
index 3a28602..0fe5b74 100644
--- a/include/mailutils/sys/mime.h
+++ b/include/mailutils/sys/mime.h
@@ -44,9 +44,11 @@ extern "C" {
 #define MIME_ADDED_MULTIPART_CT    0x08000000
 #define MIME_INSERT_BOUNDARY       0x04000000
 #define MIME_ADDING_BOUNDARY       0x02000000
+#define MIME_SEEK_ACTIVE           0x01000000
 
 struct _mu_mime
 {
+  int ref_count;
   mu_message_t       msg;
   mu_header_t        hdrs;
   mu_stream_t        stream;
diff --git a/libmailutils/mailbox/message.c b/libmailutils/mailbox/message.c
index 4f97d61..01835d6 100644
--- a/libmailutils/mailbox/message.c
+++ b/libmailutils/mailbox/message.c
@@ -52,9 +52,6 @@
 #include <mailutils/sys/message.h>
 #include <mailutils/sys/stream.h>
 
-#define MESSAGE_MODIFIED        0x10000
-#define MESSAGE_INTERNAL_STREAM 0x20000
-
 
 /* Message stream */
 
@@ -512,78 +509,100 @@ mu_message_create (mu_message_t *pmsg, void *owner)
       return status;
     }
   msg->owner = owner;
-  msg->ref = 1;
+  msg->ref_count = 1;
   *pmsg = msg;
   return 0;
 }
 
+/* Free the message and all associated stuff */
+static void
+_mu_message_free (mu_message_t msg)
+{
+  /* Notify the listeners.  */
+  /* FIXME: to be removed since we do not support this event.  */
+  if (msg->observable)
+    {
+      mu_observable_notify (msg->observable, MU_EVT_MESSAGE_DESTROY, msg);
+      mu_observable_destroy (&msg->observable, msg);
+    }
+      
+  /* Envelope.  */
+  if (msg->envelope)
+    mu_envelope_destroy (&msg->envelope, msg);
+      
+  /* Header.  */
+  if (msg->header)
+    mu_header_destroy (&msg->header);
+      
+  /* Body.  */
+  if (msg->body)
+    mu_body_destroy (&msg->body, msg);
+      
+  /* Attribute.  */
+  if (msg->attribute)
+    mu_attribute_destroy (&msg->attribute, msg);
+      
+  /* Stream.  */
+  if (msg->stream)
+    mu_stream_destroy (&msg->stream);
+      
+  /*  Mime.  */
+  if (msg->flags & MESSAGE_MIME_OWNER)
+    mu_mime_destroy (&msg->mime);
+      
+  /* Loose the owner.  */
+  msg->owner = NULL;
+      
+  free (msg);
+}
+
 void
-mu_message_destroy (mu_message_t *pmsg, void *owner)
+mu_message_unref (mu_message_t msg)
 {
-  if (pmsg && *pmsg)
+  if (msg)
     {
-      mu_message_t msg = *pmsg;
       mu_monitor_t monitor = msg->monitor;
-      int destroy_lock = 0;
-
       mu_monitor_wrlock (monitor);
       /* Note: msg->ref may be incremented by mu_message_ref without
 	 additional checking for its owner, therefore decrementing
 	 it must also occur independently of the owner checking. Due
 	 to this inconsistency ref may reach negative values, which
 	 is very unfortunate.
-
+	 
 	 The `owner' stuff is a leftover from older mailutils versions.
 	 We are heading to removing it altogether. */
-      if (msg->ref > 0)
-	msg->ref--;
-      if ((msg->owner && msg->owner == owner)
-	  || (msg->owner == NULL && msg->ref <= 0))
+      if (msg->ref_count > 0)
+	msg->ref_count--;
+      if (msg->ref_count == 0)
 	{
-	  destroy_lock =  1;
-	  /* Notify the listeners.  */
-	  /* FIXME: to be removed since we do not support this event.  */
-	  if (msg->observable)
-	    {
-	      mu_observable_notify (msg->observable, MU_EVT_MESSAGE_DESTROY,
-				    msg);
-	      mu_observable_destroy (&msg->observable, msg);
-	    }
-
-	  /* Envelope.  */
-	  if (msg->envelope)
-	    mu_envelope_destroy (&msg->envelope, msg);
-
-	  /* Header.  */
-	  if (msg->header)
-	    mu_header_destroy (&msg->header);
-
-	  /* Body.  */
-	  if (msg->body)
-	    mu_body_destroy (&msg->body, msg);
-
-	  /* Attribute.  */
-	  if (msg->attribute)
-	    mu_attribute_destroy (&msg->attribute, msg);
-
-	  /* Stream.  */
-	  if (msg->stream)
-	    mu_stream_destroy (&msg->stream);
-
-	  /*  Mime.  */
-	  if (msg->mime)
-	    mu_mime_destroy (&msg->mime);
+	  _mu_message_free (msg);
+	  mu_monitor_unlock (monitor);
+	  mu_monitor_destroy (&monitor, msg);
+	}
+      else
+	mu_monitor_unlock (monitor);
+    }
+}
 
-	  /* Loose the owner.  */
-	  msg->owner = NULL;
+void
+mu_message_destroy (mu_message_t *pmsg, void *owner)
+{
+  if (pmsg && *pmsg)
+    {
+      mu_message_t msg = *pmsg;
+      
+      mu_monitor_t monitor = msg->monitor;
+      mu_monitor_wrlock (monitor);
 
-	  free (msg);
+      if (msg->owner && msg->owner == owner)
+	{
+	  _mu_message_free (msg);
+	  mu_monitor_unlock (monitor);
+	  mu_monitor_destroy (&monitor, msg);
+	  *pmsg = NULL;
+	  return;
 	}
       mu_monitor_unlock (monitor);
-      if (destroy_lock)
-	mu_monitor_destroy (&monitor, msg);
-      /* Loose the link */
-      *pmsg = NULL;
     }
 }
 
@@ -625,16 +644,15 @@ mu_message_create_copy (mu_message_t *to, mu_message_t from)
   return status;
 }
 
-int
+void
 mu_message_ref (mu_message_t msg)
 {
   if (msg)
     {
       mu_monitor_wrlock (msg->monitor);
-      msg->ref++;
+      msg->ref_count++;
       mu_monitor_unlock (msg->monitor);
     }
-  return 0;
 }
 
 void *
@@ -905,9 +923,14 @@ mu_message_lines (mu_message_t msg, size_t *plines)
     return msg->_lines (msg, plines, 0);
   if (plines)
     {
+      mu_header_t hdr = NULL;
+      mu_body_t body = NULL;
+
       hlines = blines = 0;
-      if ( ( ret = mu_header_lines (msg->header, &hlines) ) == 0 )
-	      ret = mu_body_lines (msg->body, &blines);
+      mu_message_get_header (msg, &hdr);
+      mu_message_get_body (msg, &body);
+      if ( ( ret = mu_header_lines (hdr, &hlines) ) == 0 )
+	      ret = mu_body_lines (body, &blines);
       *plines = hlines + blines;
     }
   return ret;
@@ -934,9 +957,14 @@ mu_message_quick_lines (mu_message_t msg, size_t *plines)
     }
   if (plines)
     {
+      mu_header_t hdr = NULL;
+      mu_body_t body = NULL;
+
       hlines = blines = 0;
-      if ((rc = mu_header_lines (msg->header, &hlines)) == 0)
-	rc = mu_body_lines (msg->body, &blines);
+      mu_message_get_header (msg, &hdr);
+      mu_message_get_body (msg, &body);
+      if ((rc = mu_header_lines (hdr, &hlines)) == 0)
+	rc = mu_body_lines (body, &blines);
       if (rc == 0)
 	*plines = hlines + blines;
     }
@@ -945,7 +973,7 @@ mu_message_quick_lines (mu_message_t msg, size_t *plines)
 
 int
 mu_message_set_size (mu_message_t msg, int (*_size)
-		  (mu_message_t, size_t *), void *owner)
+		     (mu_message_t, size_t *), void *owner)
 {
   if (msg == NULL)
     return EINVAL;
@@ -1194,6 +1222,7 @@ mu_message_is_multipart (mu_message_t msg, int *pmulti)
 	  int status = mu_mime_create (&msg->mime, msg, 0);
 	  if (status != 0)
 	    return 0;
+	  msg->flags |= MESSAGE_MIME_OWNER;
 	}
       *pmulti = mu_mime_is_multipart(msg->mime);
     }
diff --git a/libmailutils/mailer/mailer.c b/libmailutils/mailer/mailer.c
index c002135..8dbce63 100644
--- a/libmailutils/mailer/mailer.c
+++ b/libmailutils/mailer/mailer.c
@@ -629,11 +629,11 @@ send_fragments (mu_mailer_t mailer,
       if (status)
 	break;
 
-      mu_mime_get_message (mime, &newmsg);
+      mu_mime_to_message (mime, &newmsg);
       merge_headers (newmsg, hdr);
       
       status = mailer->_send_message (mailer, newmsg, from, to);
-      mu_mime_destroy (&mime);
+      mu_message_unref (newmsg);
       if (status)
 	break;
       if (delay)
diff --git a/libmailutils/mime/mime.c b/libmailutils/mime/mime.c
index a42787d..a539136 100644
--- a/libmailutils/mime/mime.c
+++ b/libmailutils/mime/mime.c
@@ -40,6 +40,7 @@
 #include <mailutils/util.h>
 
 #include <mailutils/sys/mime.h>
+#include <mailutils/sys/message.h>
 #include <mailutils/sys/stream.h>
 
 #ifndef TRUE
@@ -71,7 +72,7 @@ _mime_append_part (mu_mime_t mime, mu_message_t msg,
   struct _mime_part *mime_part, **part_arr;
   int             ret;
   size_t          size;
-  mu_header_t        hdr;
+  mu_header_t     hdr;
 
   if ((mime_part = calloc (1, sizeof (*mime_part))) == NULL)
     return ENOMEM;
@@ -129,7 +130,7 @@ _mime_append_part (mu_mime_t mime, mu_message_t msg,
       mu_message_ref (msg);
       mu_message_size (msg, &mime_part->len);
       mu_message_lines (msg, &mime_part->lines);
-      if (mime->nmtp_parts > 1)
+      if (mime->stream && mime->nmtp_parts > 1)
 	mime_part->offset = mime->mtp_parts[mime->nmtp_parts - 2]->len;
       mime_part->msg = msg;
     }
@@ -613,7 +614,27 @@ _mime_body_stream_seek (mu_stream_t stream, mu_off_t off, mu_off_t *presult)
     mime_reset_state (mime);
 
   if (off != mime->cur_offset)
-    return ESPIPE;
+    {
+      int rc;
+      mu_stream_t nullstr;
+
+      if (mime->flags & MIME_SEEK_ACTIVE)
+	return ESPIPE;
+      mime->flags |= MIME_SEEK_ACTIVE;
+      
+      rc = mu_nullstream_create (&nullstr, MU_STREAM_WRITE);
+      if (rc == 0)
+	{
+	  mu_off_t total;
+	  rc = mu_stream_copy (nullstr, stream, off, &total);
+	  mu_stream_destroy (&nullstr);
+	  if (rc == 0 && total != off)
+	    rc = ESPIPE;
+	}
+      mime->flags &= ~MIME_SEEK_ACTIVE;
+      if (rc)
+	return rc;
+    }
   *presult = off;
   return 0;
 }
@@ -912,49 +933,64 @@ mu_mime_create (mu_mime_t *pmime, mu_message_t msg, int flags)
   else
     {
       mime->flags |= (flags & MIME_FLAG_MASK);
+      mime->ref_count = 1;
       *pmime = mime;
     }
   return ret;
 }
 
 void
-mu_mime_destroy (mu_mime_t *pmime)
+mu_mime_ref (mu_mime_t mime)
+{
+  mime->ref_count++;
+}
+
+static void
+_mu_mime_free (mu_mime_t mime)
 {
-  mu_mime_t          mime;
   struct _mime_part *mime_part;
-  int             i;
+  int i;
 
-  if (pmime && *pmime)
+  if (mime->mtp_parts)
     {
-      mime = *pmime;
-      if (mime->mtp_parts != NULL)
+      for (i = 0; i < mime->nmtp_parts; i++)
 	{
-	  for (i = 0; i < mime->nmtp_parts; i++)
-	    {
-	      mime_part = mime->mtp_parts[i];
-	      if (mime_part->msg && mime->flags & MIME_NEW_MESSAGE)
-		mu_message_unref (mime_part->msg);
-	      else
-		mu_message_destroy (&mime_part->msg, mime_part);
-	      free (mime_part);
-	    }
-	  free (mime->mtp_parts);
+	  mime_part = mime->mtp_parts[i];
+	  mu_message_unref (mime_part->msg);
+	  free (mime_part);
 	}
-      mu_stream_destroy (&mime->stream);
-      mu_stream_destroy (&mime->part_stream);
-      if (mime->msg && mime->flags & MIME_NEW_MESSAGE)
-	mu_message_destroy (&mime->msg, mime);
-      if (mime->content_type)
-	free (mime->content_type);
-      if (mime->cur_buf)
-	free (mime->cur_buf);
-      if (mime->cur_line)
-	free (mime->cur_line);
-      if (mime->boundary)
-	free (mime->boundary);
-      if (mime->header_buf)
-	free (mime->header_buf);
-      free (mime);
+      free (mime->mtp_parts);
+    }
+  mu_stream_destroy (&mime->stream);
+  mu_stream_destroy (&mime->part_stream);
+  if (mime->msg && mime->flags & MIME_NEW_MESSAGE)
+    mu_message_destroy (&mime->msg, mime);
+  if (mime->content_type)
+    free (mime->content_type);
+  if (mime->cur_buf)
+    free (mime->cur_buf);
+  if (mime->cur_line)
+    free (mime->cur_line);
+  if (mime->boundary)
+    free (mime->boundary);
+  if (mime->header_buf)
+    free (mime->header_buf);
+  free (mime);
+}
+
+void
+mu_mime_unref (mu_mime_t mime)
+{
+  if (--mime->ref_count == 0)
+    _mu_mime_free (mime);
+}
+
+void
+mu_mime_destroy (mu_mime_t *pmime)
+{
+  if (pmime && *pmime)
+    {
+      mu_mime_unref (*pmime);
       *pmime = NULL;
     }
 }
@@ -1043,7 +1079,7 @@ mu_mime_get_message (mu_mime_t mime, mu_message_t *msg)
 {
   mu_stream_t        body_stream;
   mu_body_t          body;
-  int             ret = 0;
+  int                ret = 0;
 
   if (mime == NULL || msg == NULL)
     return EINVAL;
@@ -1069,6 +1105,8 @@ mu_mime_get_message (mu_mime_t mime, mu_message_t *msg)
 		      if (ret == 0)
 			{
 			  mu_body_set_stream (body, body_stream, mime->msg);
+			  mime->msg->mime = mime;
+			  mu_message_ref (mime->msg);
 			  *msg = mime->msg;
 			  return 0;
 			}
@@ -1080,10 +1118,30 @@ mu_mime_get_message (mu_mime_t mime, mu_message_t *msg)
 	}
     }
   if (ret == 0)
-    *msg = mime->msg;
+    {
+      mu_message_ref (mime->msg);
+      *msg = mime->msg;
+    }
   return ret;
 }
 
+
+int
+mu_mime_to_message (mu_mime_t mime, mu_message_t *pmsg)
+{
+  mu_message_t msg;
+  int rc = mu_mime_get_message (mime, &msg);
+  if (rc == 0)
+    {
+      mu_message_unref (msg);
+      msg->flags |= MESSAGE_MIME_OWNER;
+      mime->msg = NULL;
+      mu_mime_ref (mime);
+      *pmsg = msg;
+    }
+  return rc;
+}
+
 int
 mu_mime_is_multipart (mu_mime_t mime)
 {
diff --git a/libmailutils/stream/message_stream.c b/libmailutils/stream/message_stream.c
index 03e0260..2dd2f02 100644
--- a/libmailutils/stream/message_stream.c
+++ b/libmailutils/stream/message_stream.c
@@ -143,7 +143,26 @@ copy_trimmed_value (const char *str)
   p[len] = 0;
   return p;
 }
-  
+
+static int
+is_header_start (const char *buf)
+{
+  for (; *buf; buf++)
+    {
+      if (mu_isalnum (*buf) || *buf == '-' || *buf == '_')
+	continue;
+      if (*buf == ':')
+	return 1;
+    }
+  return 0;
+}
+
+static int
+is_header_cont (const char *buf)
+{
+  return mu_isblank (*buf);
+}
+
 static int
 _message_open (mu_stream_t stream)
 {
@@ -157,6 +176,7 @@ _message_open (mu_stream_t stream)
   size_t offset, len;
   mu_off_t body_start, body_end;
   mu_stream_t transport = str->transport;
+  int has_headers = 0;
   
   rc = mu_stream_seek (transport, 0, MU_SEEK_SET, NULL);
   if (rc)
@@ -197,25 +217,45 @@ _message_open (mu_stream_t stream)
       else if (mu_mh_delim (buffer))
 	{
 	  str->mark_offset = offset;
-	  str->mark_length = len - 1; /* do not count the terminating newline */
+	  str->mark_length = len - 1; /* do not count the terminating
+					 newline */
 	  break;
 	}
-      else if (!env_from || !env_date)
+      else
 	{
-      	  if (!from && mu_c_strncasecmp (buffer, MU_HEADER_FROM,
-				         sizeof (MU_HEADER_FROM) - 1) == 0)
+	  if (!is_header_start (buffer))
+	    {
+	      if (has_headers && is_header_cont (buffer))
+		{
+		  offset += len;
+		  continue;
+		}
+	      rc = mu_stream_seek (transport, - (mu_off_t) len,
+				   MU_SEEK_CUR, &offset);
+	      if (rc)
+		return rc;
+	      str->mark_offset = offset;
+	      str->mark_length = 0;
+	      break;
+	    }
+	  has_headers = 1;
+	  if (!env_from || !env_date)
+	    {
+	      if (!from && mu_c_strncasecmp (buffer, MU_HEADER_FROM,
+					     sizeof (MU_HEADER_FROM) - 1) == 0)
 	    
-	    from = copy_trimmed_value (buffer + sizeof (MU_HEADER_FROM));
-	  else if (!env_from
-		   && mu_c_strncasecmp (buffer, MU_HEADER_ENV_SENDER,
-				        sizeof (MU_HEADER_ENV_SENDER) - 1) == 0)
-	    env_from = copy_trimmed_value (buffer +
-					   sizeof (MU_HEADER_ENV_SENDER));
-	  else if (!env_date
-		   && mu_c_strncasecmp (buffer, MU_HEADER_ENV_DATE,
-				        sizeof (MU_HEADER_ENV_DATE) - 1) == 0)
-	    env_date = copy_trimmed_value (buffer +
-					   sizeof (MU_HEADER_ENV_DATE));
+		from = copy_trimmed_value (buffer + sizeof (MU_HEADER_FROM));
+	      else if (!env_from
+		       && mu_c_strncasecmp (buffer, MU_HEADER_ENV_SENDER,
+					    sizeof (MU_HEADER_ENV_SENDER) - 1) == 0)
+		env_from = copy_trimmed_value (buffer +
+					       sizeof (MU_HEADER_ENV_SENDER));
+	      else if (!env_date
+		       && mu_c_strncasecmp (buffer, MU_HEADER_ENV_DATE,
+					    sizeof (MU_HEADER_ENV_DATE) - 1) == 0)
+		env_date = copy_trimmed_value (buffer +
+					       sizeof (MU_HEADER_ENV_DATE));
+	    }
 	}
       offset += len;
     }
diff --git a/libmailutils/stream/stream.c b/libmailutils/stream/stream.c
index 83a2894..7078d74 100644
--- a/libmailutils/stream/stream.c
+++ b/libmailutils/stream/stream.c
@@ -423,7 +423,7 @@ mu_stream_seek (mu_stream_t stream, mu_off_t offset, int whence,
 	  *pres = stream->offset + stream->pos;
 	  return 0;
 	}
-      offset += stream->offset;
+      offset += stream->offset + stream->pos;
       break;
 
     case MU_SEEK_END:
diff --git a/libmu_sieve/actions.c b/libmu_sieve/actions.c
index 5ccdb22..56bf2bf 100644
--- a/libmu_sieve/actions.c
+++ b/libmu_sieve/actions.c
@@ -306,7 +306,7 @@ sieve_action_reject (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
   rc = build_mime (&mime, mach->msg, val->v.string);
 
   mu_mime_get_message (mime, &newmsg);
-
+  mu_message_unref (newmsg);
   mu_sieve_get_message_sender (mach->msg, &addrtext);
   mu_message_get_header (newmsg, &hdr);
   mu_header_prepend (hdr, MU_HEADER_TO, addrtext);
diff --git a/libmu_sieve/extensions/vacation.c b/libmu_sieve/extensions/vacation.c
index 02e8091..c255fb4 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -563,6 +563,7 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
       if (build_mime (mach, tags, &mime, msg, text))
 	return -1;
       mu_mime_get_message (mime, &newmsg);
+      mu_message_unref (newmsg);
       mu_message_get_header (newmsg, &newhdr);
     }
   
diff --git a/mh/mhn.c b/mh/mhn.c
index cb634ca..a7652da 100644
--- a/mh/mhn.c
+++ b/mh/mhn.c
@@ -2408,6 +2408,7 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level)
     }
 
   mu_mime_get_message (mime, &msg);
+  mu_message_unref (msg);
   mu_message_get_header (msg, &hdr);
   
   if (npart > 2)
@@ -2669,7 +2670,6 @@ mhn_edit (struct compose_env *env, int level)
 		    {
 		      mu_mime_get_message (new_env.mime, &new_msg);
 		      mu_mime_add_part (env->mime, new_msg);
-		      mu_message_unref (new_msg);
 		    }
 		}
 	      else if (strcmp (tok, "#end") == 0)
@@ -2876,7 +2876,8 @@ mhn_compose ()
     return rc;
 
   mu_mime_get_message (mime, &msg);
-  
+  mu_message_unref (msg);
+
   p = strrchr (input_file, '/');
   /* Prepare file names */
   if (p)
@@ -2900,6 +2901,7 @@ mhn_compose ()
       mu_error (_("cannot create output stream (file %s): %s"),
 		name, mu_strerror (rc));
       free (name);
+      mu_mime_unref (mime); 
       return rc;
     }
 
@@ -2916,7 +2918,7 @@ mhn_compose ()
   rename (name, input_file);
 
   free (name);
-  
+  mu_mime_unref (mime); 
   return 0;
 }
 


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Aug 29 02:57:45 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Qxvmz-0004kc-BH
	for mharc-commit-mailutils@gnu.org; Mon, 29 Aug 2011 02:57:45 -0400
Received: from eggs.gnu.org ([140.186.70.92]:33177)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qxvmw-0004k8-Im
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 02:57:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qxvmv-0007IC-1L
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 02:57:42 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54892)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qxvmu-0007I7-W2
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 02:57:41 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qxvmt-0007JU-6f
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 06:57:40 +0000
Date: Mon, 29 Aug 2011 06:57:39 +0000
Message-Id: <E1Qxvmt-0007JU-6f@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-384-g4c82a26
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: ab2982d891ee8b788ec464dadedf8657c753735a
X-Git-Newrev: 4c82a261bcfd422dba0a2ea68b4ea415b42c6217
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Aug 2011 06:57:43 -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=4c82a261bcfd422dba0a2ea68b4ea415b42c6217

The branch, master has been updated
       via  4c82a261bcfd422dba0a2ea68b4ea415b42c6217 (commit)
       via  495b82090be28e7b1a2904a3346776576dcab0d1 (commit)
      from  ab2982d891ee8b788ec464dadedf8657c753735a (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 4c82a261bcfd422dba0a2ea68b4ea415b42c6217
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Aug 29 09:57:00 2011 +0300

    Minor fix
    
    * libmailutils/stream/message_stream.c (_message_open): Return
    MU_ERR_BAD_822_FORMAT if the input is not a valid RFC822.

commit 495b82090be28e7b1a2904a3346776576dcab0d1
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Aug 28 23:58:42 2011 +0300

    Minor fix.
    
    * libmailutils/stream/fltstream.c: Implement shutdown method.

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

Summary of changes:
 libmailutils/stream/fltstream.c      |    8 ++++++++
 libmailutils/stream/message_stream.c |    8 +-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/libmailutils/stream/fltstream.c b/libmailutils/stream/fltstream.c
index 3477d62..ef5f2ba 100644
--- a/libmailutils/stream/fltstream.c
+++ b/libmailutils/stream/fltstream.c
@@ -446,6 +446,13 @@ filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr)
   return 0;
 }
 
+static int
+filter_shutdown (struct _mu_stream *str, int how)
+{
+  struct _mu_filter_stream *fs = (struct _mu_filter_stream *)str;
+  return mu_stream_shutdown (fs->transport, how);
+}
+
 static const char *
 filter_error_string (struct _mu_stream *stream, int rc)
 {
@@ -576,6 +583,7 @@ mu_filter_stream_create (mu_stream_t *pflt,
   fs->stream.done = filter_done;
   if (flags & MU_STREAM_SEEK)
     fs->stream.seek = filter_seek;
+  fs->stream.shutdown = filter_shutdown;
   fs->stream.ctl = filter_ctl;
   fs->stream.wait = filter_wait;
   fs->stream.error_string = filter_error_string;
diff --git a/libmailutils/stream/message_stream.c b/libmailutils/stream/message_stream.c
index 2dd2f02..f0c5f80 100644
--- a/libmailutils/stream/message_stream.c
+++ b/libmailutils/stream/message_stream.c
@@ -230,13 +230,7 @@ _message_open (mu_stream_t stream)
 		  offset += len;
 		  continue;
 		}
-	      rc = mu_stream_seek (transport, - (mu_off_t) len,
-				   MU_SEEK_CUR, &offset);
-	      if (rc)
-		return rc;
-	      str->mark_offset = offset;
-	      str->mark_length = 0;
-	      break;
+	      return MU_ERR_BAD_822_FORMAT;
 	    }
 	  has_headers = 1;
 	  if (!env_from || !env_date)


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Aug 29 05:10:23 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1QxxrL-0002yo-3E
	for mharc-commit-mailutils@gnu.org; Mon, 29 Aug 2011 05:10:23 -0400
Received: from eggs.gnu.org ([140.186.70.92]:38018)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxxrH-0002yI-Aj
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 05:10:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxxrG-0001BO-0e
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 05:10:19 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:46182)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxxrF-0001BK-Rr
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 05:10:17 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1QxxrE-0007rm-Od
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 09:10:17 +0000
Date: Mon, 29 Aug 2011 09:10:16 +0000
Message-Id: <E1QxxrE-0007rm-Od@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-385-g25934e9
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4c82a261bcfd422dba0a2ea68b4ea415b42c6217
X-Git-Newrev: 25934e9ccda6d60b56f77125a6466e5c6b5de305
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Aug 2011 09:10:20 -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=25934e9ccda6d60b56f77125a6466e5c6b5de305

The branch, master has been updated
       via  25934e9ccda6d60b56f77125a6466e5c6b5de305 (commit)
      from  4c82a261bcfd422dba0a2ea68b4ea415b42c6217 (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 25934e9ccda6d60b56f77125a6466e5c6b5de305
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Aug 29 11:53:47 2011 +0300

    Make sure header reads always return the trailing \n, even for empty headers.
    
    * libmailutils/mailbox/header.c (header_read): Always return trailing \n.

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

Summary of changes:
 libmailutils/mailbox/header.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/libmailutils/mailbox/header.c b/libmailutils/mailbox/header.c
index 6913c8b..8c56f4a 100644
--- a/libmailutils/mailbox/header.c
+++ b/libmailutils/mailbox/header.c
@@ -993,6 +993,22 @@ header_read (mu_stream_t is, char *buffer, size_t buflen, size_t *pnread)
   status = mu_header_fill (header);
   if (status)
     return status;
+
+  if (header->spool_size == 0)
+    {
+      size_t len = 0;
+
+      if (hstr->off == 0 && buflen > 0)
+	{
+	  /* Provide the trailing \n */
+	  *buffer = '\n';
+	  hstr->off++;
+	  len = 1;
+	}
+      if (pnread)
+	*pnread = len;
+      return 0;
+    }
   
   if (mu_hdrent_find_stream_pos (header, hstr->off, &ent, &ent_off))
     {


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Aug 29 12:53:14 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Qy55G-0003WZ-1N
	for mharc-commit-mailutils@gnu.org; Mon, 29 Aug 2011 12:53:14 -0400
Received: from eggs.gnu.org ([140.186.70.92]:56954)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qy55B-0003Tv-O0
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 12:53:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qy556-0000uh-8J
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 12:53:09 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37590)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qy556-0000ua-6q
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 12:53:04 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Qy555-0003Sd-DS
	for commit-mailutils@gnu.org; Mon, 29 Aug 2011 16:53:03 +0000
Date: Mon, 29 Aug 2011 16:53:03 +0000
Message-Id: <E1Qy555-0003Sd-DS@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-386-gaa651ae
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 25934e9ccda6d60b56f77125a6466e5c6b5de305
X-Git-Newrev: aa651ae97b561a53c8a2f0235b6763e6bff00c73
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Aug 2011 16:53:10 -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=aa651ae97b561a53c8a2f0235b6763e6bff00c73

The branch, master has been updated
       via  aa651ae97b561a53c8a2f0235b6763e6bff00c73 (commit)
      from  25934e9ccda6d60b56f77125a6466e5c6b5de305 (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 aa651ae97b561a53c8a2f0235b6763e6bff00c73
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Aug 29 19:52:49 2011 +0300

    Fix testsuite.
    
    * mh/tests/burst.at: Remove leading newlines from the test
    messages.

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

Summary of changes:
 mh/tests/burst.at |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mh/tests/burst.at b/mh/tests/burst.at
index 2e383a2..f244fdf 100644
--- a/mh/tests/burst.at
+++ b/mh/tests/burst.at
@@ -18,8 +18,8 @@ m4_pushdef([MH_KEYWORDS],[burst])
 
 MH_CHECK([burst digest],[burst00 burst-digest],[
 mkdir Mail/inbox
-AT_DATA([Mail/inbox/1],[
-From: Sergey Poznyakoff <gray@example.net>
+AT_DATA([Mail/inbox/1],
+[From: Sergey Poznyakoff <gray@example.net>
 To: root@example.com
 Subject: digest
 
@@ -68,8 +68,8 @@ Sergey
 
 MH_CHECK([burst digest /w EB length limit],[burst01 burst-digest-eb-length],[
 mkdir Mail/inbox
-AT_DATA([Mail/inbox/1],[
-From: Sergey Poznyakoff <gray@example.net>
+AT_DATA([Mail/inbox/1],
+[From: Sergey Poznyakoff <gray@example.net>
 To: root@example.com
 Subject: digest
 


hooks/post-receive
-- 
GNU Mailutils


