2 ** m_draft.c -- construct the name of a draft message
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
15 ** `which' should either be the cur sequence to use the current draft
16 ** or the beyond sequence to start with a new draft.
21 register struct msgs *mp;
22 static char buffer[BUFSIZ];
25 folder = getcpy(toabsdir(draftfolder));
26 create_folder(folder, 0, done);
27 if (!(mp = folder_read(folder))) {
28 adios(NULL, "unable to read folder %s", folder);
33 ** Make sure we have enough message status space for all
34 ** the message numbers from 1 to one beyond last, since we might
35 ** select an empty slot. If we add more space at the
36 ** end, go ahead and add 10 additional slots.
38 if (mp->hghmsg >= mp->hghoff) {
39 if (!(mp = folder_realloc(mp, 1, mp->hghmsg + 10)))
40 adios(NULL, "unable to allocate folder storage");
41 } else if (mp->lowoff > 1) {
42 if (!(mp = folder_realloc(mp, 1, mp->hghoff)))
43 adios(NULL, "unable to allocate folder storage");
46 mp->msgflags |= ALLOW_BEYOND; /* allow the beyond sequence */
49 ** The draft message name to return is defined by `which'.
50 ** Usually it is seq_cur (for the current draft) or seq_beyond
51 ** (to start a new draft).
53 if (!m_convert(mp, which))
57 snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,
59 seq_setcur(mp, mp->lowsel);