Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2015 01:19:12 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r386495 - in head: chinese/mutt mail/mutt mail/mutt/files
Message-ID:  <201505160119.t4G1JCZC008984@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sat May 16 01:19:11 2015
New Revision: 386495
URL: https://svnweb.freebsd.org/changeset/ports/386495

Log:
  mail/mutt: update patches
  
  - Fix sidebar patch [1]. This version introduces a new config variable
    "sidebar_shortpath" which is set to yes by default to ensure
    backwards compatibility.
  
  - Fix an issue with recent gpg (and gpgme) versions (GnuPG version 2.1
    stops exporting the GPG_AGENT_INFO environment variable, so mutt can't
    check for the presence of that to ensure the agent is running).
  
  - Fix pgp key selection [2].
  
  - Bump port revision because of major change to sidebar patch and gpg
    handling.
  
  PR:		199727
  PR:		199115 [1]
  PR:		199341 [2]
  Submitted by:	Udo.Schweigert@siemens.com (maintainer)
  MFH:		2015Q2

Added:
  head/mail/mutt/files/patch-gpg_agent_info   (contents, props changed)
  head/mail/mutt/files/patch-pgpkey.c   (contents, props changed)
Modified:
  head/chinese/mutt/Makefile   (contents, props changed)
  head/mail/mutt/Makefile   (contents, props changed)
  head/mail/mutt/files/extra-patch-sidebar   (contents, props changed)
  head/mail/mutt/files/extra-patch-sidebar-nntp   (contents, props changed)
  head/mail/mutt/files/extra-patch-sidebar-refresh   (contents, props changed)

Modified: head/chinese/mutt/Makefile
==============================================================================
--- head/chinese/mutt/Makefile	Sat May 16 00:46:46 2015	(r386494)
+++ head/chinese/mutt/Makefile	Sat May 16 01:19:11 2015	(r386495)
@@ -1,7 +1,7 @@
 # Created by: David O'Brien (obrien@NUXI.com)
 # $FreeBSD$
 
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	chinese
 
 MASTERDIR=	${.CURDIR}/../../mail/mutt

Modified: head/mail/mutt/Makefile
==============================================================================
--- head/mail/mutt/Makefile	Sat May 16 00:46:46 2015	(r386494)
+++ head/mail/mutt/Makefile	Sat May 16 01:19:11 2015	(r386495)
@@ -3,7 +3,7 @@
 
 PORTNAME=	mutt
 PORTVERSION=	1.5.23
-PORTREVISION?=	8
+PORTREVISION?=	9
 CATEGORIES+=	mail ipv6
 MASTER_SITES=	ftp://ftp.mutt.org/mutt/ \
 		ftp://ftp.mutt.org/mutt/devel/ \

Modified: head/mail/mutt/files/extra-patch-sidebar
==============================================================================
--- head/mail/mutt/files/extra-patch-sidebar	Sat May 16 00:46:46 2015	(r386494)
+++ head/mail/mutt/files/extra-patch-sidebar	Sat May 16 01:19:11 2015	(r386495)
@@ -1,1416 +1,2314 @@
-Based on Gentoo's updated version of the Mutt Sidebar patch,
-rebased to apply to pristine Mutt sources.
+Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt
 
-http://prefix.gentooexperimental.org:8000/mutt-patches/file/8117acc3edc0/sidebar.patch
-
-diff -uNp -r mutt-1.5.22.orig/OPS mutt-1.5.22/OPS
---- mutt-1.5.22.orig/OPS	Tue Feb 23 06:57:28 2010
-+++ mutt-1.5.22/OPS	Fri Oct 18 10:18:45 2013
-@@ -179,3 +179,8 @@ OP_WHAT_KEY "display the keycode for a key press"
- OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
- OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
- OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
-+OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
-+OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
-+OP_SIDEBAR_NEXT "go down to next mailbox"
-+OP_SIDEBAR_PREV "go to previous mailbox"
-+OP_SIDEBAR_OPEN "open hilighted mailbox"
-diff -uNp -r mutt-1.5.22.orig/PATCHES mutt-1.5.22/PATCHES
---- mutt-1.5.22.orig/PATCHES	Sun Feb 21 05:51:26 2010
-+++ mutt-1.5.22/PATCHES	Fri Oct 18 10:19:14 2013
-@@ -0,0 +1 @@
-+patch-1.5.22.sidebar.gentoo-openbsd
 diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c
