projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use a proper "hack" for iconv functions:
[apps/madmutt.git]
/
mh.c
diff --git
a/mh.c
b/mh.c
index
1bcf9c1
..
cfe7c36
100644
(file)
--- a/
mh.c
+++ b/
mh.c
@@
-24,6
+24,8
@@
#include "copy.h"
#include "buffy.h"
#include "sort.h"
#include "copy.h"
#include "buffy.h"
#include "sort.h"
+#include "thread.h"
+#include "hcache.h"
#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/mem.h"
#include "lib/intl.h"
@@
-81,7
+83,7
@@
static void mhs_alloc (struct mh_sequences *mhs, int i)
if (i > mhs->max || !mhs->flags) {
newmax = i + 128;
if (i > mhs->max || !mhs->flags) {
newmax = i + 128;
-
safe
_realloc (&mhs->flags, sizeof (mhs->flags[0]) * (newmax + 1));
+
mem
_realloc (&mhs->flags, sizeof (mhs->flags[0]) * (newmax + 1));
for (j = mhs->max + 1; j <= newmax; j++)
mhs->flags[j] = 0;
for (j = mhs->max + 1; j <= newmax; j++)
mhs->flags[j] = 0;
@@
-91,7
+93,7
@@
static void mhs_alloc (struct mh_sequences *mhs, int i)
static void mhs_free_sequences (struct mh_sequences *mhs)
{
static void mhs_free_sequences (struct mh_sequences *mhs)
{
-
FREE
(&mhs->flags);
+
mem_free
(&mhs->flags);
}
static short mhs_check (struct mh_sequences *mhs, int i)
}
static short mhs_check (struct mh_sequences *mhs, int i)
@@
-157,11
+159,11
@@
static void mh_read_sequences (struct mh_sequences *mhs, const char *path)
if (!(t = strtok (buff, " \t:")))
continue;
if (!(t = strtok (buff, " \t:")))
continue;
- if (!s
afe_str
cmp (t, MhUnseen))
+ if (!s
tr_
cmp (t, MhUnseen))
f = MH_SEQ_UNSEEN;
f = MH_SEQ_UNSEEN;
- else if (!s
afe_str
cmp (t, MhFlagged))
+ else if (!s
tr_
cmp (t, MhFlagged))
f = MH_SEQ_FLAGGED;
f = MH_SEQ_FLAGGED;
- else if (!s
afe_str
cmp (t, MhReplied))
+ else if (!s
tr_
cmp (t, MhReplied))
f = MH_SEQ_REPLIED;
else /* unknown sequence */
continue;
f = MH_SEQ_REPLIED;
else /* unknown sequence */
continue;
@@
-173,7
+175,7
@@
static void mh_read_sequences (struct mh_sequences *mhs, const char *path)
}
}
}
}
-
FREE
(&buff);
+
mem_free
(&buff);
safe_fclose (&fp);
}
safe_fclose (&fp);
}
@@
-208,13
+210,13
@@
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
}
}
else {
}
}
else {
- *tgt = s
afe_str
dup (path);
+ *tgt = s
tr_
dup (path);
break;
}
}
if ((*fp = fdopen (fd, "w")) == NULL) {
break;
}
}
if ((*fp = fdopen (fd, "w")) == NULL) {
-
FREE
(tgt);
+
mem_free
(tgt);
close (fd);
unlink (path);
return (-1);
close (fd);
unlink (path);
return (-1);
@@
-304,11
+306,11
@@
void mh_update_sequences (CONTEXT * ctx)
/* first, copy unknown sequences */
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &s, ofp, &l))) {
/* first, copy unknown sequences */
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &s, ofp, &l))) {
- if (!s
afe_strncmp (buff, seq_unseen, safe_str
len (seq_unseen)))
+ if (!s
tr_ncmp (buff, seq_unseen, str_
len (seq_unseen)))
continue;
continue;
- if (!s
afe_strncmp (buff, seq_flagged, safe_str
len (seq_flagged)))
+ if (!s
tr_ncmp (buff, seq_flagged, str_
len (seq_flagged)))
continue;
continue;
- if (!s
afe_strncmp (buff, seq_replied, safe_str
len (seq_replied)))
+ if (!s
tr_ncmp (buff, seq_replied, str_
len (seq_replied)))
continue;
fprintf (nfp, "%s\n", buff);
continue;
fprintf (nfp, "%s\n", buff);
@@
-362,7
+364,7
@@
void mh_update_sequences (CONTEXT * ctx)
unlink (tmpfname);
}
unlink (tmpfname);
}
-
FREE
(&tmpfname);
+
mem_free
(&tmpfname);
}
static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
}
static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
@@
-395,17
+397,17
@@
static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path);
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &sz, ofp, &line))) {
snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path);
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &sz, ofp, &line))) {
- if (unseen && !strncmp (buff, seq_unseen, s
afe_str
len (seq_unseen))) {
+ if (unseen && !strncmp (buff, seq_unseen, s
tr_
len (seq_unseen))) {
fprintf (nfp, "%s %d\n", buff, n);
unseen_done = 1;
}
else if (flagged
fprintf (nfp, "%s %d\n", buff, n);
unseen_done = 1;
}
else if (flagged
- && !strncmp (buff, seq_flagged, s
afe_str
len (seq_flagged))) {
+ && !strncmp (buff, seq_flagged, s
tr_
len (seq_flagged))) {
fprintf (nfp, "%s %d\n", buff, n);
flagged_done = 1;
}
else if (replied
fprintf (nfp, "%s %d\n", buff, n);
flagged_done = 1;
}
else if (replied
- && !strncmp (buff, seq_replied, s
afe_str
len (seq_replied))) {
+ && !strncmp (buff, seq_replied, s
tr_
len (seq_replied))) {
fprintf (nfp, "%s %d\n", buff, n);
replied_done = 1;
}
fprintf (nfp, "%s %d\n", buff, n);
replied_done = 1;
}
@@
-414,7
+416,7
@@
static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
}
}
safe_fclose (&ofp);
}
}
safe_fclose (&ofp);
-
FREE
(&buff);
+
mem_free
(&buff);
if (!unseen_done && unseen)
fprintf (nfp, "%s: %d\n", NONULL (MhUnseen), n);
if (!unseen_done && unseen)
fprintf (nfp, "%s: %d\n", NONULL (MhUnseen), n);
@@
-429,7
+431,7
@@
static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
if (safe_rename (tmpfname, sequences) != 0)
unlink (tmpfname);
if (safe_rename (tmpfname, sequences) != 0)
unlink (tmpfname);
-
FREE
(&tmpfname);
+
mem_free
(&tmpfname);
}
static void mh_update_maildir (struct maildir *md, struct mh_sequences *mhs)
}
static void mh_update_maildir (struct maildir *md, struct mh_sequences *mhs)
@@
-460,11
+462,11
@@
static void maildir_free_entry (struct maildir **md)
if (!md || !*md)
return;
if (!md || !*md)
return;
-
FREE
(&(*md)->canon_fname);
+
mem_free
(&(*md)->canon_fname);
if ((*md)->h)
mutt_free_header (&(*md)->h);
if ((*md)->h)
mutt_free_header (&(*md)->h);
-
FREE
(md);
+
mem_free
(md);
}
static void maildir_free_maildir (struct maildir **md)
}
static void maildir_free_maildir (struct maildir **md)
@@
-488,7
+490,7
@@
static void maildir_parse_flags (HEADER * h, const char *path)
h->read = 0;
h->replied = 0;
h->read = 0;
h->replied = 0;
- if ((p = strrchr (path, ':')) != NULL && s
afe_str
ncmp (p + 1, "2,", 2) == 0) {
+ if ((p = strrchr (path, ':')) != NULL && s
tr_
ncmp (p + 1, "2,", 2) == 0) {
p += 3;
str_replace (&h->maildir_flags, p);
p += 3;
str_replace (&h->maildir_flags, p);
@@
-525,7
+527,7
@@
static void maildir_parse_flags (HEADER * h, const char *path)
}
if (q == h->maildir_flags)
}
if (q == h->maildir_flags)
-
FREE
(&h->maildir_flags);
+
mem_free
(&h->maildir_flags);
else if (q)
*q = '\0';
}
else if (q)
*q = '\0';
}
@@
-637,12
+639,12
@@
static int maildir_parse_entry (CONTEXT * ctx, struct maildir ***last,
if (subdir) {
snprintf (buf, sizeof (buf), "%s/%s", subdir, fname);
if (subdir) {
snprintf (buf, sizeof (buf), "%s/%s", subdir, fname);
- h->path = s
afe_str
dup (buf);
+ h->path = s
tr_
dup (buf);
}
else
}
else
- h->path = s
afe_str
dup (fname);
+ h->path = s
tr_
dup (fname);
- entry =
safe
_calloc (sizeof (struct maildir), 1);
+ entry =
mem
_calloc (sizeof (struct maildir), 1);
entry->h = h;
entry->header_parsed = (ctx->magic == M_MH);
#ifdef USE_INODESORT
entry->h = h;
entry->header_parsed = (ctx->magic == M_MH);
#ifdef USE_INODESORT
@@
-683,7
+685,7
@@
static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last,
if (subdir) {
snprintf (buf, sizeof (buf), "%s/%s", ctx->path, subdir);
if (subdir) {
snprintf (buf, sizeof (buf), "%s/%s", ctx->path, subdir);
- is_old = (s
afe_str
cmp ("cur", subdir) == 0);
+ is_old = (s
tr_
cmp ("cur", subdir) == 0);
}
else
strfcpy (buf, ctx->path, sizeof (buf));
}
else
strfcpy (buf, ctx->path, sizeof (buf));
@@
-701,7
+703,12
@@
static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last,
debug_print (2, ("parsing %s\n", de->d_name));
maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
debug_print (2, ("parsing %s\n", de->d_name));
maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
- de->d_ino);
+#if HAVE_DIRENT_D_INO
+ de->d_ino
+#else
+ 0
+#endif
+ );
}
closedir (dirp);
}
closedir (dirp);
@@
-830,12
+837,12
@@
static struct maildir *maildir_sort_inode (struct maildir *list)
}
#endif /* USE_INODESORT */
}
#endif /* USE_INODESORT */
-#if USE_HCACHE
+#if
def
USE_HCACHE
static size_t maildir_hcache_keylen (const char *fn)
{
const char *p = strchr (fn, ':');
static size_t maildir_hcache_keylen (const char *fn)
{
const char *p = strchr (fn, ':');
- return p ? (size_t) (p - fn) : s
afe_str
len (fn);
+ return p ? (size_t) (p - fn) : s
tr_
len (fn);
}
#endif
}
#endif
@@
-849,7
+856,7
@@
void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md)
char fn[_POSIX_PATH_MAX];
int count;
char fn[_POSIX_PATH_MAX];
int count;
-#if USE_HCACHE
+#if
def
USE_HCACHE
void *hc = NULL;
void *data;
struct timeval *when = NULL;
void *hc = NULL;
void *data;
struct timeval *when = NULL;
@@
-863,7
+870,7
@@
void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md)
if (!(p && p->h && !p->header_parsed))
continue;
if (!(p && p->h && !p->header_parsed))
continue;
-#if USE_HCACHE
+#if
def
USE_HCACHE
data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);
when = (struct timeval *) data;
#endif
data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);
when = (struct timeval *) data;
#endif
@@
-872,7
+879,7
@@
void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md)
mutt_message (_("Reading %s... %d"), ctx->path, count);
snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path);
mutt_message (_("Reading %s... %d"), ctx->path, count);
snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path);
-#if USE_HCACHE
+#if
def
USE_HCACHE
if (option (OPTHCACHEVERIFY)) {
ret = stat (fn, &lastchanged);
}
if (option (OPTHCACHEVERIFY)) {
ret = stat (fn, &lastchanged);
}
@@
-890,17
+897,17
@@
void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md)
if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h)) {
p->header_parsed = 1;
maildir_parse_flags (p->h, fn);
if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h)) {
p->header_parsed = 1;
maildir_parse_flags (p->h, fn);
-#if USE_HCACHE
+#if
def
USE_HCACHE
mutt_hcache_store (hc, p->h->path + 3, p->h, 0, &maildir_hcache_keylen);
#endif
}
else
mutt_free_header (&p->h);
mutt_hcache_store (hc, p->h->path + 3, p->h, 0, &maildir_hcache_keylen);
#endif
}
else
mutt_free_header (&p->h);
-#if USE_HCACHE
-
FREE
(&data);
+#if
def
USE_HCACHE
+
mem_free
(&data);
#endif
}
#endif
}
-#if USE_HCACHE
+#if
def
USE_HCACHE
mutt_hcache_close (hc);
#endif
}
mutt_hcache_close (hc);
#endif
}
@@
-1001,7
+1008,7
@@
static void maildir_flags (char *dest, size_t destlen, HEADER * hdr)
hdr->read ? "S" : "", hdr->deleted ? "T" : "",
NONULL (hdr->maildir_flags));
if (hdr->maildir_flags)
hdr->read ? "S" : "", hdr->deleted ? "T" : "",
NONULL (hdr->maildir_flags));
if (hdr->maildir_flags)
- qsort (tmp, s
afe_str
len (tmp), 1, ch_compar);
+ qsort (tmp, s
tr_
len (tmp), 1, ch_compar);
snprintf (dest, destlen, ":2,%s", tmp);
}
}
snprintf (dest, destlen, ":2,%s", tmp);
}
}
@@
-1055,13
+1062,13
@@
static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr
}
else {
debug_print (2, ("success.\n"));
}
else {
debug_print (2, ("success.\n"));
- msg->path = s
afe_str
dup (path);
+ msg->path = s
tr_
dup (path);
break;
}
}
if ((msg->fp = fdopen (fd, "w")) == NULL) {
break;
}
}
if ((msg->fp = fdopen (fd, "w")) == NULL) {
-
FREE
(&msg->path);
+
mem_free
(&msg->path);
close (fd);
unlink (path);
return (-1);
close (fd);
unlink (path);
return (-1);
@@
-1093,7
+1100,7
@@
static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr
*
*/
*
*/
-
int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg
, HEADER * hdr)
+
static int maildir_commit_message (MESSAGE * msg, CONTEXT * ctx
, HEADER * hdr)
{
char subdir[4];
char suffix[16];
{
char subdir[4];
char suffix[16];
@@
-1126,7
+1133,7
@@
int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr)
if (safe_rename (msg->path, full) == 0) {
if (hdr)
str_replace (&hdr->path, path);
if (safe_rename (msg->path, full) == 0) {
if (hdr)
str_replace (&hdr->path, path);
-
FREE
(&msg->path);
+
mem_free
(&msg->path);
/*
* Adjust the mtime on the file to match the time at which this
/*
* Adjust the mtime on the file to match the time at which this
@@
-1161,7
+1168,7
@@
int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr)
*/
*/
-static int _mh_commit_message (
CONTEXT * ctx, MESSAGE * msg
, HEADER * hdr,
+static int _mh_commit_message (
MESSAGE * msg, CONTEXT * ctx
, HEADER * hdr,
short updseq)
{
DIR *dirp;
short updseq)
{
DIR *dirp;
@@
-1212,7
+1219,7
@@
static int _mh_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr,
if (safe_rename (msg->path, path) == 0) {
if (hdr)
str_replace (&hdr->path, tmp);
if (safe_rename (msg->path, path) == 0) {
if (hdr)
str_replace (&hdr->path, tmp);
-
FREE
(&msg->path);
+
mem_free
(&msg->path);
break;
}
else if (errno != EEXIST) {
break;
}
else if (errno != EEXIST) {
@@
-1226,12
+1233,10
@@
static int _mh_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr,
return 0;
}
return 0;
}
-int mh_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr)
-{
- return _mh_commit_message (ctx, msg, hdr, 1);
+static int mh_commit_message (MESSAGE * msg, CONTEXT * ctx, HEADER * hdr) {
+ return _mh_commit_message (msg, ctx, hdr, 1);
}
}
-
/* Sync a message in an MH folder.
*
* This code is also used for attachment deletion in maildir
/* Sync a message in an MH folder.
*
* This code is also used for attachment deletion in maildir
@@
-1263,9
+1268,9
@@
static int mh_rewrite_message (CONTEXT * ctx, int msgno)
strfcpy (partpath, h->path, _POSIX_PATH_MAX);
if (ctx->magic == M_MAILDIR)
strfcpy (partpath, h->path, _POSIX_PATH_MAX);
if (ctx->magic == M_MAILDIR)
- rc = maildir_commit_message (
ctx, dest
, h);
+ rc = maildir_commit_message (
dest, ctx
, h);
else
else
- rc = _mh_commit_message (
ctx, dest
, h, 0);
+ rc = _mh_commit_message (
dest, ctx
, h, 0);
mx_close_message (&dest);
mx_close_message (&dest);
@@
-1312,7
+1317,8
@@
static int mh_sync_message (CONTEXT * ctx, int msgno)
{
HEADER *h = ctx->hdrs[msgno];
{
HEADER *h = ctx->hdrs[msgno];
- if (h->attach_del || h->refs_changed || h->irt_changed)
+ if (h->attach_del ||
+ (h->env && (h->env->refs_changed || h->env->irt_changed)))
if (mh_rewrite_message (ctx, msgno) != 0)
return -1;
if (mh_rewrite_message (ctx, msgno) != 0)
return -1;
@@
-1323,7
+1329,8
@@
static int maildir_sync_message (CONTEXT * ctx, int msgno)
{
HEADER *h = ctx->hdrs[msgno];
{
HEADER *h = ctx->hdrs[msgno];
- if (h->attach_del || h->refs_changed || h->irt_changed) {
+ if (h->attach_del ||
+ (h->env && (h->env->refs_changed || h->env->irt_changed))) {
/* when doing attachment deletion/rethreading, fall back to the MH case. */
if (mh_rewrite_message (ctx, msgno) != 0)
return (-1);
/* when doing attachment deletion/rethreading, fall back to the MH case. */
if (mh_rewrite_message (ctx, msgno) != 0)
return (-1);
@@
-1356,7
+1363,7
@@
static int maildir_sync_message (CONTEXT * ctx, int msgno)
snprintf (fullpath, sizeof (fullpath), "%s/%s", ctx->path, partpath);
snprintf (oldpath, sizeof (oldpath), "%s/%s", ctx->path, h->path);
snprintf (fullpath, sizeof (fullpath), "%s/%s", ctx->path, partpath);
snprintf (oldpath, sizeof (oldpath), "%s/%s", ctx->path, h->path);
- if (s
afe_str
cmp (fullpath, oldpath) == 0) {
+ if (s
tr_
cmp (fullpath, oldpath) == 0) {
/* message hasn't really changed */
return 0;
}
/* message hasn't really changed */
return 0;
}
@@
-1378,7
+1385,7
@@
static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
char path[_POSIX_PATH_MAX], tmp[_POSIX_PATH_MAX];
int i, j;
char path[_POSIX_PATH_MAX], tmp[_POSIX_PATH_MAX];
int i, j;
-#if USE_HCACHE
+#if
def
USE_HCACHE
void *hc = NULL;
#endif /* USE_HCACHE */
void *hc = NULL;
#endif /* USE_HCACHE */
@@
-1390,7
+1397,7
@@
static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
if (i != 0)
return i;
if (i != 0)
return i;
-#if USE_HCACHE
+#if
def
USE_HCACHE
if (ctx->magic == M_MAILDIR)
hc = mutt_hcache_open (HeaderCache, ctx->path);
#endif /* USE_HCACHE */
if (ctx->magic == M_MAILDIR)
hc = mutt_hcache_open (HeaderCache, ctx->path);
#endif /* USE_HCACHE */
@@
-1401,7
+1408,7
@@
static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path);
if (ctx->magic == M_MAILDIR
|| (option (OPTMHPURGE) && ctx->magic == M_MH)) {
snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path);
if (ctx->magic == M_MAILDIR
|| (option (OPTMHPURGE) && ctx->magic == M_MH)) {
-#if USE_HCACHE
+#if
def
USE_HCACHE
if (ctx->magic == M_MAILDIR)
mutt_hcache_delete (hc, ctx->hdrs[i]->path + 3,
&maildir_hcache_keylen);
if (ctx->magic == M_MAILDIR)
mutt_hcache_delete (hc, ctx->hdrs[i]->path + 3,
&maildir_hcache_keylen);
@@
-1434,7
+1441,7
@@
static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
}
}
}
}
-#if USE_HCACHE
+#if
def
USE_HCACHE
if (ctx->magic == M_MAILDIR)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
if (ctx->magic == M_MAILDIR)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
@@
-1459,7
+1466,7
@@
static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
return 0;
err:
return 0;
err:
-#if USE_HCACHE
+#if
def
USE_HCACHE
if (ctx->magic == M_MAILDIR)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
if (ctx->magic == M_MAILDIR)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
@@
-1605,7
+1612,7
@@
static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
for (p = md; p; p = p->next) {
maildir_canon_filename (buf, p->h->path, sizeof (buf));
for (p = md; p; p = p->next) {
maildir_canon_filename (buf, p->h->path, sizeof (buf));
- p->canon_fname = s
afe_str
dup (buf);
+ p->canon_fname = s
tr_
dup (buf);
hash_insert (fnames, p->canon_fname, p, 0);
}
hash_insert (fnames, p->canon_fname, p, 0);
}
@@
-1621,7
+1628,7
@@
static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
/* check to see if the message has moved to a different
* subdirectory. If so, update the associated filename.
*/
/* check to see if the message has moved to a different
* subdirectory. If so, update the associated filename.
*/
- if (s
afe_str
cmp (ctx->hdrs[i]->path, p->h->path))
+ if (s
tr_
cmp (ctx->hdrs[i]->path, p->h->path))
str_replace (&ctx->hdrs[i]->path, p->h->path);
/* if the user hasn't modified the flags on this message, update
str_replace (&ctx->hdrs[i]->path, p->h->path);
/* if the user hasn't modified the flags on this message, update
@@
-1713,7
+1720,7
@@
static int mh_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
safe_fclose (&fp);
if (safe_rename (tmp, buf) == -1)
unlink (tmp);
safe_fclose (&fp);
if (safe_rename (tmp, buf) == -1)
unlink (tmp);
-
FREE
(&tmp);
+
mem_free
(&tmp);
}
}
}
}
@@
-1748,7
+1755,7
@@
static int mh_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
ctx->hdrs[i]->active = 0;
if ((p = hash_find (fnames, ctx->hdrs[i]->path)) && p->h &&
ctx->hdrs[i]->active = 0;
if ((p = hash_find (fnames, ctx->hdrs[i]->path)) && p->h &&
- (m
box_strict_cmp_headers
(ctx->hdrs[i], p->h))) {
+ (m
utt_cmp_header
(ctx->hdrs[i], p->h))) {
ctx->hdrs[i]->active = 1;
/* found the right message */
if (!ctx->hdrs[i]->changed)
ctx->hdrs[i]->active = 1;
/* found the right message */
if (!ctx->hdrs[i]->changed)
@@
-1806,7
+1813,7
@@
FILE *_maildir_open_find_message (const char *folder, const char *unique,
while ((de = readdir (dp))) {
maildir_canon_filename (tunique, de->d_name, sizeof (tunique));
while ((de = readdir (dp))) {
maildir_canon_filename (tunique, de->d_name, sizeof (tunique));
- if (!s
afe_str
cmp (tunique, unique)) {
+ if (!s
tr_
cmp (tunique, unique)) {
snprintf (fname, sizeof (fname), "%s/%s/%s", folder, subfolder,
de->d_name);
fp = fopen (fname, "r"); /* __FOPEN_CHECKED__ */
snprintf (fname, sizeof (fname), "%s/%s/%s", folder, subfolder,
de->d_name);
fp = fopen (fname, "r"); /* __FOPEN_CHECKED__ */
@@
-1969,13
+1976,21
@@
static int maildir_is_magic (const char* path, struct stat* st) {
/* routines common to maildir and mh */
static mx_t* reg_mx (void) {
/* routines common to maildir and mh */
static mx_t* reg_mx (void) {
- mx_t* fmt =
safe
_calloc (1, sizeof (mx_t));
+ mx_t* fmt =
mem
_calloc (1, sizeof (mx_t));
fmt->local = 1;
fmt->mx_access = access;
fmt->mx_sync_mailbox = mh_sync_mailbox;
return (fmt);
}
fmt->local = 1;
fmt->mx_access = access;
fmt->mx_sync_mailbox = mh_sync_mailbox;
return (fmt);
}
+static int mh_commit (MESSAGE* msg, CONTEXT* ctx) {
+ return (mh_commit_message (msg, ctx, NULL));
+}
+
+static int maildir_commit (MESSAGE* msg, CONTEXT* ctx) {
+ return (maildir_commit_message (msg, ctx, NULL));
+}
+
mx_t* mh_reg_mx (void) {
mx_t* fmt = reg_mx ();
fmt->type = M_MH;
mx_t* mh_reg_mx (void) {
mx_t* fmt = reg_mx ();
fmt->type = M_MH;
@@
-1984,6
+1999,7
@@
mx_t* mh_reg_mx (void) {
fmt->mx_open_mailbox = mh_read_dir;
fmt->mx_open_new_message = mh_open_new_message;
fmt->mx_check_mailbox = mh_check_mailbox;
fmt->mx_open_mailbox = mh_read_dir;
fmt->mx_open_new_message = mh_open_new_message;
fmt->mx_check_mailbox = mh_check_mailbox;
+ fmt->mx_commit_message = mh_commit;
return (fmt);
}
return (fmt);
}
@@
-1995,5
+2011,6
@@
mx_t* maildir_reg_mx (void) {
fmt->mx_open_mailbox = maildir_read_dir;
fmt->mx_open_new_message = maildir_open_new_message;
fmt->mx_check_mailbox = maildir_check_mailbox;
fmt->mx_open_mailbox = maildir_read_dir;
fmt->mx_open_new_message = maildir_open_new_message;
fmt->mx_check_mailbox = maildir_check_mailbox;
+ fmt->mx_commit_message = maildir_commit;
return (fmt);
}
return (fmt);
}