X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ffolder_delmsgs.c;h=c1416a6fb8557ea1ea5b094be18af962703b56ad;hb=a59946091a8ee121ad89708efb0b719e0d1e179a;hp=e5374b5d601b9a29e98f1b83e0e546cb485f7d30;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/sbr/folder_delmsgs.c b/sbr/folder_delmsgs.c index e5374b5..c1416a6 100644 --- a/sbr/folder_delmsgs.c +++ b/sbr/folder_delmsgs.c @@ -2,7 +2,9 @@ /* * folder_delmsgs.c -- "remove" SELECTED messages from a folder * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -18,11 +20,12 @@ */ int -folder_delmsgs (struct msgs *mp, int unlink_msgs) +folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook) { pid_t pid; int msgnum, vecp, retval = 0; char buf[100], *dp, **vec; + char msgpath[BUFSIZ]; /* * If "rmmproc" is defined, exec it to remove messages. @@ -37,9 +40,6 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs) /* Mark that the sequence information has changed */ mp->msgflags |= SEQMOD; - if (mp->numsel > MAXARGS - 2) - adios (NULL, "more than %d messages for %s exec", MAXARGS - 2, - rmmproc); vec = (char **) calloc ((size_t) (mp->numsel + 2), sizeof(*vec)); if (vec == NULL) adios (NULL, "unable to allocate exec vector"); @@ -79,6 +79,19 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs) unset_selected (mp, msgnum); mp->numsel--; + /* + * Run the external hook on the message if one was specified in the context. + * All we have is the message number; we have changed to the directory + * containing the message. So, we need to extract that directory to form + * the complete path. Note that the caller knows the directory, but has + * no way of passing that to us. + */ + + if (!nohook) { + (void)snprintf(msgpath, sizeof (msgpath), "%s/%d", mp->foldpath, msgnum); + (void)ext_hook("del-hook", msgpath, (char *)0); + } + dp = m_name (msgnum); if (unlink_msgs) {