*/
static void mhl_draft(int, char *, int, int, char *, char *, int);
static void copy_draft(int, char *, char *, int, int, int);
-static void copy_mime_draft(int);
+static void add_forw_hdr(char *);
static int build_form(char *, char *, int, int);
** If filter file is defined, then format the
** messages into the draft using mhlproc.
*/
- if (filter)
+ if (filter) {
mhl_draft(out, digest, volume, issue, drft, filter,
dashstuff);
- else if (mime)
- copy_mime_draft(out);
- else
+ close(out);
+ } else if (mime) {
+ close(out);
+ add_forw_hdr(drft);
+ } else {
copy_draft(out, digest, drft, volume, issue,
dashstuff);
- close(out);
+ close(out);
+ }
if (digest) {
snprintf(buf, sizeof(buf), IFORMAT, digest);
** draft calling the mhlproc, and reading its output
** from a pipe.
*/
-
static void
mhl_draft(int out, char *digest, int volume, int issue,
char *file, char *filter, int dashstuff)
** not filtered through the mhlproc. Do dashstuffing if
** necessary.
*/
-
static void
copy_draft(int out, char *digest, char *file, int volume, int issue,
int dashstuff)
/*
-** Create a mhbuild composition file for forwarding message.
+** Create an attachment header for the to be forward messages.
*/
-
static void
-copy_mime_draft(int out)
+add_forw_hdr(char *draft)
{
int msgnum;
char buffer[BUFSIZ];
- snprintf(buffer, sizeof(buffer), "#forw [forwarded message%s] +%s",
- mp->numsel == 1 ? "" : "s", mp->foldpath);
- write(out, buffer, strlen(buffer));
- for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
- if (is_selected(mp, msgnum)) {
- snprintf(buffer, sizeof(buffer), " %s",
- m_name(msgnum));
- write(out, buffer, strlen(buffer));
+ snprintf(buffer, sizeof(buffer), "+%s", mp->foldpath);
+ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
+ if (!is_selected(mp, msgnum)) {
+ continue;
}
- write(out, "\n", 1);
+ /* TODO: improve the code */
+ strncat(buffer, " ", sizeof(buffer)-strlen(buffer)-1);
+ strncat(buffer, m_name(msgnum),
+ sizeof(buffer)-strlen(buffer)-1);
+ }
+ annotate(draft, attach_hdr, buffer, 1, 0, -2, 1);
}