From MAILER-DAEMON Thu Mar 21 03:21:49 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1UIZor-0002IS-Fp
	for mharc-commit-mailutils@gnu.org; Thu, 21 Mar 2013 03:21:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60537)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UIZok-00027d-6J
	for commit-mailutils@gnu.org; Thu, 21 Mar 2013 03:21:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UIZof-0002WP-Au
	for commit-mailutils@gnu.org; Thu, 21 Mar 2013 03:21:42 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:44571)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UIZof-0002WL-7O
	for commit-mailutils@gnu.org; Thu, 21 Mar 2013 03:21:37 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UIZod-0003om-LP
	for commit-mailutils@gnu.org; Thu, 21 Mar 2013 07:21:36 +0000
Date: Thu, 21 Mar 2013 07:21:36 +0000
Message-Id: <E1UIZod-0003om-LP@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-638-g41a8ddf
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 375ffa14056f4165c9674fa94c243bd632c43742
X-Git-Newrev: 41a8ddfce70eda896cc2516bceb1cc424e95e5c4
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 21 Mar 2013 07:21:48 -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=41a8ddfce70eda896cc2516bceb1cc424e95e5c4

The branch, master has been updated
       via  41a8ddfce70eda896cc2516bceb1cc424e95e5c4 (commit)
      from  375ffa14056f4165c9674fa94c243bd632c43742 (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 41a8ddfce70eda896cc2516bceb1cc424e95e5c4
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Mar 21 08:51:21 2013 +0200

    Raise version number

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

Summary of changes:
 NEWS         |    9 ++++-----
 configure.ac |    2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index e2ea71d..06632e5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,11 @@
-GNU mailutils NEWS -- history of user-visible changes. 2013-02-16
-Copyright (C) 2002-2012 Free Software Foundation, Inc.
+GNU mailutils NEWS -- history of user-visible changes. 2013-03-21
+Copyright (C) 2002-2013 Free Software Foundation, Inc.
 See the end of file for copying conditions.
 
 Please send mailutils bug reports to <bug-mailutils@gnu.org>.
 
 
-Version 2.99.97 (Git)
+Version 2.99.98 (Git)
 
 This version is a major rewrite of GNU Mailutils.  Quite a few parts
 of the basic framework were rewritten from scratch, while some others
@@ -1717,8 +1717,7 @@ The first release.
 ----------------------------------------------------------------------
 Copyright information:
 
-Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,
-2008 Free Software Foundation, Inc.
+Copyright (C) 2002-2012, Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/configure.ac b/configure.ac
index 1e5b6b8..9d8b14c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,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.97], [bug-mailutils@gnu.org], [mailutils])
+AC_INIT([GNU Mailutils], [2.99.98], [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])


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Mar 25 09:03:13 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1UK73R-00042r-Rv
	for mharc-commit-mailutils@gnu.org; Mon, 25 Mar 2013 09:03:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55623)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UK73O-0003yy-PF
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 09:03:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UK73I-0000ka-Od
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 09:03:10 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60436)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UK73I-0000kL-LD
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 09:03:04 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UK73I-0000KY-2O
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 13:03:04 +0000
Date: Mon, 25 Mar 2013 13:03:04 +0000
Message-Id: <E1UK73I-0000KY-2O@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-640-gd1e34b1
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 41a8ddfce70eda896cc2516bceb1cc424e95e5c4
X-Git-Newrev: d1e34b1a9662b7f76463604c6ec9b584d0bbe696
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 25 Mar 2013 13:03:12 -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=d1e34b1a9662b7f76463604c6ec9b584d0bbe696

