X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fm_draft.c;h=77ea394ae4856d9268776fb52e65b81d32d0b00a;hb=a3ba584be2a9daf451bbe3c488d73703d14e8d53;hp=845fb9618c878f6bd987e3b940f5776bd2840dfb;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;p=mmh diff --git a/sbr/m_draft.c b/sbr/m_draft.c index 845fb96..77ea394 100644 --- a/sbr/m_draft.c +++ b/sbr/m_draft.c @@ -18,25 +18,15 @@ char * m_draft(char *which) { - register char *cp; register struct msgs *mp; static char buffer[BUFSIZ]; char *folder; - cp = draftfolder; - folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp, - *cp != '@' ? TFOLDER : TSUBCWF); - - chdir (m_maildir ("")); - strncpy (buffer, m_maildir (folder), sizeof(buffer)); - - create_folder (buffer, 0, done); - - if (chdir (buffer) == -1) - adios (buffer, "unable to change directory to"); - - if (!(mp = folder_read (folder))) - adios (NULL, "unable to read folder %s", folder); + folder = getcpy(toabsdir(draftfolder)); + create_folder(folder, 0, done); + if (!(mp = folder_read(folder))) { + adios(NULL, "unable to read folder %s", folder); + } /* ** Make sure we have enough message status space for all @@ -45,11 +35,11 @@ m_draft(char *which) ** end, go ahead and add 10 additional slots. */ if (mp->hghmsg >= mp->hghoff) { - if (!(mp = folder_realloc (mp, 1, mp->hghmsg + 10))) - adios (NULL, "unable to allocate folder storage"); + if (!(mp = folder_realloc(mp, 1, mp->hghmsg + 10))) + adios(NULL, "unable to allocate folder storage"); } else if (mp->lowoff > 1) { - if (!(mp = folder_realloc (mp, 1, mp->hghoff))) - adios (NULL, "unable to allocate folder storage"); + if (!(mp = folder_realloc(mp, 1, mp->hghoff))) + adios(NULL, "unable to allocate folder storage"); } mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */ @@ -59,15 +49,15 @@ m_draft(char *which) ** Usually it is "cur" (for the current draft) or "new" ** (to start a new draft). */ - if (!m_convert (mp, which)) - done (1); - seq_setprev (mp); - - snprintf (buffer, sizeof(buffer), "%s/%s", mp->foldpath, - m_name (mp->lowsel)); - seq_setcur (mp, mp->lowsel); - seq_save (mp); - folder_free (mp); + if (!m_convert(mp, which)) + done(1); + seq_setprev(mp); + + snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath, + m_name(mp->lowsel)); + seq_setcur(mp, mp->lowsel); + seq_save(mp); + folder_free(mp); return buffer; }