Add WITH_MUTT_MAILDIR_MTIME_PATCH knob

Add the hide_thread_subject function
Add the conditional_date function
Bump PORTREVISION

PR:		ports/68359
Submitted by:	maintainer
Obtained from:	http://wiki.mutt.org
This commit is contained in:
Kirill Ponomarev 2004-06-26 15:40:28 +00:00
parent f956c5b46c
commit d2b35915dd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112324
7 changed files with 447 additions and 13 deletions

View file

@ -78,10 +78,13 @@
#
# If you want to use the ifdef feature define:
# WITH_MUTT_IFDEF_PATCH
#
# If you want to have the Maildir mtime patch define:
# WITH_MUTT_MAILDIR_MTIME_PATCH
PORTNAME= mutt-devel
PORTVERSION= 1.5.6
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES+= mail ipv6
.if defined(WITH_MUTT_NNTP)
CATEGORIES+= news
@ -220,6 +223,14 @@ pre-configure::
pre-configure::
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-maildir-header-cache
.endif
.if defined(WITH_MUTT_MAILDIR_MTIME_PATCH)
pre-configure::
.if defined(WITH_MUTT_NNTP)
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-maildir-mtime-nntp
.else
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-maildir-mtime
.endif
.endif
.if ! defined(WITHOUT_MUTT_PGP_PATCH)
SGML_NEEDED= yes
@ -403,6 +414,16 @@ post-install:
@${ECHO} "simultaneously using the same mailbox." >> ${PKGMESSAGE}
@${ECHO} "====================================================" >> ${PKGMESSAGE}
.endif
.if defined(WITH_MUTT_MAILDIR_HEADER_CACHE) && defined(WITH_MUTT_MAILDIR_MTIME_PATCH)
@${ECHO} "====================================================" >> ${PKGMESSAGE}
@${ECHO} "You have installed ${PORTNAME} with the Maildir header" >> ${PKGMESSAGE}
@${ECHO} "cache and the MAILDIR_MTIME_PATCH enabled." >> ${PKGMESSAGE}
@${ECHO} >> ${PKGMESSAGE}
@${ECHO} "For this to work you may have to delete your old" >> ${PKGMESSAGE}
@${ECHO} "Maildir header cache or otherwise you may face" >> ${PKGMESSAGE}
@${ECHO} "an \"Out of memory\" error." >> ${PKGMESSAGE}
@${ECHO} "====================================================" >> ${PKGMESSAGE}
.endif
.if !defined(BATCH)
@${ECHO}
@${CAT} ${PKGMESSAGE}

View file