The branch, master has been updated
       via  d1e34b1a9662b7f76463604c6ec9b584d0bbe696 (commit)
       via  81bc65e69d44f3e5ccdfd8a6ac38e3a21d3006af (commit)
      from  41a8ddfce70eda896cc2516bceb1cc424e95e5c4 (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 d1e34b1a9662b7f76463604c6ec9b584d0bbe696
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Mar 25 14:51:56 2013 +0200

    Fix interaction with POP3 servers that do not support the CAPA command.
    
    * libproto/pop/mbox.c (pop_open): Do not bail
    out if the CAPA command returns -ERR. Assume
    a pre-RFC2449 server.
    * include/mailutils/pop3.h (mu_pop3_strresp)
    (mu_pop3_sget_response,mu_pop3_aget_response)
    (mu_pop3_get_response): New protos.
    * libproto/pop/pop3_response.c (mu_pop3_response): Don't
    make out a fake response in case of a I/O error.
    (mu_pop3_strresp)
    (mu_pop3_sget_response,mu_pop3_aget_response)
    (mu_pop3_get_response): New functions.

commit 81bc65e69d44f3e5ccdfd8a6ac38e3a21d3006af
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Mar 25 14:50:57 2013 +0200

    Bugfix.
    
    * libmu_auth/ldap.c (_mu_ldap_search): Fix improper addressing of env.

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

Summary of changes:
 include/mailutils/pop3.h     |   14 +++++---
 libmu_auth/ldap.c            |    2 +-
 libproto/pop/mbox.c          |   11 +++++-
 libproto/pop/pop3_response.c |   72 ++++++++++++++++++++++++++++++++----------
 4 files changed, 74 insertions(+), 25 deletions(-)

diff --git a/include/mailutils/pop3.h b/include/mailutils/pop3.h
index 5e16b5d..1a8199d 100644
--- a/include/mailutils/pop3.h
+++ b/include/mailutils/pop3.h
@@ -55,7 +55,7 @@ int  mu_pop3_apop (mu_pop3_t pop3, const char *name, const char *digest);
 
 int  mu_pop3_stls (mu_pop3_t pop3);
 
-/* It is the responsability of the caller to call mu_iterator_destroy() when
+/* It is the responsibility of the caller to call mu_iterator_destroy() when
    done with the iterator.  The items returned by the iterator are of type
    "const char *", no processing is done on the item except the removal of
    the trailing newline.  */
@@ -82,7 +82,7 @@ int  mu_pop3_pass (mu_pop3_t pop3, const char *pass);
 
 int  mu_pop3_quit (mu_pop3_t pop3);
 
-/* A stream is returned with the multi-line answer.  It is the responsability
+/* A stream is returned with the multi-line answer.  It is the responsibility
    of the caller to call mu_stream_destroy() to dipose of the stream.  */
 int  mu_pop3_retr (mu_pop3_t pop3, unsigned int mesgno,
 		   mu_stream_t *pstream);
@@ -91,12 +91,12 @@ int  mu_pop3_rset (mu_pop3_t pop3);
 
 int  mu_pop3_stat (mu_pop3_t pop3, size_t *count, mu_off_t *octets);
 
-/* A stream is returned with the multi-line answer.  It is the responsability
+/* A stream is returned with the multi-line answer.  It is the responsibility
    of the caller to call mu_stream_destroy() to dipose of the stream.  */
 int  mu_pop3_top (mu_pop3_t pop3, unsigned int mesgno,
 		  unsigned int lines, mu_stream_t *pstream);
 
-/* The uidl is malloc'ed and returned in puidl; it is the responsability of
+/* The uidl is malloc'ed and returned in puidl; it is the responsibility of
    the caller to free() the uild when done.  */
 int  mu_pop3_uidl (mu_pop3_t pop3, unsigned int mesgno, char **puidl);
 
@@ -116,7 +116,11 @@ int mu_pop3_user (mu_pop3_t pop3, const char *user);
    the message could be retrieved, but it is up to the caller to do the
    parsing.  */
 int  mu_pop3_response (mu_pop3_t pop3, size_t *nread);
-
+const char *mu_pop3_strresp (mu_pop3_t pop3);
+int mu_pop3_sget_response (mu_pop3_t pop3, const char **sptr);
+int mu_pop3_aget_response (mu_pop3_t pop3, char **sptr);
+int mu_pop3_get_response (mu_pop3_t pop3, char *buf, size_t len, size_t *plen);
+  
 int  mu_pop3_writeline (mu_pop3_t pop3, const char *format, ...)
                                   MU_PRINTFLIKE(2,3);
 
diff --git a/libmu_auth/ldap.c b/libmu_auth/ldap.c
index c454910..2b7aff2 100644
--- a/libmu_auth/ldap.c
+++ b/libmu_auth/ldap.c
@@ -534,7 +534,7 @@ _mu_ldap_search (LDAP *ld, const char *filter_pat, const char *key,
 
   env[0] = "user";
   env[1] = key;
-  env[3] = NULL;
+  env[2] = NULL;
 
   ws.ws_env = env;
   if (mu_wordsplit (filter_pat, &ws,
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index d85c38e..fd0cf33 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -179,8 +179,15 @@ pop_open (mu_mailbox_t mbox, int flags)
 	break;
 
       status = mu_pop3_capa (mpd->pop3, 1, NULL);
-      if (status)
-	break;
+      if (status == MU_ERR_REPLY) 
+        {
+	  mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR, 
+		    ("server rejected the CAPA command: %s",
+		     mu_pop3_strresp (mpd->pop3)));
+	  /* try to continue anyway */
+        } 
+      else if (status)
+	return status;
 
 #ifdef WITH_TLS      
       if (!mpd->pops &&
diff --git a/libproto/pop/pop3_response.c b/libproto/pop/pop3_response.c
index 87f9897..9b03a48 100644
--- a/libproto/pop/pop3_response.c
+++ b/libproto/pop/pop3_response.c
@@ -25,8 +25,7 @@
 #include <mailutils/cctype.h>
 #include <mailutils/cstr.h>
 #include <mailutils/sys/pop3.h>
-
-#define POP3_DEFERR "-ERR POP3 IO ERROR"
+#include <mailutils/util.h>
 
 /* If we did not grap the ack already, call pop3_readline() but handle
    Nonblocking also.  */
@@ -48,21 +47,6 @@ mu_pop3_response (mu_pop3_t pop3, size_t *pnread)
 	  n = mu_rtrim_class (pop3->ackbuf, MU_CTYPE_SPACE);
 	  MU_POP3_FSET (pop3, MU_POP3_ACK); /* Flag that we have the ack.  */
 	}
-      else
-	{
-	  /* Provide them with an error.  */
-	  if (pop3->acksize < sizeof (POP3_DEFERR))
-	    {
-	      char *p = realloc (pop3->ackbuf, sizeof (POP3_DEFERR));
-	      if (p)
-		{
-		  pop3->ackbuf = p;
-		  pop3->acksize = sizeof (POP3_DEFERR);
-		}
-	    }
-	  if (pop3->ackbuf)
-	    strncpy (pop3->ackbuf, POP3_DEFERR, pop3->acksize);
-	}
     }
   else if (pop3->ackbuf)
     n = strlen (pop3->ackbuf);
@@ -78,3 +62,57 @@ mu_pop3_response (mu_pop3_t pop3, size_t *pnread)
     *pnread = n;
   return status;
 }
+
+const char *
+mu_pop3_strresp (mu_pop3_t pop3)
+{
+    if (pop3 == NULL)
+      return NULL;
+    if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+      return NULL;
+    return pop3->ackbuf;
+}
+
+int
+mu_pop3_sget_response (mu_pop3_t pop3, const char **sptr)
+{
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  *sptr = pop3->ackbuf;
+  return 0;
+}
+
+int
+mu_pop3_aget_response (mu_pop3_t pop3, char **sptr)
+{
+  char *p;
+  
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  p = strdup (pop3->ackbuf);
+  if (!p)
+    return ENOMEM;
+  *sptr = p;
+  return 0;
+}
+
+int
+mu_pop3_get_response (mu_pop3_t pop3, char *buf, size_t len, size_t *plen)
+{
+  size_t size;
+  
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  
+  if (buf)
+    size = mu_cpystr (buf, pop3->ackbuf, len);
+  if (plen)
+    *plen = size;
+  return 0;
+}


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Mar 25 12:26:25 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1UKAE5-0005hc-IS
	for mharc-commit-mailutils@gnu.org; Mon, 25 Mar 2013 12:26:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59113)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKAE2-0005ad-Sv
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 12:26:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKAE1-0006FH-0d
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 12:26:22 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60536)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKAE0-0006Ee-Sz
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 12:26:20 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKADa-000317-5t
	for commit-mailutils@gnu.org; Mon, 25 Mar 2013 16:26:11 +0000
Date: Mon, 25 Mar 2013 16:25:55 +0000
Message-Id: <E1UKADa-000317-5t@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-641-g802150a
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d1e34b1a9662b7f76463604c6ec9b584d0bbe696
X-Git-Newrev: 802150a165325d9d7a2824765c32852afc6e7797
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 25 Mar 2013 16:26:24 -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=802150a165325d9d7a2824765c32852afc6e7797

The branch, master has been updated
       via  802150a165325d9d7a2824765c32852afc6e7797 (commit)
      from  d1e34b1a9662b7f76463604c6ec9b584d0bbe696 (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 802150a165325d9d7a2824765c32852afc6e7797
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Mar 25 18:20:50 2013 +0200

    Do not ask for ESMTP credentials if unable to handle them.
    
    * libproto/mailer/smtp.c (smtp_open): Disable ESTMP AUTH if
    GSASL support is not compiled.
    * libproto/mailer/smtp_auth.c (mu_smtp_auth): If compiled
    without GSASL, don't attempt to obtain user credentials.

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

Summary of changes:
 libproto/mailer/smtp.c      |   12 +++++++++++-
 libproto/mailer/smtp_auth.c |    6 ++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index f8f3dd4..7dea24f 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -134,6 +134,16 @@ smtp_mailer_add_auth_mech (struct _smtp_mailer *smtp_mailer, const char *str)
     }
 }
 
