Andreas Krennmair:
authorak1 <ak1@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 16 Mar 2005 12:25:56 +0000 (12:25 +0000)
committerak1 <ak1@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 16 Mar 2005 12:25:56 +0000 (12:25 +0000)
added new muttng spec file for Fedora Core.
added new variable $sidebar_newmail_only to only show mailboxes with new mail in them

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@183 e385b8ad-14ed-0310-8656-cc95a2468c6d

UPGRADING
contrib/muttng-rpmbuild.sh [new file with mode: 0644]
contrib/muttng.spec
init.h
mutt.h
sidebar.c

index fcf7009..6dbfbfe 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -14,6 +14,10 @@ Note: as development goes fast and as documentation is way behind it,
 this still likely is incomplete. Please report missing items to
 <mutt-ng-devel@lists.berlios.de>
 
+2005-03-16:
+  New Configuration Variables:
+    - $sidebar_newmail_only - if set, only mailboxes with new mail will be shown in the sidebar
+
 2005-03-14
 
   New Configuration Variables:
diff --git a/contrib/muttng-rpmbuild.sh b/contrib/muttng-rpmbuild.sh
new file mode 100644 (file)
index 0000000..bf745a9
--- /dev/null
@@ -0,0 +1,155 @@
+#!/bin/sh
+#
+# ABSOLUTELY NO WARRANTY WITH THIS PACKAGE. USE IT AT YOUR OWN RISK.
+#
+# Download, re-config & build latest mutt-ng tarball as RPM & SRPM files
+#
+# Usage: muttng-rpmbuild.sh
+#
+# Copyright (C) 2005  muttng-rpmbuild.sh 1.10  Iain Lea  iain@bricbrac.de
+#
+#   This program 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 2 of
+#   the License, or (at your option) any later version.
+# 
+#   This program is distributed in the hope that it will be useful, 
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+#   See the GNU General Public License for more details.
+# 
+#   You should have received a copy of the GNU GPL along with this
+#   program; if not, write to the Free Software Foundation, Inc.,
+#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# Requirements:
+#   ...
+#
+# Contributors:
+#   ...
+#
+# Changelog:
+#   1.10
+#   - added cosmetic changes concerning sent mail
+#   - added rm -rf $SRCDIR/muttng-*  and more cleanup on exit
+#   1.00
+#   - initial release
+#
+# Todo:
+#   - add section of Changelog/SVN to sent mail if successful
+
+# Local site specific variables. Change to suit your site!
+ADDR=root
+MAIL=mutt
+ARCH=i386
+TMPDIR=/tmp
+DSTDIR=/var/www/iainlea.dyndns.org/software/muttng
+BLDDIR=/usr/src/redhat
+#
+# Remote site specific variables. Should not need changing!
+SITE=http://mutt-ng.berlios.de/snapshots
+FILE=muttng-latest.tar.gz
+#
+# You should not need to change anything below this line!
+SRCDIR=$BLDDIR/SOURCES
+RPMSDIR=$BLDDIR/RPMS/$ARCH
+SRPMDIR=$BLDDIR/SRPMS
+SPEC=muttng.spec
+
+# Sanity checks
+if [ ! -d $TMPDIR ]; then
+       echo "Error: \$TMPDIR $TMPDIR - does not exist. Edit to match your site!"
+       exit 0
+fi
+if [ ! -d $DSTDIR ]; then
+       echo "Error: \$DSTDIR $DSTDIR - does not exist. Edit to match your site!"
+       exit 0
+fi
+if [ ! -d $SRCDIR ]; then
+       echo "Error: \$SRCDIR $SRCDIR - does not exist. Edit to match your site!"
+       exit 0
+fi
+if [ ! -d $RPMSDIR ]; then
+       echo "Error: \$RPMSDIR $RPMSDIR - does not exist. Edit to match your site!"
+       exit 0
+fi
+if [ ! -d $SRPMDIR ]; then
+       echo "Error: \$SRPMDIR $SRPMDIR - does not exist. Edit to match your site!"
+       exit 0
+fi
+
+cd $TMPDIR
+
+echo "Backup:  $TMPDIR/$SPEC"
+/bin/mv -f $TMPDIR/$SPEC $TMPDIR/$SPEC.bak >/dev/null 2>&1
+/bin/rm -f $TMPDIR/$SPEC.in >/dev/null 2>&1
+
+echo "Delete:  $TMPDIR/$FILE"
+/bin/rm -f $TMPDIR/$FILE >/dev/null 2>&1
+
+echo "Delete:  $TMPDIR/muttng-*/"
+(find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
+
+echo "Delete:  $SRCDIR/muttng-*.tar.gz"
+(find $SRCDIR/muttng-*tar.gz -print | sort -r | xargs /bin/rm -f) >/dev/null 2>&1
+
+echo "Delete:  $SRCDIR/muttng-*/"
+# find $SRCDIR/muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf >/dev/null 2>&1
+(cd $SRCDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
+
+echo "FetchIt  $SITE/$FILE"
+wget -O $FILE $SITE/$FILE >/dev/null 2>&1
+
+echo "Extract  $FILE"
+tar xzf $FILE
+
+NAME=`find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | head -1`
+echo "TarBall  $NAME"
+
+VER=`echo $NAME | cut -d '-' -f2`
+# echo "Version  $VER"
+
+echo "Parsing  $NAME/contrib/$SPEC"
+cp $NAME/contrib/$SPEC $SPEC.in
+sed -e "s/^Version:.*$/Version: $VER/" < $SPEC.in > $SPEC
+REL=`egrep "Release: " $SPEC | cut -d ' ' -f2`
+egrep "Version: " $SPEC
+egrep "Release: " $SPEC
+
+echo "BuildIt  $SRCDIR/$NAME.tar.gz"
+mv $FILE $SRCDIR/$NAME.tar.gz
+# sleep 3
+rpmbuild -ba $SPEC >$TMPDIR/$NAME.rpmbuild 2>&1
+
+# echo "CheckIt  $RPMSDIR/muttng-$VER-$REL.i386.rpm"
+if [ -e $RPMSDIR/muttng-$VER-$REL.i386.rpm ]
+then
+       echo "BuiltOK  $RPMSDIR/muttng-$VER-$REL.i386.rpm"
+       cp $RPMSDIR/muttng-$VER-$REL.i386.rpm $DSTDIR
+       echo "$DSTDIR/muttng-$VER-$REL.i386.rpm" > $TMPDIR/$NAME.rpmbuild
+
+#      echo "CheckIt  $SRPMDIR/muttng-$VER-$REL.src.rpm"
+       if [ -e $SRPMDIR/muttng-$VER-$REL.src.rpm ]
+       then
+               echo "BuiltOK  $SRPMDIR/muttng-$VER-$REL.src.rpm"
+               cp $SRPMDIR/muttng-$VER-$REL.src.rpm $DSTDIR
+               echo "$DSTDIR/muttng-$VER-$REL.src.rpm" >> $TMPDIR/$NAME.rpmbuild
+       fi
+       
+       cp $SPEC $DSTDIR
+
+       echo "Mailing  $ADDR - BUILT"
+       echo >> $TMPDIR/$NAME.rpmbuild
+       head -15 $TMPDIR/$NAME/ChangeLog.mutt-ng >> $TMPDIR/$NAME.rpmbuild
+       echo "..." >> $TMPDIR/$NAME.rpmbuild
+       $MAIL -s "Mutt-NG: BUILT - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
+else
+       echo "Mailing  $ADDR - ERROR"
+       $MAIL -s "Mutt-NG: ERROR - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
+fi
+
+# echo "Cleanup  $TMPDIR/muttng-*/ $TMPDIR/$NAME.rpmbuild"
+/bin/rm -f $TMPDIR/$NAME.rpmbuild
+(cd $TMPDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
+
+exit 1
index 44d88e8..39d0e01 100644 (file)
@@ -1,7 +1,7 @@
 Summary: A text mode mail user agent.
 Name: muttng
-Version: 20050306
-Release: 1
+Version: 20050314
+Release: 2
 Serial: 1
 License: GPL
 Group: Applications/Internet
@@ -14,19 +14,19 @@ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildPrereq: /usr/sbin/sendmail slang-devel /usr/bin/automake-1.4
 
 %description
-Mutt-ng is a text-mode mail user agent. Mutt-ng supports color, threading,
+Mutt-ng is a text-mode mail user agent. Mutt supports color, threading,
 arbitrary key remapping, and a lot of customization.
 
-You should install Mutt-ng if you have used it in the past and you prefer
+You should install mutt if you have used it in the past and you prefer
 it, or if you are new to mail programs and have not decided which one
 you are going to use.
 
 %prep
-# %setup -n %{name}-%{version} -q -a 2
 %setup -n %{name}-%{version} -q
 
 %build
-autoconf ./configure.in > ./configure
+rm -rf autom4te.cache
+./prepare
 chmod 700 ./configure
 export -n LINGUAS
 CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} \
@@ -91,5 +91,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man5/muttng-mbox.*
 
 %changelog
+* Mon Mar 14 2005 Iain Lea <iain@bricbrac.de>  1:20050314-2
+- fixed aclocal/automake/autoconf/prepare weirdness (rm -rf autom4te.cache)
 * Sun Mar 06 2005 Iain Lea <iain@bricbrac.de>  1:20050306-1
 - initial muttng.spec file
diff --git a/init.h b/init.h
index ce13643..912839a 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1340,6 +1340,11 @@ struct option_t MuttVars[] = {
   ** .pp
   ** The width of the mailbox list pane (left sidebar like in GUIs).
   */
+  { "sidebar_newmail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, 0 },
+  /*
+  ** .pp
+  ** If set, only folders with new mail will be shown in the sidebar.
+  */
   { "mbox_type",       DT_MAGIC,R_NONE, UL &DefaultMagic, M_MBOX },
   /*
   ** .pp
diff --git a/mutt.h b/mutt.h
index 6a009a3..72316f0 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -563,7 +563,7 @@ enum
   OPTNEWSCACHE,                /* (pseudo) used to indicate if news cache exist */
 #endif
   OPTSHORTENHIERARCHY, /* set when to shorten "hierarchies" in the sidebar */
-
+  OPTSIDEBARNEWMAILONLY,
   OPTMAX
 };
 
index 098211d..4a648aa 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -282,19 +282,37 @@ int draw_sidebar(int menu) {
       SETCOLOR(MT_COLOR_NORMAL);
 
     move( lines, 0 );
-    if ( Context && !strcmp( tmp->path, Context->path ) ) {
-      printw( "%.*s", SidebarWidth - delim_len,
-              make_sidebar_entry(basename(tmp->path),
-                                 Context->msgcount, Context->unread, Context->flagged));
-      tmp->msg_unread = Context->unread;
-      tmp->msgcount = Context->msgcount;
-      tmp->msg_flagged = Context->flagged;
+    if (option(OPTSIDEBARNEWMAILONLY)) {
+      if (tmp->msg_unread > 0) {
+        if ( Context && !strcmp( tmp->path, Context->path ) ) {
+          printw( "%.*s", SidebarWidth - delim_len,
+                  make_sidebar_entry(basename(tmp->path),
+                                     Context->msgcount, Context->unread, Context->flagged));
+          tmp->msg_unread = Context->unread;
+          tmp->msgcount = Context->msgcount;
+          tmp->msg_flagged = Context->flagged;
+        }
+        else
+          printw( "%.*s", SidebarWidth - delim_len,
+                  make_sidebar_entry(basename(tmp->path),
+                                     tmp->msgcount,tmp->msg_unread, tmp->msg_flagged));
+        lines++;
+      }
+    } else {
+      if ( Context && !strcmp( tmp->path, Context->path ) ) {
+        printw( "%.*s", SidebarWidth - delim_len,
+                make_sidebar_entry(basename(tmp->path),
+                                   Context->msgcount, Context->unread, Context->flagged));
+        tmp->msg_unread = Context->unread;
+        tmp->msgcount = Context->msgcount;
+        tmp->msg_flagged = Context->flagged;
+      }
+      else
+        printw( "%.*s", SidebarWidth - delim_len,
+                make_sidebar_entry(basename(tmp->path),
+                                   tmp->msgcount,tmp->msg_unread, tmp->msg_flagged));
+      lines++;
     }
-    else
-      printw( "%.*s", SidebarWidth - delim_len,
-              make_sidebar_entry(basename(tmp->path),
-                                 tmp->msgcount,tmp->msg_unread, tmp->msg_flagged));
-    lines++;
   }
   SETCOLOR(MT_COLOR_NORMAL);
   for ( ; lines < LINES - 1 - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); lines++ ) {
@@ -340,12 +358,14 @@ void scroll_sidebar(int op, int menu)
 
   switch (op) {
     case OP_SIDEBAR_NEXT:
-      if ( CurBuffy->next == NULL ) {
-        mutt_error (_("You are on the last mailbox."));
-        return;
-      }
-      CurBuffy = CurBuffy->next;
-      break;
+      if (!option(OPTSIDEBARNEWMAILONLY)) {
+        if ( CurBuffy->next == NULL ) {
+          mutt_error (_("You are on the last mailbox."));
+          return;
+        }
+        CurBuffy = CurBuffy->next;
+        break;
+      } /* the fall-through is intentional */
     case OP_SIDEBAR_NEXT_NEW:
       if ( (tmp = exist_next_new()) == NULL) {
         mutt_error (_("No next mailboxes with new mail."));
@@ -354,12 +374,14 @@ void scroll_sidebar(int op, int menu)
       else CurBuffy = tmp;
       break;
     case OP_SIDEBAR_PREV:
-      if ( CurBuffy->prev == NULL ) {
-        mutt_error (_("You are on the first mailbox."));
-        return;
-      }
-      CurBuffy = CurBuffy->prev;
-     break;
+      if (!option(OPTSIDEBARNEWMAILONLY)) {
+        if ( CurBuffy->prev == NULL ) {
+          mutt_error (_("You are on the first mailbox."));
+          return;
+        }
+        CurBuffy = CurBuffy->prev;
+       break;
+     } /* the fall-through is intentional */
     case OP_SIDEBAR_PREV_NEW:
       if ( (tmp = exist_prev_new()) == NULL) {
         mutt_error (_("No previous mailbox with new mail."));