@ -0,0 +1,82 @@
--- PATCHES Dec 2002 17:44:54 -0000 3.6
+++ PATCHES Feb 2004 13:19:42 -0000
@@ -0,0 +1 @@
+patch-1.5.6.dw.maildir-mtime.1
--- browser.c Sep 2003 13:03:25 -0000 3.9
+++ browser.c Feb 2004 13:19:42 -0000
@@ -29,2 +29,3 @@
#endif
+#include "mx.h"
@@ -304,4 +305,6 @@ folder_format_str (char *dest, size_t de
static void add_folder (MUTTMENU *m, struct browser_state *state,
- const char *name, const struct stat *s, int new)
+ const char *name, const struct stat *s, BUFFY *mbuf)
{
+ int new = (mbuf) ? mbuf->new : 0;
+
if (state->entrylen == state->entrymax)
@@ -317,2 +320,5 @@ static void add_folder (MUTTMENU *m, str
+ if (mbuf && mbuf->magic == M_MAILDIR && mbuf->mtime)
+ s->st_mtime = mbuf->mtime;
+
if (s != NULL)
@@ -411,3 +417,3 @@ static int examine_directory (MUTTMENU *
tmp = tmp->next;
- add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
+ add_folder (menu, state, de->d_name, &s, tmp);
}
@@ -435,3 +441,3 @@ static int examine_mailboxes (MUTTMENU *
{
- add_folder (menu, state, tmp->path, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, tmp);
continue;
@@ -442,3 +448,3 @@ static int examine_mailboxes (MUTTMENU *
{
- add_folder (menu, state, tmp->path, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, tmp);
continue;
@@ -456,3 +462,3 @@ static int examine_mailboxes (MUTTMENU *
- add_folder (menu, state, buffer, &s, tmp->new);
+ add_folder (menu, state, buffer, &s, tmp);
}
--- buffy.c Feb 2004 17:50:43 -0000 3.9
+++ buffy.c Feb 2004 13:19:42 -0000
@@ -229,2 +229,3 @@ int mutt_parse_mailboxes (BUFFER *path,
(*tmp)->newly_created = 0;
+ (*tmp)->mtime = 0;
@@ -260,2 +261,3 @@ int mutt_buffy_check (int force)
struct stat sb;
+ struct stat smd;
struct dirent *de;
@@ -299,2 +301,3 @@ int mutt_buffy_check (int force)
tmp->new = 0;
+ tmp->mtime = 0;
@@ -383,6 +386,13 @@ int mutt_buffy_check (int force)
{
- /* one new and undeleted message is enough */
- BuffyCount++;
- tmp->new = 1;
- break;
+ if (!tmp->new)
+ {
+ /* one new and undeleted message is enough */
+ BuffyCount++;
+ tmp->new = 1;
+ }
+ snprintf (path, sizeof (path), "%s/new/%s", tmp->path, de->d_name);
+ if (!stat (path, &smd) && smd.st_mtime > tmp->mtime)
+ {
+ tmp->mtime = smd.st_mtime;
+ }
}
--- buffy.h Dec 2002 11:19:39 -0000 3.2
+++ buffy.h Feb 2004 13:19:42 -0000
@@ -29,2 +29,3 @@ typedef struct buffy_t
struct buffy_t *next;
+ time_t mtime; /* for maildirs...time of newest entry */
short new; /* mailbox has new mail */

View file

@ -0,0 +1,144 @@
--- PATCHES Dec 2002 17:44:54 -0000 3.6
+++ PATCHES Feb 2004 13:19:42 -0000
@@ -0,0 +1 @@
+patch-1.5.6.dw.maildir-mtime.1
--- browser.c.orig Wed Jun 23 12:55:45 2004
+++ browser.c Wed Jun 23 13:00:45 2004
@@ -30,6 +30,7 @@
#ifdef USE_NNTP
#include "nntp.h"
#endif
+#include "mx.h"
#include <stdlib.h>
#include <dirent.h>
@@ -424,8 +425,10 @@
static void add_folder (MUTTMENU *m, struct browser_state *state,
const char *name, const struct stat *s,
- void *data, int new)
+ void *data, BUFFY *mbuf)
{
+ int new = (mbuf) ? mbuf->new : 0;
+
if (state->entrylen == state->entrymax)
{
/* need to allocate more space */
@@ -437,6 +440,9 @@
m->data = state->entry;
}
+ if (mbuf && mbuf->magic == M_MAILDIR && mbuf->mtime)
+ s->st_mtime = mbuf->mtime;
+
if (s != NULL)
{
(state->entry)[state->entrylen].mode = s->st_mode;
@@ -495,7 +501,7 @@
continue;
if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
continue;
- add_folder (menu, state, data->group, NULL, data, data->new);
+ add_folder (menu, state, data->group, NULL, data, tmp);
}
}
else
@@ -561,7 +567,7 @@
tmp = Incoming;
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
- add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
+ add_folder (menu, state, de->d_name, &s, NULL, tmp);
}
closedir (dp);
}
@@ -589,7 +595,7 @@
{
if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
(data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
- add_folder (menu, state, data->group, NULL, data, data->new);
+ add_folder (menu, state, data->group, NULL, data, tmp);
}
}
else
@@ -608,21 +614,21 @@
#ifdef USE_IMAP
if (mx_is_imap (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
#ifdef USE_POP
if (mx_is_pop (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
#ifdef USE_NNTP
if (mx_is_nntp (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
@@ -636,7 +642,7 @@
strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
mutt_pretty_mailbox (buffer);
- add_folder (menu, state, buffer, &s, NULL, tmp->new);
+ add_folder (menu, state, buffer, &s, NULL, tmp);
}
while ((tmp = tmp->next));
}
@@ -1555,7 +1561,7 @@
if (regexec (rx, nd->group, 0, NULL, 0) == 0)
{
mutt_newsgroup_subscribe (news, nd->group);
- add_folder (menu, &state, nd->group, NULL, nd, nd->new);
+ add_folder (menu, &state, nd->group, NULL, nd, nd);
}
}
}
--- buffy.c Feb 2004 17:50:43 -0000 3.9
+++ buffy.c Feb 2004 13:19:42 -0000
@@ -229,2 +229,3 @@ int mutt_parse_mailboxes (BUFFER *path,
(*tmp)->newly_created = 0;
+ (*tmp)->mtime = 0;
@@ -260,2 +261,3 @@ int mutt_buffy_check (int force)
struct stat sb;
+ struct stat smd;
struct dirent *de;
@@ -299,2 +301,3 @@ int mutt_buffy_check (int force)
tmp->new = 0;
+ tmp->mtime = 0;
@@ -383,6 +386,13 @@ int mutt_buffy_check (int force)
{
- /* one new and undeleted message is enough */
- BuffyCount++;
- tmp->new = 1;
- break;
+ if (!tmp->new)
+ {
+ /* one new and undeleted message is enough */
+ BuffyCount++;
+ tmp->new = 1;
+ }
+ snprintf (path, sizeof (path), "%s/new/%s", tmp->path, de->d_name);
+ if (!stat (path, &smd) && smd.st_mtime > tmp->mtime)
+ {
+ tmp->mtime = smd.st_mtime;
+ }
}
--- buffy.h Dec 2002 11:19:39 -0000 3.2
+++ buffy.h Feb 2004 13:19:42 -0000
@@ -29,2 +29,3 @@ typedef struct buffy_t
struct buffy_t *next;
+ time_t mtime; /* for maildirs...time of newest entry */
short new; /* mailbox has new mail */

View file

@ -1,16 +1,6 @@
--- configure.orig Tue Jan 18 14:19:14 2000
+++ configure Tue Feb 29 01:47:49 2000
@@ -1925,6 +1925,9 @@
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
+#ifdef __FreeBSD__
+#define bkgdset initscr
+#endif
int main() {
@@ -5710,7 +5713,7 @@
@@ -5710,7 +5710,7 @@
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g

View file

@ -0,0 +1,146 @@
--- PATCHES~ never
+++ PATCHES Thu Jun 13 16:25:05 CDT 2002
@@ -1,0 +1 @@
+dgc.deepif.1
diff -Pur mutt-1.5.1-base/muttlib.c mutt-1.5.1/muttlib.c
--- muttlib.c Tue Mar 26 16:47:06 2002
+++ muttlib.c Thu Jun 13 15:28:20 2002
@@ -978,6 +978,12 @@
count = 0;
while (count < sizeof (ifstring) && *src && *src != '?' && *src != '&')
{
+ if (*src == '\\')
+ {
+ src++;
+ if (!*src)
+ break;
+ }
*cp++ = *src++;
count++;
}
@@ -990,7 +996,13 @@
count = 0;
while (count < sizeof (elsestring) && *src && *src != '?')
{
- *cp++ = *src++;
+ if (*src == '\\')
+ {
+ src++;
+ if (!*src)
+ break;
+ }
+ *cp++ = *src++;
count++;
}
*cp = 0;
Index: PATCHES
===================================================================
--- PATCHES (revision 22)
+++ PATCHES (revision 22)
@@ -1,0 +1 @@
+patch-1.5.0.ats.date_conditional.1
Index: muttlib.c
===================================================================
--- muttlib.c (revision 22)
+++ muttlib.c (revision 22)
@@ -944,7 +944,16 @@
if (*src == '?')
{
flags |= M_FORMAT_OPTIONAL;
- src++;
+ ch = *(++src); /* save the character to switch on */
+ cp = prefix;
+ ++src;
+ count = 0;
+ while (count < sizeof (prefix) && *src != '?')
+ {
+ *cp++ = *src++;
+ count++;
+ }
+ *cp = 0;
}
else
{
@@ -960,12 +969,12 @@
count++;
}
*cp = 0;
- }
- if (!*src)
- break; /* bad format */
+ if (!*src)
+ break; /* bad format */
- ch = *src++; /* save the character to switch on */
+ ch = *src++; /* save the character to switch on */
+ }
if (flags & M_FORMAT_OPTIONAL)
{
--- hdrline.c.orig Thu Jun 24 11:16:36 2004
+++ hdrline.c Thu Jun 24 11:43:28 2004
@@ -316,6 +316,63 @@
const char *cp;
struct tm *tm;
time_t T;
+ int i = 0, invert = 0;
+
+ if (optional && (op == '[' || op == '(')) {
+ char *is;
+ int d;
+ T = time(NULL);
+ d = T % 86400;
+ T -= (op == '(') ? hdr->received : hdr->date_sent;
+
+ is = (char *)prefix;
+ if( *is == '>' ) {
+ invert = 1;
+ ++is;
+ }
+
+ while( *is && *is != '?' ) {
+ int t = strtol (is, &is, 10);
+ switch (*(is++)) {
+ case '?':
+ break;
+ case 'y':
+ t *= 365 * 24 * 60 * 60;
+ break;
+ case 'M':
+ t *= 30 * 24 * 60 * 60;
+ break;
+ case 'w':
+ t *= 7 * 24 * 60 * 60;
+ break;
+ case 'd':
+ t *= 24 * 60 * 60;
+ break;
+ case 't':
+ if (t > 1) {
+ t = (t-1) * 24 * 60 * 60;
+ } else {
+ t = 0;
+ }
+ t += d;
+ break;
+ case 'h':
+ t *= 60 * 60;
+ break;
+ case 'm':
+ t *= 60;
+ break;
+ }
+ i += t;
+ }
+
+ if (i < 0)
+ i *= -1;
+
+ if( (T > i || T < -1*i) ^ invert )
+ optional = 0;
+ break;
+ }
p = dest;

View file

@ -0,0 +1,51 @@
From:
http://www.elho.net/dev/mutt/patch-1.5.6.eh.thread_subject.1
diff -ru mutt-1.5.6.orig/init.h mutt-1.5.6/init.h
--- init.h 2004-02-01 18:15:17.000000000 +0100
+++ init.h 2004-06-21 22:58:49.000000000 +0200
@@ -704,6 +704,13 @@
** When set, mutt will not show the presence of missing messages in the
** thread tree.
*/
+ { "hide_thread_subject", DT_BOOL, R_TREE|R_INDEX, OPTHIDETHREADSUBJECT, 1 },
+ /*
+ ** .pp
+ ** When set, mutt will not show the subject of messages in the thread
+ ** tree that have the same subject as their parent or closest previously
+ ** displayed sibling.
+ */
{ "hide_top_limited", DT_BOOL, R_TREE|R_INDEX, OPTHIDETOPLIMITED, 0 },
/*
** .pp
diff -ru mutt-1.5.6.orig/mutt.h mutt-1.5.6/mutt.h
--- mutt.h 2004-02-01 18:15:17.000000000 +0100
+++ mutt.h 2004-06-21 22:48:35.000000000 +0200
@@ -351,6 +351,7 @@
OPTHIDDENHOST,
OPTHIDELIMITED,
OPTHIDEMISSING,
+ OPTHIDETHREADSUBJECT,
OPTHIDETOPLIMITED,
OPTHIDETOPMISSING,
OPTIGNORELISTREPLYTO,
diff -ru mutt-1.5.6.orig/PATCHES mutt-1.5.6/PATCHES
--- PATCHES 2004-02-01 18:42:47.000000000 +0100
+++ PATCHES 2004-06-21 21:54:50.000000000 +0200
@@ -0,0 +1 @@
+patch-1.5.6.eh.thread_subject.1
diff -ru mutt-1.5.6.orig/thread.c mutt-1.5.6/thread.c
--- thread.c 2004-02-01 18:10:58.000000000 +0100
+++ thread.c 2004-06-21 22:51:35.000000000 +0200
@@ -41,6 +41,10 @@
{
THREAD *tmp, *tree = hdr->thread;
+ /* if the user disabled subject hiding, display it */
+ if (!option (OPTHIDETHREADSUBJECT))
+ return (1);
+
/* if our subject is different from our parent's, display it */
if (hdr->subject_changed)
return (1);

View file

@ -131,7 +131,7 @@ EOF
fi
if [ "$MUTT_HTML" = "yes" ]; then
html=371
html=372
if [ "$MUTT_COMPRESSED_FOLDERS" = "yes" ]; then
html=$(($html + 5))
fi