+/* FIXME: So far, ESMTP AUTH support is available only if MU is compiled
+   with GNU SASL. Should this change, the define below must be changed
+   as well. See also smtp_auth.c.
+ */
+#ifdef WITH_GSASL
+# define DFLNOAUTH 0
+#else
+# define DFLNOAUTH 1
+#endif
+
 static int
 smtp_open (mu_mailer_t mailer, int flags)
 {
@@ -144,7 +154,7 @@ smtp_open (mu_mailer_t mailer, int flags)
   char **parmv = NULL;
   int tls = 0;
   int nostarttls = 0;
-  int noauth = 0;
+  int noauth = DFLNOAUTH;
 
   rc = mu_url_sget_scheme (mailer->url, &scheme);
   if (rc == 0) 
diff --git a/libproto/mailer/smtp_auth.c b/libproto/mailer/smtp_auth.c
index d015b6c..20db31a 100644
--- a/libproto/mailer/smtp_auth.c
+++ b/libproto/mailer/smtp_auth.c
@@ -112,6 +112,7 @@ mu_smtp_auth (mu_smtp_t smtp)
   if (smtp->state != MU_SMTP_MAIL)
     return MU_ERR_SEQ;
 
+#if defined(WITH_GSASL)
   /* Obtain missing authentication credentials either from the
      URL (when supplied) or from the user ticket file, or by
      asking the user, if anything else fails.
@@ -126,10 +127,11 @@ mu_smtp_auth (mu_smtp_t smtp)
   _mu_smtp_fixup_params (smtp);
   if (!smtp->param[MU_SMTP_PARAM_USERNAME] && !smtp->secret)
     return MU_ERR_AUTH_NO_CRED;
-#if defined(WITH_GSASL)
   return _mu_smtp_gsasl_auth (smtp);
 #else
-  /* FIXME: Provide support for some basic authentication methods */
+  /* FIXME: Provide support for some basic authentication methods.
+     Once done, make sure _mu_smtp_fixup_params is called for this
+     branc as well (though see the fixme above). */
   return ENOSYS;
 #endif
 }


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Wed Mar 27 03:38:53 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1UKkwe-0005A7-Uz
	for mharc-commit-mailutils@gnu.org; Wed, 27 Mar 2013 03:38:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35465)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKkwb-000590-Fr
	for commit-mailutils@gnu.org; Wed, 27 Mar 2013 03:38:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKkwa-0004ck-9v
	for commit-mailutils@gnu.org; Wed, 27 Mar 2013 03:38:49 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:52919)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKkwa-0004ce-6G
	for commit-mailutils@gnu.org; Wed, 27 Mar 2013 03:38:48 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1UKkwW-0003S5-7d
	for commit-mailutils@gnu.org; Wed, 27 Mar 2013 07:38:45 +0000
Date: Wed, 27 Mar 2013 07:38:44 +0000
Message-Id: <E1UKkwW-0003S5-7d@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-642-g9b2c819
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 802150a165325d9d7a2824765c32852afc6e7797
X-Git-Newrev: 9b2c81921aa7c32542db310c819586f81f0ed082
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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: Wed, 27 Mar 2013 07:38:51 -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=9b2c81921aa7c32542db310c819586f81f0ed082

The branch, master has been updated
       via  9b2c81921aa7c32542db310c819586f81f0ed082 (commit)
      from  802150a165325d9d7a2824765c32852afc6e7797 (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 9b2c81921aa7c32542db310c819586f81f0ed082
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Mar 27 09:36:20 2013 +0200

    Fix the use of localname and localdomain in ~/.mtstailor.
    
    * mh/send.c (read_mts_profile): Fix the handling of
    localname vs. localdomain.  The localname setting
    used alone overrides the hostname as returned by
    mu_hostname.  The value of localdomain, if set, is
    appended to the hostname (eventually modified by
    localname), with a "." as a separator.

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

Summary of changes:
 mh/send.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/mh/send.c b/mh/send.c
index f9617a0..2fd1e92 100644
--- a/mh/send.c
+++ b/mh/send.c
@@ -352,19 +352,9 @@ read_mts_profile ()
   rc = mu_property_sget_value (mts_profile, "localdomain", &p);
   if (rc == 0)
     {
-      char *newdomain;
-
-      newdomain = mu_alloc (strlen (hostname) + 1 + strlen (p) + 1);
-      strcpy (newdomain, hostname);
-      strcat (newdomain, ".");
-      strcat (newdomain, p);
-      rc = mu_set_user_email_domain (newdomain);
-      free (newdomain);
-      if (rc)
-	{
-	  mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc));
-	  exit (1);
-	}
+      hostname = mu_realloc (hostname, strlen (hostname) + 1 + strlen (p) + 1);
+      strcat (hostname, ".");
+      strcat (hostname, p);
     }
   else if (rc != MU_ERR_NOENT)
     {
@@ -372,6 +362,14 @@ read_mts_profile ()
 		       "localdomain", rc);
       exit (1);
     }
+
+  rc = mu_set_user_email_domain (hostname);
+  free (hostname);
+  if (rc)
+    {
+      mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc));
+      exit (1);
+    }
   
   rc = mu_property_sget_value (mts_profile, "username", &p);
   if (rc == 0)


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Sat Mar 30 04:09:25 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ULqqr-0008Rv-3l
	for mharc-commit-mailutils@gnu.org; Sat, 30 Mar 2013 04:09:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37362)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULqql-0008RS-FO
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 04:09:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULqqh-0000C5-Ub
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 04:09:19 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37614)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULqqh-0000C1-RC
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 04:09:15 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULqqd-0004uJ-Kq
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 08:09:15 +0000
Date: Sat, 30 Mar 2013 08:09:12 +0000
Message-Id: <E1ULqqd-0004uJ-Kq@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-643-gb8dc129
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 9b2c81921aa7c32542db310c819586f81f0ed082
X-Git-Newrev: b8dc1293e299380a32992baa98a773282354d459
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 30 Mar 2013 08:09: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=b8dc1293e299380a32992baa98a773282354d459