---- mutt-1.5.22.orig/buffy.c	Mon Apr 22 07:14:53 2013
-+++ mutt-1.5.22/buffy.c	Fri Oct 18 10:18:45 2013
-@@ -161,6 +161,49 @@ void mutt_buffy_cleanup (const char *buf, struct stat 
-   }
- }
- 
-+static int buffy_compare_name(const void *a, const void *b) {
-+  const BUFFY *b1 = * (BUFFY * const *) a;
-+  const BUFFY *b2 = * (BUFFY * const *) b;
-+
-+  return mutt_strcoll(b1->path, b2->path);
-+}
-+
-+static BUFFY *buffy_sort(BUFFY *b)
-+{
-+  BUFFY *tmp = b;
-+  int buffycount = 0;
-+  BUFFY **ary;
-+  int i;
-+
-+  if (!option(OPTSIDEBARSORT))
-+    return b;
-+
-+  for (; tmp != NULL; tmp = tmp->next)
-+    buffycount++;
-+
-+  ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
-+
-+  tmp = b;
-+  for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
-+    ary[i] = tmp;
-+  }
-+
-+  qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
-+
-+  for (i = 0; i < buffycount - 1; i++) {
-+    ary[i]->next = ary[i+1];
-+  }
-+  ary[buffycount - 1]->next = NULL;
-+  for (i = 1; i < buffycount; i++) {
-+    ary[i]->prev = ary[i-1];
-+  }
-+  ary[0]->prev = NULL;
-+
-+  tmp = ary[0];
-+  free(ary);
-+  return tmp;
-+}
-+
- BUFFY *mutt_find_mailbox (const char *path)
- {
-   BUFFY *tmp = NULL;
-@@ -282,6 +325,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, uns
-     else
-       (*tmp)->size = 0;
-   }
-+  Incoming = buffy_sort(Incoming);
-   return 0;
- }
- 
-@@ -340,6 +384,68 @@ static int buffy_maildir_hasnew (BUFFY* mailbox)
-   return rc;
- }
- 
-+/* update message counts for the sidebar */
-+void buffy_maildir_update (BUFFY* mailbox)
-+{
-+  char path[_POSIX_PATH_MAX];
-+  DIR *dirp;
-+  struct dirent *de;
-+  char *p;
-+
-+  mailbox->msgcount = 0;
-+  mailbox->msg_unread = 0;
-+  mailbox->msg_flagged = 0;
-+
-+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
-+        
-+  if ((dirp = opendir (path)) == NULL)
-+  {   
-+    mailbox->magic = 0;
-+    return;
-+  } 
-+      
-+  while ((de = readdir (dirp)) != NULL)
-+  {
-+    if (*de->d_name == '.')
-+      continue;
-+
-+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
-+      mailbox->new = 1;
-+      mailbox->msgcount++;
-+      mailbox->msg_unread++;
-+    }
-+  }
-+
-+  closedir (dirp);
-+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
-+        
-+  if ((dirp = opendir (path)) == NULL)
-+  {   
-+    mailbox->magic = 0;
-+    return;
-+  } 
-+      
-+  while ((de = readdir (dirp)) != NULL)
-+  {
-+    if (*de->d_name == '.')
-+      continue;
-+
-+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
-+      mailbox->msgcount++;
-+      if ((p = strstr (de->d_name, ":2,"))) {
-+        if (!strchr (p + 3, 'T')) {
-+          if (!strchr (p + 3, 'S'))
-+            mailbox->msg_unread++;
-+          if (strchr(p + 3, 'F'))
-+            mailbox->msg_flagged++;
-+        }
-+      }
-+    }
-+  }
-+
-+  closedir (dirp);
-+}
-+
- /* returns 1 if mailbox has new mail */ 
- static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
- {
-@@ -371,6 +477,20 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct s
-   return rc;
- }
- 
-+/* update message counts for the sidebar */
-+void buffy_mbox_update (BUFFY* mailbox)
-+{
-+  CONTEXT *ctx = NULL;
-+
-+  ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
-+  if(ctx)
-+  {
-+    mailbox->msgcount = ctx->msgcount;
-+    mailbox->msg_unread = ctx->unread;
-+    mx_close_mailbox(ctx, 0);
-+  }
-+}
-+
- int mutt_buffy_check (int force)
- {
-   BUFFY *tmp;
-@@ -444,16 +564,19 @@ int mutt_buffy_check (int force)
-       {
-       case M_MBOX:
-       case M_MMDF:
-+	buffy_mbox_update (tmp);
- 	if (buffy_mbox_hasnew (tmp, &sb) > 0)
- 	  BuffyCount++;
- 	break;
- 
-       case M_MAILDIR:
-+	buffy_maildir_update (tmp);
- 	if (buffy_maildir_hasnew (tmp) > 0)
- 	  BuffyCount++;
- 	break;
- 
-       case M_MH:
-+	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged);
- 	mh_buffy(tmp);
- 	if (tmp->new)
- 	  BuffyCount++;
-diff -uNp -r mutt-1.5.22.orig/buffy.h mutt-1.5.22/buffy.h
---- mutt-1.5.22.orig/buffy.h	Mon Apr 22 07:14:53 2013
-+++ mutt-1.5.22/buffy.h	Fri Oct 18 10:18:45 2013
-@@ -25,7 +25,11 @@ typedef struct buffy_t
-   char path[_POSIX_PATH_MAX];
-   off_t size;
-   struct buffy_t *next;
-+  struct buffy_t *prev;
-   short new;			/* mailbox has new mail */
-+  int msgcount;			/* total number of messages */
-+  int msg_unread;		/* number of unread messages */
-+  int msg_flagged;		/* number of flagged messages */
-   short notified;		/* user has been notified */
-   short magic;			/* mailbox type */
-   short newly_created;		/* mbox or mmdf just popped into existence */
-diff -uNp -r mutt-1.5.22.orig/color.c mutt-1.5.22/color.c
---- mutt-1.5.22.orig/color.c	Tue Jan 15 07:37:15 2013
-+++ mutt-1.5.22/color.c	Fri Oct 18 10:19:53 2013
-@@ -93,6 +93,8 @@ static const struct mapping_t Fields[] =
-   { "bold",		MT_COLOR_BOLD },
-   { "underline",	MT_COLOR_UNDERLINE },
-   { "index",		MT_COLOR_INDEX },
-+  { "sidebar_new",	MT_COLOR_NEW },
-+  { "sidebar_flagged",	MT_COLOR_FLAGGED },
-   { NULL,		0 }
- };
- 
-diff -uNp -r mutt-1.5.22.orig/compose.c mutt-1.5.22/compose.c
---- mutt-1.5.22.orig/compose.c	Fri Oct 18 05:48:24 2013
-+++ mutt-1.5.22/compose.c	Fri Oct 18 10:22:12 2013
-@@ -72,7 +72,7 @@ enum
- 
- #define HDR_XOFFSET 10
- #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
--#define W (COLS - HDR_XOFFSET)
-+#define W (COLS - HDR_XOFFSET - SidebarWidth)
- 
- static const char * const Prompts[] =
- {
-@@ -110,7 +110,7 @@ static void snd_entry (char *b, size_t blen, MUTTMENU 
- 
- static void redraw_crypt_lines (HEADER *msg)
- {
--  mvaddstr (HDR_CRYPT, 0, "Security: ");
-+  mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
- 
-   if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
-   {
-@@ -142,7 +142,7 @@ static void redraw_crypt_lines (HEADER *msg)
-   }
- 
-   clrtoeol ();
--  move (HDR_CRYPTINFO, 0);
-+  move (HDR_CRYPTINFO, SidebarWidth);
-   clrtoeol ();
- 
-   if ((WithCrypto & APPLICATION_PGP)
-@@ -159,7 +159,7 @@ static void redraw_crypt_lines (HEADER *msg)
-       && (msg->security & ENCRYPT)
-       && SmimeCryptAlg
-       && *SmimeCryptAlg) {
--      mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
-+      mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
- 		NONULL(SmimeCryptAlg));
-   }
- }
-@@ -172,7 +172,7 @@ static void redraw_mix_line (LIST *chain)
-   int c;
-   char *t;
- 
--  mvaddstr (HDR_MIX, 0,     "     Mix: ");
-+  mvaddstr (HDR_MIX, SidebarWidth,     "     Mix: ");
- 
-   if (!chain)
-   {
-@@ -187,7 +187,7 @@ static void redraw_mix_line (LIST *chain)
-     if (t && t[0] == '0' && t[1] == '\0')
-       t = "<random>";
-     
--    if (c + mutt_strlen (t) + 2 >= COLS)
-+    if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
-       break;
- 
-     addstr (NONULL(t));
-@@ -239,7 +239,7 @@ static void draw_envelope_addr (int line, ADDRESS *add
- 
-   buf[0] = 0;
-   rfc822_write_address (buf, sizeof (buf), addr, 1);
--  mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
-+  mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
-   mutt_paddstr (W, buf);
- }
- 
-@@ -249,10 +249,10 @@ static void draw_envelope (HEADER *msg, char *fcc)
-   draw_envelope_addr (HDR_TO, msg->env->to);
-   draw_envelope_addr (HDR_CC, msg->env->cc);
-   draw_envelope_addr (HDR_BCC, msg->env->bcc);
--  mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
-+  mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
-   mutt_paddstr (W, NONULL (msg->env->subject));
-   draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
--  mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
-+  mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
-   mutt_paddstr (W, fcc);
- 
-   if (WithCrypto)
-@@ -263,7 +263,7 @@ static void draw_envelope (HEADER *msg, char *fcc)
- #endif
- 
-   SETCOLOR (MT_COLOR_STATUS);
--  mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
-+  mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
-   clrtoeol ();
- 
-   NORMAL_COLOR;
-@@ -299,7 +299,7 @@ static int edit_address_list (int line, ADDRESS **addr
-   /* redraw the expanded list so the user can see the result */
-   buf[0] = 0;
-   rfc822_write_address (buf, sizeof (buf), *addr, 1);
--  move (line, HDR_XOFFSET);
-+  move (line, HDR_XOFFSET+SidebarWidth);
-   mutt_paddstr (W, buf);
-   
-   return 0;
-@@ -544,7 +544,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for
- 	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
- 	{
- 	  mutt_str_replace (&msg->env->subject, buf);
--	  move (HDR_SUBJECT, HDR_XOFFSET);
-+	  move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
- 	  if (msg->env->subject)
- 	    mutt_paddstr (W, msg->env->subject);
- 	  else
-@@ -562,7 +562,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for
- 	{
- 	  strfcpy (fcc, buf, fcclen);
- 	  mutt_pretty_mailbox (fcc, fcclen);
--	  move (HDR_FCC, HDR_XOFFSET);
-+	  move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
- 	  mutt_paddstr (W, fcc);
- 	  fccSet = 1;
- 	}
-diff -uNp -r mutt-1.5.22.orig/curs_main.c mutt-1.5.22/curs_main.c
---- mutt-1.5.22.orig/curs_main.c	Tue Jan 15 07:37:15 2013
-+++ mutt-1.5.22/curs_main.c	Fri Oct 18 10:18:45 2013
-@@ -26,7 +26,9 @@
- #include "mailbox.h"
- #include "mapping.h"
- #include "sort.h"
-+#include "buffy.h"
- #include "mx.h"
-+#include "sidebar.h"
- 
- #ifdef USE_POP
- #include "pop.h"
-@@ -519,8 +521,12 @@ int mutt_index_menu (void)
-        menu->redraw |= REDRAW_STATUS;
-      if (do_buffy_notify)
+*** mutt-1.5.23-orig/buffy.c	2014-03-12 11:03:44.000000000 -0500
+--- mutt-1.5.23/buffy.c	2014-04-12 15:33:54.000000000 -0500
+***************
+*** 161,166 ****
+--- 161,209 ----
+    }
+  }
+  
++ static int buffy_compare_name(const void *a, const void *b) {
++   const BUFFY *b1 = * (BUFFY * const *) a;
++   const BUFFY *b2 = * (BUFFY * const *) b;
++ 
++   return mutt_strcoll(b1->path, b2->path);
++ }
++ 
++ static BUFFY *buffy_sort(BUFFY *b)
++ {
++   BUFFY *tmp = b;
++   int buffycount = 0;
++   BUFFY **ary;
++   int i;
++ 
++   if (!option(OPTSIDEBARSORT))
++     return b;
++ 
++   for (; tmp != NULL; tmp = tmp->next)
++     buffycount++;
++ 
++   ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
++ 
++   tmp = b;
++   for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
++     ary[i] = tmp;
++   }
++ 
++   qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
++ 
++   for (i = 0; i < buffycount - 1; i++) {
++     ary[i]->next = ary[i+1];
++   }
++   ary[buffycount - 1]->next = NULL;
++   for (i = 1; i < buffycount; i++) {
++     ary[i]->prev = ary[i-1];
++   }
++   ary[0]->prev = NULL;
++ 
++   tmp = ary[0];
++   free(ary);
++   return tmp;
++ }
++ 
+  BUFFY *mutt_find_mailbox (const char *path)
+  {
+    BUFFY *tmp = NULL;
+***************
+*** 196,204 ****
+--- 239,251 ----
+  static BUFFY *buffy_new (const char *path)
+  {
+    BUFFY* buffy;
++   char rp[PATH_MAX];
++   char *r;
+  
+    buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
+    strfcpy (buffy->path, path, sizeof (buffy->path));
++   r = realpath(path, rp);
++   strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
+    buffy->next = NULL;
+    buffy->magic = 0;
+  
+***************
+*** 243,250 ****
+      p = realpath (buf, f1);
+      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
       {
--       if (mutt_buffy_notify () && option (OPTBEEPNEW))
-- 	beep ();
-+       if (mutt_buffy_notify ())
-+       {
-+         menu->redraw |= REDRAW_FULL;
-+         if (option (OPTBEEPNEW))
-+           beep ();
+!       q = realpath ((*tmp)->path, f2);
+!       if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
+        {
+  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
+  	break;
+--- 290,297 ----
+      p = realpath (buf, f1);
+      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
+      {
+!       q = (*tmp)->realpath;
+!       if (mutt_strcmp (p ? p : buf, q) == 0)
+        {
+  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
+  	break;
+***************
+*** 282,287 ****
+--- 329,335 ----
+      else
+        (*tmp)->size = 0;
+    }
++   Incoming = buffy_sort(Incoming);
+    return 0;
+  }
+  
+***************
+*** 306,311 ****
+--- 354,364 ----
+        return 0;
+    }
+  
++   if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
++       mailbox->new = 1;
++       return 1;
++   }
++ 
+    if ((dirp = opendir (path)) == NULL)
+    {
+      mailbox->magic = 0;
+***************
+*** 340,345 ****
+--- 393,464 ----
+    return rc;
+  }
+  
++ /* update message counts for the sidebar */
++ void buffy_maildir_update (BUFFY* mailbox)
++ {
++   char path[_POSIX_PATH_MAX];
++   DIR *dirp;
++   struct dirent *de;
++   char *p;
++ 
++   if(!option(OPTSIDEBAR))
++       return;
++ 
++   mailbox->msgcount = 0;
++   mailbox->msg_unread = 0;
++   mailbox->msg_flagged = 0;
++ 
++   snprintf (path, sizeof (path), "%s/new", mailbox->path);
++         
++   if ((dirp = opendir (path)) == NULL)
++   {   
++     mailbox->magic = 0;
++     return;
++   } 
++       
++   while ((de = readdir (dirp)) != NULL)
++   {
++     if (*de->d_name == '.')
++       continue;
++ 
++     if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
++       mailbox->new = 1;
++       mailbox->msgcount++;
++       mailbox->msg_unread++;
++     }
++   }
++ 
++   closedir (dirp);
++   snprintf (path, sizeof (path), "%s/cur", mailbox->path);
++         
++   if ((dirp = opendir (path)) == NULL)
++   {   
++     mailbox->magic = 0;
++     return;
++   } 
++       
++   while ((de = readdir (dirp)) != NULL)
++   {
++     if (*de->d_name == '.')
++       continue;
++ 
++     if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
++       mailbox->msgcount++;
++       if ((p = strstr (de->d_name, ":2,"))) {
++         if (!strchr (p + 3, 'T')) {
++           if (!strchr (p + 3, 'S'))
++             mailbox->msg_unread++;
++           if (strchr(p + 3, 'F'))
++             mailbox->msg_flagged++;
++         }
 +       }
++     }
++   }
++ 
++   mailbox->sb_last_checked = time(NULL);
++   closedir (dirp);
++ }
++ 
+  /* returns 1 if mailbox has new mail */ 
+  static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
+  {
+***************
+*** 351,357 ****
+    else
+      statcheck = sb->st_mtime > sb->st_atime
+        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
+!   if (statcheck)
+    {
+      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
+      {
+--- 470,476 ----
+    else
+      statcheck = sb->st_mtime > sb->st_atime
+        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
+!   if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
+    {
+      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
+      {
+***************
+*** 371,376 ****
+--- 490,516 ----
+    return rc;
+  }
+  
++ /* update message counts for the sidebar */
++ void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
++ {
++   CONTEXT *ctx = NULL;
++ 
++   if(!option(OPTSIDEBAR))
++       return;
++   if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
++       return; /* no check necessary */
++ 
++   ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
++   if(ctx)
++   {
++     mailbox->msgcount = ctx->msgcount;
++     mailbox->msg_unread = ctx->unread;
++     mailbox->msg_flagged = ctx->flagged;
++     mailbox->sb_last_checked = time(NULL);
++     mx_close_mailbox(ctx, 0);
++   }
++ }
++ 
+  int mutt_buffy_check (int force)
+  {
+    BUFFY *tmp;
+***************
+*** 444,460 ****
+        {
+        case M_MBOX:
+        case M_MMDF:
+  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
+  	  BuffyCount++;
+  	break;
+  
+        case M_MAILDIR:
+  	if (buffy_maildir_hasnew (tmp) > 0)
+  	  BuffyCount++;
+  	break;
+  
+        case M_MH:
+! 	mh_buffy(tmp);
+  	if (tmp->new)
+  	  BuffyCount++;
+  	break;
+--- 584,603 ----
+        {
+        case M_MBOX:
+        case M_MMDF:
++ 	buffy_mbox_update (tmp, &sb);
+  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
+  	  BuffyCount++;
+  	break;
+  
+        case M_MAILDIR:
++ 	buffy_maildir_update (tmp);
+  	if (buffy_maildir_hasnew (tmp) > 0)
+  	  BuffyCount++;
+  	break;
+  
+        case M_MH:
+! 	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
+!         mh_buffy(tmp);
+  	if (tmp->new)
+  	  BuffyCount++;
+  	break;
+*** mutt-1.5.23-orig/buffy.h	2014-03-12 11:03:44.000000000 -0500
+--- mutt-1.5.23/buffy.h	2014-04-11 10:14:01.000000000 -0500
+***************
+*** 23,35 ****
+--- 23,41 ----
+  typedef struct buffy_t
+  {
+    char path[_POSIX_PATH_MAX];
++   char realpath[_POSIX_PATH_MAX];
+    off_t size;
+    struct buffy_t *next;
++   struct buffy_t *prev;
+    short new;			/* mailbox has new mail */
++   int msgcount;			/* total number of messages */
++   int msg_unread;		/* number of unread messages */
++   int msg_flagged;		/* number of flagged messages */
+    short notified;		/* user has been notified */
+    short magic;			/* mailbox type */
+    short newly_created;		/* mbox or mmdf just popped into existence */
+    time_t last_visited;		/* time of last exit from this mailbox */
++   time_t sb_last_checked;      /* time of last buffy check from sidebar */
+  }
+  BUFFY;
+  
+*** mutt-1.5.23-orig/color.c	2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/color.c	2014-04-11 10:14:01.000000000 -0500
+***************
+*** 93,98 ****
+--- 93,100 ----
+    { "bold",		MT_COLOR_BOLD },
+    { "underline",	MT_COLOR_UNDERLINE },
+    { "index",		MT_COLOR_INDEX },
++   { "sidebar_new",	MT_COLOR_NEW },
++   { "sidebar_flagged",	MT_COLOR_FLAGGED },
+    { NULL,		0 }
+  };
+  
+*** mutt-1.5.23-orig/compose.c	2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/compose.c	2014-04-12 12:15:56.000000000 -0500
+***************
+*** 72,78 ****
+  
+  #define HDR_XOFFSET 10
+  #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
+! #define W (COLS - HDR_XOFFSET)
+  
+  static const char * const Prompts[] =
+  {
+--- 72,78 ----
+  
+  #define HDR_XOFFSET 10
+  #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
+! #define W (COLS - HDR_XOFFSET - SidebarWidth)
+  
+  static const char * const Prompts[] =
+  {
+***************
+*** 110,116 ****
+  
+  static void redraw_crypt_lines (HEADER *msg)
+  {
+!   mvaddstr (HDR_CRYPT, 0, "Security: ");
+  
+    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
+    {
+--- 110,116 ----
+  
+  static void redraw_crypt_lines (HEADER *msg)
+  {
+!   mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
+  
+    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
+    {
+***************
+*** 142,148 ****
+    }
+  
+    clrtoeol ();
+!   move (HDR_CRYPTINFO, 0);
+    clrtoeol ();
+  
+    if ((WithCrypto & APPLICATION_PGP)
+--- 142,148 ----
+    }
+  
+    clrtoeol ();
+!   move (HDR_CRYPTINFO, SidebarWidth);
+    clrtoeol ();
+  
+    if ((WithCrypto & APPLICATION_PGP)
+***************
+*** 159,165 ****
+        && (msg->security & ENCRYPT)
+        && SmimeCryptAlg
+        && *SmimeCryptAlg) {
+!       mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
+  		NONULL(SmimeCryptAlg));
+    }
+  }
+--- 159,165 ----
+        && (msg->security & ENCRYPT)
+        && SmimeCryptAlg
+        && *SmimeCryptAlg) {
+!       mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
+  		NONULL(SmimeCryptAlg));
+    }
+  }
+***************
+*** 172,178 ****
+    int c;
+    char *t;
+  
+!   mvaddstr (HDR_MIX, 0,     "     Mix: ");
+  
+    if (!chain)
+    {
+--- 172,178 ----
+    int c;
+    char *t;
+  
+!   mvaddstr (HDR_MIX, SidebarWidth,     "     Mix: ");
+  
+    if (!chain)
+    {
+***************
+*** 187,193 ****
+      if (t && t[0] == '0' && t[1] == '\0')
+        t = "<random>";
+      
+!     if (c + mutt_strlen (t) + 2 >= COLS)
+        break;
+  
+      addstr (NONULL(t));
+--- 187,193 ----
+      if (t && t[0] == '0' && t[1] == '\0')
+        t = "<random>";
+      
+!     if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
+        break;
+  
+      addstr (NONULL(t));
+***************
+*** 239,245 ****
+  
+    buf[0] = 0;
+    rfc822_write_address (buf, sizeof (buf), addr, 1);
+!   mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
+    mutt_paddstr (W, buf);
+  }
+  
+--- 239,245 ----
+  
+    buf[0] = 0;
+    rfc822_write_address (buf, sizeof (buf), addr, 1);
+!   mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
+    mutt_paddstr (W, buf);
+  }
+  
+***************
+*** 249,258 ****
+    draw_envelope_addr (HDR_TO, msg->env->to);
+    draw_envelope_addr (HDR_CC, msg->env->cc);
+    draw_envelope_addr (HDR_BCC, msg->env->bcc);
+!   mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+    mutt_paddstr (W, NONULL (msg->env->subject));
+    draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
+!   mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
+    mutt_paddstr (W, fcc);
+  
+    if (WithCrypto)
+--- 249,258 ----
+    draw_envelope_addr (HDR_TO, msg->env->to);
+    draw_envelope_addr (HDR_CC, msg->env->cc);
+    draw_envelope_addr (HDR_BCC, msg->env->bcc);
+!   mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+    mutt_paddstr (W, NONULL (msg->env->subject));
+    draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
+!   mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
+    mutt_paddstr (W, fcc);
+  
+    if (WithCrypto)
+***************
+*** 263,269 ****
+  #endif
+  
+    SETCOLOR (MT_COLOR_STATUS);
+!   mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
+    clrtoeol ();
+  
+    NORMAL_COLOR;
+--- 263,269 ----
+  #endif
+  
+    SETCOLOR (MT_COLOR_STATUS);
+!   mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
+    clrtoeol ();
+  
+    NORMAL_COLOR;
+***************
+*** 299,305 ****
+    /* redraw the expanded list so the user can see the result */
+    buf[0] = 0;
+    rfc822_write_address (buf, sizeof (buf), *addr, 1);
+!   move (line, HDR_XOFFSET);
+    mutt_paddstr (W, buf);
+    
+    return 0;
+--- 299,305 ----
+    /* redraw the expanded list so the user can see the result */
+    buf[0] = 0;
+    rfc822_write_address (buf, sizeof (buf), *addr, 1);
+!   move (line, HDR_XOFFSET+SidebarWidth);
+    mutt_paddstr (W, buf);
+    
+    return 0;
+***************
+*** 544,550 ****
+  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
+  	{
+  	  mutt_str_replace (&msg->env->subject, buf);
+! 	  move (HDR_SUBJECT, HDR_XOFFSET);
+  	  if (msg->env->subject)
+  	    mutt_paddstr (W, msg->env->subject);
+  	  else
+--- 544,550 ----
+  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
+  	{
+  	  mutt_str_replace (&msg->env->subject, buf);
+! 	  move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
+  	  if (msg->env->subject)
+  	    mutt_paddstr (W, msg->env->subject);
+  	  else
+***************
+*** 562,568 ****
+  	{
+  	  strfcpy (fcc, buf, fcclen);
+  	  mutt_pretty_mailbox (fcc, fcclen);
+! 	  move (HDR_FCC, HDR_XOFFSET);
+  	  mutt_paddstr (W, fcc);
+  	  fccSet = 1;
+  	}
+--- 562,568 ----
+  	{
+  	  strfcpy (fcc, buf, fcclen);
+  	  mutt_pretty_mailbox (fcc, fcclen);
+! 	  move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
+  	  mutt_paddstr (W, fcc);
+  	  fccSet = 1;
+  	}
+*** mutt-1.5.23-orig/configure.ac	2014-03-12 11:26:40.000000000 -0500
+--- mutt-1.5.23/configure.ac	2014-04-11 10:14:01.000000000 -0500
+***************
+*** 1276,1281 ****
+--- 1276,1283 ----
+    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
+  fi
+  
++ AC_CHECK_FUNCS(fmemopen open_memstream)
++ 
+  dnl Documentation tools
+  have_openjade="no"
+  AC_PATH_PROG([OSPCAT], [ospcat], [none])
+*** mutt-1.5.23-orig/curs_main.c	2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/curs_main.c	2014-04-12 21:45:21.000000000 -0500
+***************
+*** 26,32 ****
+--- 26,34 ----
+  #include "mailbox.h"
+  #include "mapping.h"
+  #include "sort.h"
++ #include "buffy.h"
+  #include "mx.h"
++ #include "sidebar.h"
+  
+  #ifdef USE_POP
+  #include "pop.h"
+***************
+*** 519,538 ****
+         menu->redraw |= REDRAW_STATUS;
+       if (do_buffy_notify)
+       {
+!        if (mutt_buffy_notify () && option (OPTBEEPNEW))
+!  	beep ();
+       }
+       else
+         do_buffy_notify = 1;
       }
-      else
-        do_buffy_notify = 1;
-@@ -532,6 +538,7 @@ int mutt_index_menu (void)
-     if (menu->redraw & REDRAW_FULL)
-     {
-       menu_redraw_full (menu);
-+      draw_sidebar(menu->menu);
-       mutt_show_error ();
-     }
- 
-@@ -554,9 +561,12 @@ int mutt_index_menu (void)
- 
-       if (menu->redraw & REDRAW_STATUS)
+  
+      if (op != -1)
+        mutt_curs_set (0);
+  
+      if (menu->redraw & REDRAW_FULL)
+      {
+        menu_redraw_full (menu);
+        mutt_show_error ();
+      }
+  
+      if (menu->menu == MENU_MAIN)
+--- 521,551 ----
+         menu->redraw |= REDRAW_STATUS;
+       if (do_buffy_notify)
        {
-+	DrawFullLine = 1;
- 	menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
-+	DrawFullLine = 0;
- 	move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
- 	SETCOLOR (MT_COLOR_STATUS);
-+	set_buffystats(Context);
- 	mutt_paddstr (COLS, buf);
- 	NORMAL_COLOR;
- 	menu->redraw &= ~REDRAW_STATUS;
-@@ -569,7 +579,7 @@ int mutt_index_menu (void)
- 	menu->oldcurrent = -1;
- 
-       if (option (OPTARROWCURSOR))
--	move (menu->current - menu->top + menu->offset, 2);
-+	move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
-       else if (option (OPTBRAILLEFRIENDLY))
- 	move (menu->current - menu->top + menu->offset, 0);
+!        if (mutt_buffy_notify ())
+!        {
+!          menu->redraw |= REDRAW_STATUS;
+!          if (option (OPTBEEPNEW))
+!            beep ();
+!        }
+       }
        else
-@@ -1070,6 +1080,7 @@ int mutt_index_menu (void)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505160119.t4G1JCZC008984>