From: Jon Steinhart Date: Fri, 19 Nov 2004 05:06:16 +0000 (+0000) Subject: Added mail directory argument to folder_addmsg in order to make it possible X-Git-Tag: RELEASE_1_2~54 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=a753601a3811c10e433dbb04d8211a3df4b99012 Added mail directory argument to folder_addmsg in order to make it possible to provide a path to the ext_hook call that is mailpath-based. A problem existed when a folder was a symbolic link and the pwd call would return the path relative to the filesystem, not to mailpath. A new argument was needed because there was otherwise no reasonable way to get that path. --- diff --git a/h/prototypes.h b/h/prototypes.h index 1b815bc..fa9f0c2 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -51,7 +51,7 @@ void discard (FILE *); int done (int); int ext_hook(char *, char *, char *); int fdcompare (int, int); -int folder_addmsg (struct msgs **, char *, int, int, int, int); +int folder_addmsg (struct msgs **, char *, int, int, int, int, char *); int folder_delmsgs (struct msgs *, int, int); void folder_free (struct msgs *); int folder_pack (struct msgs **, int); diff --git a/sbr/folder_addmsg.c b/sbr/folder_addmsg.c index 401896a..1af116c 100644 --- a/sbr/folder_addmsg.c +++ b/sbr/folder_addmsg.c @@ -20,7 +20,7 @@ int folder_addmsg (struct msgs **mpp, char *msgfile, int selected, - int unseen, int preserve, int deleting) + int unseen, int preserve, int deleting, char *from_dir) { int infd, outfd, linkerr, first_time, msgnum; char *nmsg, newmsg[BUFSIZ]; @@ -142,7 +142,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, if (link (msgfile, newmsg) != -1) { if (deleting) { - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", pwd(), msgfile); + (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); (void)ext_hook("ref-hook", oldmsg, newmsg); } else @@ -198,7 +198,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, close (outfd); if (deleting) { - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", pwd(), msgfile); + (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); (void)ext_hook("ref-hook", oldmsg, newmsg); } else diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index fc78ac1..72694b6 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -920,7 +920,7 @@ output_content_folder (char *folder, char *filename) /* Read the folder. */ if ((mp = folder_read (folder))) { /* Link file into folder */ - msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0); + msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, (char *)0); } else { advise (NULL, "unable to read folder %s", folder); return NOTOK; diff --git a/uip/rcvstore.c b/uip/rcvstore.c index dd6dc88..7b15491 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -202,7 +202,7 @@ main (int argc, char **argv) * Link message into folder, and possibly add * to the Unseen-Sequence's. */ - if ((msgnum = folder_addmsg (&mp, tmpfilenam, 0, unseensw, 0, 0)) == -1) + if ((msgnum = folder_addmsg (&mp, tmpfilenam, 0, unseensw, 0, 0, (char *)0)) == -1) done (1); /* diff --git a/uip/refile.c b/uip/refile.c index c184dc1..f3c6d1f 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -400,7 +400,7 @@ m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve, int struct st_fold *fp, *ep; for (fp = folders, ep = folders + nfolders; fp < ep; fp++) { - if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile)) == -1) + if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile, maildir)) == -1) return 1; } return 0;