The branch, master has been updated
       via  b8dc1293e299380a32992baa98a773282354d459 (commit)
      from  9b2c81921aa7c32542db310c819586f81f0ed082 (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 b8dc1293e299380a32992baa98a773282354d459
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 30 10:08:52 2013 +0200

    Implement msgchk
    
    * mh/msgchk.c: New file.
    * mh/Makefile.am: Build msgchk.
    * mh/mh_getopt.h: Update.
    * mh/.gitignore: Update.
    * mh/TODO: Update.

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

Summary of changes:
 mh/.gitignore  |    1 +
 mh/Makefile.am |    1 +
 mh/TODO        |    4 +-
 mh/mh_getopt.h |    7 +-
 mh/msgchk.c    |  396 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 407 insertions(+), 2 deletions(-)
 create mode 100644 mh/msgchk.c

diff --git a/mh/.gitignore b/mh/.gitignore
index 0d106bb..1b897e3 100644
--- a/mh/.gitignore
+++ b/mh/.gitignore
@@ -23,6 +23,7 @@ mhn
 mhseq
 mhparam
 mhpath
+msgchk
 pick
 pick-gram.c
 pick-gram.h
diff --git a/mh/Makefile.am b/mh/Makefile.am
index a4c430f..9b05c4f 100644
--- a/mh/Makefile.am
+++ b/mh/Makefile.am
@@ -34,6 +34,7 @@ bin_PROGRAMS = \
  mhparam\
  mhpath\
  mhseq\
+ msgchk\
  pick\
  prompter\
  refile\
diff --git a/mh/TODO b/mh/TODO
index 7156390..6620fab 100644
--- a/mh/TODO
+++ b/mh/TODO
@@ -41,6 +41,7 @@ State	Nice	Utility		Comments
 +	10	whatnow		
 +	20	sortm
 +       20      prompter
+*       20      msgchk          --date functionality not implemented
 
 Utilities In Alphabetical Order
 ===============================
@@ -55,6 +56,7 @@ mark
 mhl
 mhn
 mhpath
+msgchk
 pick
 prompter
 refile
@@ -68,4 +70,4 @@ whom
 
 Individual TODOs
 ================
-* Add support for RFC 2231 to mhn
\ No newline at end of file
+* Add support for RFC 2231 to mhn
diff --git a/mh/mh_getopt.h b/mh/mh_getopt.h
index a0fb7c8..a46ddb2 100644
--- a/mh/mh_getopt.h
+++ b/mh/mh_getopt.h
@@ -46,6 +46,7 @@ enum mh_arg {
   ARG_ALL,		
   ARG_AND,		
   ARG_ANNOTATE,		
+  ARG_APOP,
   ARG_AUDIT,		
   ARG_AUTO,		
   ARG_BEFORE,		
@@ -83,6 +84,7 @@ enum mh_arg {
   ARG_FROM,		
   ARG_GROUP,              
   ARG_HEADER,		
+  ARG_HOST,
   ARG_INPLACE,		
   ARG_INTERACTIVE,	
   ARG_LBRACE,		
@@ -95,6 +97,7 @@ enum mh_arg {
   ARG_MOVETO,
   ARG_MSGID,		
   ARG_NOALIAS,            
+  ARG_NOAPOP,
   ARG_NOAUDIT,		
   ARG_NOAUTO,		
   ARG_NOBELL,		
@@ -114,13 +117,14 @@ enum mh_arg {
   ARG_NOFORWARD,		
   ARG_NOHEADER,		
   ARG_NOHEADERS,		
-  ARG_NOINTERACTIVE,      
   ARG_NOINPLACE,		
+  ARG_NOINTERACTIVE,      
   ARG_NOLIMIT,		
   ARG_NOLIST,		
   ARG_NOMIME,		
   ARG_NOMOREPROC,		
   ARG_NOMSGID,		
+  ARG_NONOTIFY,
   ARG_NOPAUSE,		
   ARG_NOPUBLIC,		
   ARG_NOPUSH,		
@@ -134,6 +138,7 @@ enum mh_arg {
   ARG_NOSTORE,		
   ARG_NOT,		
   ARG_NOTEXTFIELD,	
+  ARG_NOTIFY,
   ARG_NOTOTAL,		
   ARG_NOTRUNCATE,		
   ARG_NOUSE,		
diff --git a/mh/msgchk.c b/mh/msgchk.c
new file mode 100644
index 0000000..36f40ea
--- /dev/null
+++ b/mh/msgchk.c
@@ -0,0 +1,396 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2013 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.
+
+   GNU Mailutils 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 GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include "mh.h"
+#include "mailutils/kwd.h"
+#include "mailutils/folder.h"
+#include "mailutils/auth.h"
+#include <pwd.h>
+
+static char doc[] = N_("GNU MH msgchk")"\v"
+N_("Use -help to obtain the list of traditional MH options.");
+static char args_doc[] = N_("USER [USER...]");
+
+/* GNU options */
+static struct argp_option options[] = {
+  {"date",         ARG_DATE,    N_("BOOL"), OPTION_ARG_OPTIONAL,
+   N_("print out the last date mail was read") },
+  {"nodate",       ARG_NODATE,  NULL, OPTION_HIDDEN,
+   N_("don't print out the last date mail was read") },
+  {"notify",       ARG_NOTIFY, "all|mail|nomail", 0,
+   N_("produce a message upon these events") },
+  {"nonotify",     ARG_NONOTIFY, "all|mail|nomail", 0,
+   N_("disable notification") },
+  {"host",         ARG_HOST,     N_("URL"), 0,
+   N_("check mail on this host or URL") },
+  {"user",         ARG_USER,     N_("NAME"), 0,
+   N_("set user name for remote mailbox access") },
+  {"apop",         ARG_APOP,    N_("BOOL"), OPTION_ARG_OPTIONAL,
+   N_("enable APOP") },
+  {"noapop",       ARG_NOAPOP,  NULL, OPTION_HIDDEN,
+   N_("disable APOP") },
+  {NULL}
+};
+
+/* Traditional MH options */
+struct mh_option mh_option[] = {
+  { "date", MH_OPT_BOOL },
+  { "notify", MH_OPT_ARG, "all|mail|nomail" },
+  { "nonotify", MH_OPT_ARG, "all|mail|nomail" },
+  { "host", MH_OPT_ARG, "host-or-url" },
+  { "user", MH_OPT_ARG, "name" },
+  { "apop", MH_OPT_BOOL },
+  { NULL }
+};
+
+int date_option;
+int apop_option;
+char *remote_host;
+char *remote_user;
+
+#define NOTIFY_MAIL   0x1
+#define NOTIFY_NOMAIL 0x2
+#define NOTIFY_ALL    (NOTIFY_MAIL|NOTIFY_NOMAIL)
+
+int notify = NOTIFY_ALL;
+
+static struct mu_kwd notifytab[] = {
+  { "mail", NOTIFY_MAIL },
+  { "nomail", NOTIFY_NOMAIL },
+  { "all", NOTIFY_ALL },
+  { NULL }
+};
+
+static error_t
+opt_handler (int key, char *arg, struct argp_state *state)
+{
+  int n;
+  
+  switch (key)
+    {
+    case ARG_DATE:
+      date_option = is_true (arg);
+      break;
+      
+    case ARG_NODATE:
+      date_option = 0;
+      break;
+      
+    case ARG_APOP:
+      apop_option = is_true (arg);
+      break;
+      
+    case ARG_NOAPOP:
+      apop_option = 0;
+      break;
+      
+    case ARG_NOTIFY:
+      if (mu_kwd_xlat_name (notifytab, arg, &n))
+	argp_error (state, "unknown notify argument: %s", arg);
+      notify |= n;
+      break;
+      
+    case ARG_NONOTIFY:
+      if (mu_kwd_xlat_name (notifytab, arg, &n))
+	argp_error (state, "unknown notify argument: %s", arg);
+      notify &= ~n;
+      break;
+      
+    case ARG_USER:
+      remote_user = arg;
+      break;
+      
+    case ARG_HOST:
+      remote_host = arg;
+      break;
+      
+    default:
+      return ARGP_ERR_UNKNOWN;
+    }
+  return 0;
+}
+
+static char *
+attach_auth_ticket (mu_mailbox_t mbox)
+{
+  char *filename = NULL;
+  mu_folder_t folder = NULL;
+  mu_authority_t auth = NULL;
+
+  if (mu_mailbox_get_folder (mbox, &folder) == 0
+      && mu_folder_get_authority (folder, &auth) == 0
+      && auth)
+    {
+      mu_wicket_t wicket;
+      int rc;
+  
+      filename = mu_tilde_expansion (mu_ticket_file, MU_HIERARCHY_DELIMITER,
+				     NULL);
+      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
+		("Reading user ticket file %s", filename));
+      
+      if ((rc = mu_file_wicket_create (&wicket, filename)) == 0)
+	{
+	  mu_ticket_t ticket;
+      
+	  if ((rc = mu_wicket_get_ticket (wicket, NULL, &ticket)) == 0)
+	    {
+	      rc = mu_authority_set_ticket (auth, ticket);
+	      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
+			("Retrieved and set ticket: %d", rc));
+	    }
+	  else
+	    mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		      ("Error retrieving ticket: %s\n",
+		       mu_strerror (rc)));
+	  mu_wicket_destroy (&wicket);
+	}
+      else
+        mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		  ("Error creating wicket: %s\n", mu_strerror (rc)));
+      if (rc)
+	{
+	  free (filename);
+	  filename = NULL;
+	}
+    }
+  return filename;
+}
+
+int
+checkmail (const char *username, int personal)
+{
+  int rc;
+  mu_url_t url;
+  mu_mailbox_t mbox;
+  size_t recent = 0, count = 0;
+  int status = 1;
+  int have_user;
+  
+  if (remote_host)
+    {
+      static mu_url_t pop_hint;
+
+      if (pop_hint)
+	{
+	  rc = mu_url_create (&pop_hint, "pop://");
+	  if (rc)
+	    {
+	      mu_error ("cannot create URL hint: %s", mu_strerror (rc));
+	      exit (2);
+	    }
+	}
+      
+      rc = mu_url_create_hint (&url, remote_host, MU_URL_PARSE_DEFAULT,
+			       pop_hint);
+      if (rc)
+	{
+	  mu_diag_funcall (MU_DIAG_ERROR, "mu_url_create_hint", remote_host,
+			   rc);
+	  exit (2);
+	}
+      
+      if (apop_option)
+	{
+	  rc = mu_url_set_auth (url, "+APOP");
+	  if (rc)
+	    {
+	      mu_diag_funcall (MU_DIAG_ERROR, "mu_url_set_auth", "+APOP", rc);
+	      exit (2);
+	    }
+	}
+    }
+  else
+    {
+      char *s;
+      rc = mu_construct_user_mailbox_url (&s, username);
+      if (rc)
+	{
+	  mu_diag_funcall (MU_DIAG_ERROR, "mu_construct_user_mailbox_url",
+			   username, rc);
+	  exit (2);
+	}
+      
+      rc = mu_url_create (&url, s);
+      if (rc)
+	{
+	  mu_diag_funcall (MU_DIAG_ERROR, "mu_url_create", s, rc);
+	  exit (2);
+	}
+      free (s);
+    }
+  
+  rc = mu_mailbox_create_from_url (&mbox, url);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_create_from_url",
+		       mu_url_to_string (url), rc);
+      exit (2);
+    }
+
+  if (personal)
+    {
+      char *filename = attach_auth_ticket (mbox);
+
+      have_user = mu_url_has_flag (url, MU_URL_USER);
+      if (!have_user)
+	{
+	  mu_url_t tickurl;
+
+	  if (mu_wicket_file_match_url (filename, url, MU_URL_PARSE_ALL,
+					&tickurl) == 0)
+	    {
+	      have_user = mu_url_has_flag (tickurl, MU_URL_USER);
+	      mu_url_destroy (&tickurl);
+	    }
+	}
+      free (filename);
+    }
+  else
+    have_user = 0;
+
+  if (!have_user)
+    {
+      mu_url_t turl;
+
+      mu_mailbox_get_url (mbox, &turl);
+      rc = mu_url_set_user (turl, username);
+      if (rc)
+	{
+	  mu_diag_funcall (MU_DIAG_ERROR, "mu_url_set_user", username, rc);
+	  exit (2);
+	}
+    }
+  
+  rc = mu_mailbox_open (mbox, MU_STREAM_READ);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_open",
+		       mu_url_to_string (url), rc);
+      exit (2);
+    }
+  
+  rc = mu_mailbox_messages_count (mbox, &count);
+  if (rc)
+    mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_count",
+		     mu_url_to_string (url), rc);
+  if (count)
+    {
+      status = 0;
+
+      if (notify & NOTIFY_MAIL)
+	{
+	  mu_off_t mbsiz = 0;
+	  
+	  rc = mu_mailbox_messages_recent (mbox, &recent);
+	  if (rc)
+	    {
+	      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_recent",
+			       mu_url_to_string (url), rc);
+
+	      mu_mailbox_get_size (mbox, &mbsiz);
+	      if (personal)
+		mu_printf (ngettext ("You have %lu message",
+				     "You have %lu messages",
+				     count),
+			   (unsigned long) count);
+	      else
+		mu_printf (ngettext ("%s has %lu message",
+				     "%s has %lu messages",
+				     count),
+			   username, (unsigned long) count);
+	      mu_printf (ngettext (" (%lu byte)",
+				   " (%lu bytes)",
+				   mbsiz), (unsigned long) mbsiz);
+	    }
+	  else
+	    {
+	      if (personal)
+		mu_printf (recent ? _("You have new mail waiting") :
+			            _("You have old mail waiting"));
+	      else
+		mu_printf (recent ? _("%s has new mail waiting") :
+			            _("%s has old mail waiting"), username);
+	    }
+
+	  if (date_option)
+	    /*FIXME*/;
+	      
+	  mu_printf ("\n");
+	}
+    }
+  else
+    {
+      status = 1;
+
+      if (notify & NOTIFY_NOMAIL)
+	{
+	  if (personal)
+	    mu_printf (_("You don't have any mail waiting\n"));
+	  else
+	    mu_printf (_("%s doesn't have any mail waiting\n"),
+		       username);
+	}
+    }
+  mu_mailbox_destroy (&mbox);
+  
+  return status;
+}
+
+int
+main (int argc, char **argv)
+{
+  int index;
+  int rc = 0;
+  
+  MU_APP_INIT_NLS ();
+  
+  mh_argp_init ();
+  mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
+		 opt_handler, NULL, &index);
+
+  argc -= index;
+  argv += index;
+
+  if (argc == 0)
+    {
+      if (remote_user)
+	rc |= checkmail (remote_user, 1);
+      else
+	{
+	  struct passwd *pw = getpwuid (getuid ());
+	  if (!pw)
+	    {
+	      mu_error (_("cannot determine my username"));
+	      return 2;
+	    }
+	  rc |= checkmail (pw->pw_name, 1);
+	}
+    }
+  else if (remote_user)
+    {
+      mu_error (_("no arguments are allowed when the -user option is given"));
+      return 2;
+    }
+  else
+    while (argc--)
+      rc |= checkmail (*argv++, 0);
+
+  return rc;
+}
+  
+
+


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Sat Mar 30 11:15:50 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ULxVW-00044B-Pb
	for mharc-commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:15:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46604)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxVO-00043D-WB
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:15:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxVM-0003jY-04
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:15:42 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:34964)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxVL-0003jS-SL
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:15:39 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxVB-0000eW-AP
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 15:15:38 +0000
Date: Sat, 30 Mar 2013 15:15:30 +0000
Message-Id: <E1ULxVB-0000eW-AP@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-644-g441dda6
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: b8dc1293e299380a32992baa98a773282354d459
X-Git-Newrev: 441dda65dd5aa0a97bc26ea7398d38de43dbee06
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 30 Mar 2013 15:15:50 -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=441dda65dd5aa0a97bc26ea7398d38de43dbee06

The branch, master has been updated
       via  441dda65dd5aa0a97bc26ea7398d38de43dbee06 (commit)
      from  b8dc1293e299380a32992baa98a773282354d459 (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 441dda65dd5aa0a97bc26ea7398d38de43dbee06
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 30 16:47:38 2013 +0200

    Implement IMAP SEARCH. New function mu_mailbox_access_time.
    
    * include/mailutils/imap.h (mu_imap_search): New proto.
    * libproto/imap/search.c: New file.
    * include/mailutils/sys/imap.h (MU_IMAP_CLIENT_SEARCH_RX): New state.
    * libproto/imap/fetch.c: Fix debugging categories
    * libproto/imap/mbox.c (_imap_messages_recent)
    (_imap_message_unseen): Use search if information is not
    readily available.
    * libproto/imap/status.c (_mu_imap_status_name_table): Comment
    out UNSEEN: its semantics is entirely different from what we
    need.
    * libproto/imap/Makefile.am: Add new file.
    * mu/imap.c: Implement search.
    
    * include/mailutils/sys/mailbox.h (_mu_mailbox) <_get_atime>: New method.
    * include/mailutils/mailbox.h (mu_mailbox_access_time): New proto.
    * libproto/mbox/mbox.c (_mailbox_mbox_init): Initialize
    >_get_atime.
    * libmailutils/mailbox/mailbox.c (mu_mailbox_access_time): New function.
    
    * libmailutils/datetime/utcoff.c (mu_utc_offset): Rewrite using tzset.
    
    * mh/msgchk.c: Implement --date.
    Check for new mail using both recent and unseen messages.

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

Summary of changes:
 include/mailutils/imap.h        |    3 +
 include/mailutils/mailbox.h     |    3 +-
 include/mailutils/sys/imap.h    |    1 +
 include/mailutils/sys/mailbox.h |    2 +
 libmailutils/datetime/utcoff.c  |    9 +--
 libmailutils/mailbox/mailbox.c  |    9 +++
 libproto/imap/Makefile.am       |    1 +
 libproto/imap/fetch.c           |    4 +-
 libproto/imap/mbox.c            |   48 +++++++++++++-
 libproto/imap/search.c          |  134 +++++++++++++++++++++++++++++++++++++++
 libproto/imap/status.c          |    2 +-
 libproto/mbox/mbox.c            |   16 +++++
 mh/msgchk.c                     |   25 ++++++-
 mu/imap.c                       |   33 ++++++++++
 14 files changed, 272 insertions(+), 18 deletions(-)
 create mode 100644 libproto/imap/search.c

diff --git a/include/mailutils/imap.h b/include/mailutils/imap.h
index 300e590..c015d53 100644
--- a/include/mailutils/imap.h
+++ b/include/mailutils/imap.h
@@ -143,6 +143,9 @@ int mu_imap_session_state_str (int state, const char **pstr);
 
 int mu_imap_tag (mu_imap_t imap, const char **pseq);
 
+int mu_imap_search (mu_imap_t imap, int uid, const char *expr,
+		    mu_msgset_t *msgset);
+  
 
 #define MU_IMAP_STAT_DEFINED_FLAGS   0x01
 #define MU_IMAP_STAT_PERMANENT_FLAGS 0x02
diff --git a/include/mailutils/mailbox.h b/include/mailutils/mailbox.h
index f2a6ecd..fa14e3e 100644
--- a/include/mailutils/mailbox.h
+++ b/include/mailutils/mailbox.h
@@ -20,7 +20,7 @@
 #define _MAILUTILS_MAILBOX_H
 
 #include <sys/types.h>
-
+#include <time.h>
 #include <mailutils/types.h>
 
 #ifdef __cplusplus
@@ -56,6 +56,7 @@ extern int  mu_mailbox_get_folder      (mu_mailbox_t, mu_folder_t *);
 extern int  mu_mailbox_set_folder      (mu_mailbox_t, mu_folder_t);
 extern int  mu_mailbox_uidvalidity     (mu_mailbox_t, unsigned long *);
 extern int  mu_mailbox_uidnext         (mu_mailbox_t, size_t *);
+extern int  mu_mailbox_access_time (mu_mailbox_t mbox, time_t *return_time);
 
 /* Messages.  */
 extern int  mu_mailbox_get_message     (mu_mailbox_t, size_t msgno,
diff --git a/include/mailutils/sys/imap.h b/include/mailutils/sys/imap.h
index 41f995b..28e5036 100644
--- a/include/mailutils/sys/imap.h
+++ b/include/mailutils/sys/imap.h
@@ -71,6 +71,7 @@ enum mu_imap_client_state
     MU_IMAP_CLIENT_UNSUBSCRIBE_RX,
     MU_IMAP_CLIENT_LSUB_RX,
     MU_IMAP_CLIENT_STARTTLS_RX,
+    MU_IMAP_CLIENT_SEARCH_RX,
     MU_IMAP_CLIENT_CLOSING
   };
 
diff --git a/include/mailutils/sys/mailbox.h b/include/mailutils/sys/mailbox.h
index f1b8813..71eb1ef 100644
--- a/include/mailutils/sys/mailbox.h
+++ b/include/mailutils/sys/mailbox.h
@@ -20,6 +20,7 @@
 # define _MAILUTILS_SYS_MAILBOX_H
 
 # include <sys/types.h>
+# include <time.h>
 # include <stdio.h>
 
 # include <mailutils/monitor.h>
@@ -76,6 +77,7 @@ struct _mu_mailbox
 
   int  (*_translate) (mu_mailbox_t, int cmd, size_t, size_t *);
   int  (*_copy) (mu_mailbox_t, mu_msgset_t, const char *, int);
+  int  (*_get_atime) (mu_mailbox_t, time_t *);
 };
 
 # ifdef __cplusplus
diff --git a/libmailutils/datetime/utcoff.c b/libmailutils/datetime/utcoff.c
index fbc55b7..d23fa71 100644
--- a/libmailutils/datetime/utcoff.c
+++ b/libmailutils/datetime/utcoff.c
@@ -20,13 +20,10 @@
 #endif
 #include <time.h>
 
-/* Convert time 0 at UTC to our localtime, that tells us the offset
-   of our current timezone from UTC. */
+/* Returns the offset of our timezone from UTC, in seconds. */
 int
 mu_utc_offset (void)
 {
-  time_t t = 0;
-  struct tm *tm = gmtime (&t);
-
-  return - mktime (tm);
+  tzset ();
+  return - timezone;
 }
diff --git a/libmailutils/mailbox/mailbox.c b/libmailutils/mailbox/mailbox.c
index db775b4..4b52e3c 100644
--- a/libmailutils/mailbox/mailbox.c
+++ b/libmailutils/mailbox/mailbox.c
@@ -918,3 +918,12 @@ mu_mailbox_translate (mu_mailbox_t mbox, int cmd, size_t from, size_t *to)
   return rc;
 }
 
+int
+mu_mailbox_access_time (mu_mailbox_t mbox, time_t *return_time)
+{
+  _MBOX_CHECK_Q (mbox, _get_atime);
+  if (!return_time)
+    return MU_ERR_OUT_PTR_NULL;
+  return mbox->_get_atime (mbox, return_time);
+}
+
diff --git a/libproto/imap/Makefile.am b/libproto/imap/Makefile.am
index 3af503b..a8c2e53 100644
--- a/libproto/imap/Makefile.am
+++ b/libproto/imap/Makefile.am
@@ -55,6 +55,7 @@ libmu_imap_la_SOURCES = \
  resplist.c\
  response.c\
  resproc.c\
+ search.c\
  select.c\
  state.c\
  status.c\
diff --git a/libproto/imap/fetch.c b/libproto/imap/fetch.c
index fbad10c..f1ec865 100644
--- a/libproto/imap/fetch.c
+++ b/libproto/imap/fetch.c
@@ -1004,7 +1004,7 @@ _fetch_fold (void *item, void *data)
 
 	if (!mt->name)
 	  {
-	    mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_TRACE9,
+	    mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE9,
 		      ("ignoring unknown FETCH item '%s'", kw));
 	    env->state = resp_skip;
 	    return 0;
@@ -1112,7 +1112,7 @@ _mu_imap_parse_fetch_response (mu_list_t input, mu_list_t *result_list)
   status = mu_list_create (&result);
   if (status)
     {
-      mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_ERROR,
+      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
 		("mu_list_create: %s", mu_strerror (status)));
       return 1;
     }
diff --git a/libproto/imap/mbox.c b/libproto/imap/mbox.c
index 538c04b..d181cbc 100644
--- a/libproto/imap/mbox.c
+++ b/libproto/imap/mbox.c
@@ -812,7 +812,7 @@ _imap_messages_count (mu_mailbox_t mbox, size_t *pcount)
     return MU_ERR_INFO_UNAVAILABLE;
   return 0;
 }
-  
+
 static int
 _imap_messages_recent (mu_mailbox_t mbox, size_t *pcount)
 {
@@ -820,7 +820,20 @@ _imap_messages_recent (mu_mailbox_t mbox, size_t *pcount)
   if (imbx->stats.flags & MU_IMAP_STAT_RECENT_COUNT)
     *pcount = imbx->stats.recent_count;
   else
-    return MU_ERR_INFO_UNAVAILABLE;
+    {
+      int rc;
+      mu_folder_t folder = mbox->folder;
+      mu_imap_t imap = folder->data;
+      mu_msgset_t msgset;
+  
+      rc = mu_imap_search (imap, 0, "RECENT", &msgset);
+      if (rc)
+	return rc;
+
+      rc = mu_msgset_count (msgset, pcount);
+      mu_msgset_free (msgset);
+      return rc;
+    }
   return 0;
 }
 
@@ -840,9 +853,36 @@ _imap_message_unseen (mu_mailbox_t mbox, size_t *pn)
 {
   struct _mu_imap_mailbox *imbx = mbox->data;
   if (imbx->stats.flags & MU_IMAP_STAT_FIRST_UNSEEN)
-    *pn = imbx->stats.uidnext;
+    *pn = imbx->stats.first_unseen;
   else
-    return MU_ERR_INFO_UNAVAILABLE;
+    {
+      int rc;
+      mu_folder_t folder = mbox->folder;
+      mu_imap_t imap = folder->data;
+      mu_msgset_t msgset;
+      mu_list_t list;
+  
+      rc = mu_imap_search (imap, 0, "UNSEEN", &msgset);
+      if (rc)
+	return rc;
+
+      if (mu_msgset_is_empty (msgset))
+	{
+	  mu_msgset_free (msgset);
+	  return MU_ERR_NOENT;
+	}
+
+      rc = mu_msgset_get_list (msgset, &list);
+      if (rc == 0)
+	{
+	  struct mu_msgrange r;
+	  rc = mu_list_head (list, (void **) &r);
+	  if (rc == 0)
+	    *pn = r.msg_beg;
+	}
+      mu_msgset_free (msgset);
+      return rc;
+    }
   return 0;
 }
 
diff --git a/libproto/imap/search.c b/libproto/imap/search.c
new file mode 100644
index 0000000..fa8cbe9
--- /dev/null
+++ b/libproto/imap/search.c
@@ -0,0 +1,134 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2011-2013 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/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <mailutils/errno.h>
+#include <mailutils/msgset.h>
+#include <mailutils/nls.h>
+#include <mailutils/imap.h>
+#include <mailutils/sys/imap.h>
+
+struct search_closure
+{
+  mu_msgset_t msgset;
+  int retcode;
+};
+
+static int
+add_msgno (void *item, void *data)
+{
+  int rc;
+  struct imap_list_element *elt = item;
+  struct search_closure *scp = data;
+  char *p;
+  unsigned long num;
+  
+  if (elt->type != imap_eltype_string)
+    {
+      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		(_("unexpected list element in untagged response from SEARCH")));
+      scp->retcode = MU_ERR_BADREPLY;
+      return 1;
+    }
+
+  if (!scp->msgset)
+    {
+      /* First element (SEARCH): create the message set and return */
+      rc = mu_msgset_create (&scp->msgset, NULL, MU_MSGSET_NUM);
+      if (rc)
+	{
+	  mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		    (_("cannot create msgset: %s"),
+		     mu_strerror (rc)));
+	  scp->retcode = rc;
+	  return rc;
+	}
+      return 0;
+    }
+  
+  num = strtoul (elt->v.string, &p, 10);
+  if (*p)
+    {
+      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		(_("not a number in untagged response from SEARCH: %s"),
+		 elt->v.string));
+      scp->retcode = MU_ERR_BADREPLY;
+      return 1;
+    }
+  
+  rc = mu_msgset_add_range (scp->msgset, num, num, MU_MSGSET_NUM);
+  if (rc)
+    {
+      mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+		("mu_msgset_add_range: %s", mu_strerror (rc)));
+      scp->retcode = rc;
+      return 1;
+    }
+  return 0;
+}
+
+static void
+search_handler (mu_imap_t imap, mu_list_t resp, void *data)
+{
+  mu_list_foreach (resp, add_msgno, data);
+}
+
+int
+mu_imap_search (mu_imap_t imap, int uid, const char *expr, mu_msgset_t *msgset)
+{
+  char const *argv[3];
+  int i, rc;
+  static struct imap_command com;
+  struct search_closure clos;
+
+  if (!expr)
+    return EINVAL;
+  if (!msgset)
+    return MU_ERR_OUT_PTR_NULL;
+  i = 0;
+  if (uid)
+    argv[i++] = "UID";
+  argv[i++] = "SEARCH";
+
+  clos.msgset = NULL;
+  clos.retcode = 0;
+  
+  com.session_state = MU_IMAP_SESSION_SELECTED;
+  com.capa = NULL;
+  com.rx_state = MU_IMAP_CLIENT_SEARCH_RX;
+  com.argc = i;
+  com.argv = argv;
+  com.extra = expr;
+  com.msgset = NULL;
+  com.tagged_handler = NULL;
+  com.untagged_handler = search_handler;
+  com.untagged_handler_data = &clos;
+  rc = mu_imap_gencom (imap, &com);
+  if (rc)
+      mu_msgset_free (clos.msgset);
+  else if (clos.retcode)
+    {
+      mu_msgset_free (clos.msgset);
+      rc = clos.retcode;
+    }
+  else
+    *msgset = clos.msgset;
+  return rc;
+}
diff --git a/libproto/imap/status.c b/libproto/imap/status.c
index 915225a..af92298 100644
--- a/libproto/imap/status.c
+++ b/libproto/imap/status.c
@@ -39,7 +39,7 @@ struct mu_kwd _mu_imap_status_name_table[] = {
   { "RECENT",      MU_IMAP_STAT_RECENT_COUNT  },
   { "UIDNEXT",     MU_IMAP_STAT_UIDNEXT       },
   { "UIDVALIDITY", MU_IMAP_STAT_UIDVALIDITY   },
-  { "UNSEEN",      MU_IMAP_STAT_FIRST_UNSEEN  },
+  /*  { "UNSEEN",      MU_IMAP_STAT_NUM_UNSEEN  }, */
   { NULL }
 };
 
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index 3ab0b95..bce7d14 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -1436,6 +1436,20 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
   return status;
 }
 
+static int
+mbox_get_atime (mu_mailbox_t mailbox, time_t *return_time)
+{
+  mbox_data_t mud = mailbox->data;
+  struct stat st;
+  
+  if (mud == NULL)
+    return EINVAL;
+  if (stat (mud->name, &st))
+    return errno;
+  *return_time = st.st_atime;
+  return 0;
+}
+
 
 /* Allocate the mbox_data_t struct(concrete mailbox), but don't do any
    parsing on the name or even test for existence.  However we do strip any
@@ -1498,6 +1512,8 @@ _mailbox_mbox_init (mu_mailbox_t mailbox)
 
   mailbox->_get_size = mbox_get_size;
 
+  mailbox->_get_atime = mbox_get_atime;
+  
   /* Set our properties.  */
   {
     mu_property_t property = NULL;
diff --git a/mh/msgchk.c b/mh/msgchk.c
index 36f40ea..d41259b 100644
--- a/mh/msgchk.c
+++ b/mh/msgchk.c
@@ -18,6 +18,7 @@
 #include "mailutils/kwd.h"
 #include "mailutils/folder.h"
 #include "mailutils/auth.h"
+#include "mailutils/datetime.h"
 #include <pwd.h>
 
 static char doc[] = N_("GNU MH msgchk")"\v"
@@ -295,11 +296,20 @@ checkmail (const char *username, int personal)
 	{
 	  mu_off_t mbsiz = 0;
 	  
-	  rc = mu_mailbox_messages_recent (mbox, &recent);
+	  rc = mu_mailbox_message_unseen (mbox, &recent);
 	  if (rc)
 	    {
-	      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_recent",
-			       mu_url_to_string (url), rc);
+	      if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE)
+		mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen",
+				 mu_url_to_string (url), rc);
+	      rc = mu_mailbox_messages_recent (mbox, &recent);
+	    }
+
+	  if (rc)
+	    {
+	      if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE)
+		mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_recent",
+				 mu_url_to_string (url), rc);
 
 	      mu_mailbox_get_size (mbox, &mbsiz);
 	      if (personal)
@@ -327,7 +337,14 @@ checkmail (const char *username, int personal)
 	    }
 
 	  if (date_option)
-	    /*FIXME*/;
+	    {
+	      time_t t;
+
+	      if (mu_mailbox_access_time (mbox, &t) == 0)
+		mu_c_streamftime (mu_strout,
+				  _("; last read on %a, %d %b %Y %H:%M:%S %z"),
+				  localtime (&t), NULL);
+	    }
 	      
 	  mu_printf ("\n");
 	}
diff --git a/mu/imap.c b/mu/imap.c
index 98890aa..bde1b5f 100644
--- a/mu/imap.c
+++ b/mu/imap.c
@@ -1122,6 +1122,35 @@ com_copy (int argc, char **argv)
 }
 
 static int
+com_search (int argc, char **argv)
+{
+  mu_msgset_t mset;
+  size_t count;
+  int rc;
+  
+  rc = mu_imap_search (imap, uid_mode, argv[1], &mset);
+  if (rc)
+    {
+      report_failure ("search", rc);
+      return 0;
+    }
+	
+  rc = mu_msgset_count (mset, &count);
+  if (rc == EINVAL || count == 0)
+    {
+      mu_printf (_("no matches"));
+      return 0;
+    }
+  mu_printf ("%lu matches:", (unsigned long) count);
+  mu_msgset_print (mu_strout, mset);
+  mu_printf ("\n");
+  mu_msgset_free (mset);
+  
+  return 0;
+}
+
+
+static int
 print_list_item (void *item, void *data)
 {
   struct mu_list_response *resp = item;
@@ -1293,6 +1322,10 @@ struct mutool_command imap_comtab[] = {
     com_uid,
     N_("[on|off]"),
     N_("control UID mode") },
+  { "search",       2, 2, CMD_COALESCE_EXTRA_ARGS,
+    com_search,
+    N_("args..."),
+    N_("search the mailbox") },
   { "quit",         1, 1, 0,
     com_logout,
     NULL,


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Sat Mar 30 11:39:09 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ULxs5-0002CS-3h
	for mharc-commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:39:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49349)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxrz-00024c-3R
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:39:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxrv-0002Cv-Ez
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:39:03 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:45758)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxrv-0002Cn-BU
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 11:38:59 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULxru-0001s9-2i
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 15:38:58 +0000
Date: Sat, 30 Mar 2013 15:38:58 +0000
Message-Id: <E1ULxru-0001s9-2i@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-645-g259e838
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 441dda65dd5aa0a97bc26ea7398d38de43dbee06
X-Git-Newrev: 259e83899823c5d665d91edcb27da76b00d5dcdf
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 30 Mar 2013 15:39:07 -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=259e83899823c5d665d91edcb27da76b00d5dcdf

The branch, master has been updated
       via  259e83899823c5d665d91edcb27da76b00d5dcdf (commit)
      from  441dda65dd5aa0a97bc26ea7398d38de43dbee06 (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 259e83899823c5d665d91edcb27da76b00d5dcdf
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 30 17:39:11 2013 +0200

    Minor fixes.
    
    * mh/msgchk.c (checkmail): take into account various
    possible return codes.

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

Summary of changes:
 mh/msgchk.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/mh/msgchk.c b/mh/msgchk.c
index d41259b..811693b 100644
--- a/mh/msgchk.c
+++ b/mh/msgchk.c
@@ -295,14 +295,26 @@ checkmail (const char *username, int personal)
       if (notify & NOTIFY_MAIL)
 	{
 	  mu_off_t mbsiz = 0;
+	  int newmail = 0;
 	  
 	  rc = mu_mailbox_message_unseen (mbox, &recent);
-	  if (rc)
+	  switch (rc)
 	    {
+	    case 0:
+	      newmail = 1;
+	      break;
+	      
+	    case MU_ERR_NOENT:
+	      newmail = 0;
+	      break;
+
+	    default:
 	      if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE)
 		mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen",
 				 mu_url_to_string (url), rc);
 	      rc = mu_mailbox_messages_recent (mbox, &recent);
+	      if (rc == 0)
+		newmail = recent > 0;
 	    }
 
 	  if (rc)
@@ -329,11 +341,11 @@ checkmail (const char *username, int personal)
 	  else
 	    {
 	      if (personal)
-		mu_printf (recent ? _("You have new mail waiting") :
-			            _("You have old mail waiting"));
+		mu_printf (newmail ? _("You have new mail waiting") :
+			             _("You have old mail waiting"));
 	      else
-		mu_printf (recent ? _("%s has new mail waiting") :
-			            _("%s has old mail waiting"), username);
+		mu_printf (newmail ? _("%s has new mail waiting") :
+			             _("%s has old mail waiting"), username);
 	    }
 
 	  if (date_option)


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Sat Mar 30 13:17:12 2013
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ULzOy-00030s-E9
	for mharc-commit-mailutils@gnu.org; Sat, 30 Mar 2013 13:17:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36406)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULzOq-00030l-Vz
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 13:17:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULzOl-0005bB-5Z
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 13:17:04 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:47093)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULzOl-0005b7-1x
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 13:16:59 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ULzOk-0007Yo-G6
	for commit-mailutils@gnu.org; Sat, 30 Mar 2013 17:16:58 +0000
Date: Sat, 30 Mar 2013 17:16:58 +0000
Message-Id: <E1ULzOk-0007Yo-G6@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-646-g9be3f81
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 259e83899823c5d665d91edcb27da76b00d5dcdf
X-Git-Newrev: 9be3f81ff2ada509eac8338db68a10a73cf19c51
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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, 30 Mar 2013 17:17:11 -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=9be3f81ff2ada509eac8338db68a10a73cf19c51

The branch, master has been updated
       via  9be3f81ff2ada509eac8338db68a10a73cf19c51 (commit)
      from  259e83899823c5d665d91edcb27da76b00d5dcdf (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 9be3f81ff2ada509eac8338db68a10a73cf19c51
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 30 19:17:40 2013 +0200

    msgchk: assume -date by default

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

Summary of changes:
 mh/msgchk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mh/msgchk.c b/mh/msgchk.c
index 811693b..0dd1e48 100644
--- a/mh/msgchk.c
+++ b/mh/msgchk.c
@@ -57,7 +57,7 @@ struct mh_option mh_option[] = {
   { NULL }
 };
 
-int date_option;
+int date_option = 1;
 int apop_option;
 char *remote_host;
 char *remote_user;


hooks/post-receive
-- 
GNU Mailutils


