X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fm_draft.c;h=3659ff3d498e3934823f8e872ff6c9264f7f6b7f;hp=39203157ffdbcff9b1b0f60268aa5a121ceeded5;hb=4c0c2fb7766546cb466f05f76e5febd5d8f682e0;hpb=714b5c530ece27ea2835a313013f5b770163403c diff --git a/sbr/m_draft.c b/sbr/m_draft.c index 3920315..3659ff3 100644 --- a/sbr/m_draft.c +++ b/sbr/m_draft.c @@ -12,35 +12,26 @@ /* -** `which' should either be "cur" to use the current draft -** or "new" to start with a new draft. +** `which' should either be the cur sequence to use the current draft +** or the beyond sequence to start with a new draft. */ 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))) + folder = getcpy(toabsdir(draftfolder)); + create_folder(folder, 0, done); + if (!(mp = folder_read(folder))) { adios(NULL, "unable to read folder %s", folder); + } + free(folder); /* ** Make sure we have enough message status space for all - ** the message numbers from 1 to "new", since we might + ** the message numbers from 1 to one beyond last, since we might ** select an empty slot. If we add more space at the ** end, go ahead and add 10 additional slots. */ @@ -52,11 +43,11 @@ m_draft(char *which) adios(NULL, "unable to allocate folder storage"); } - mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */ + mp->msgflags |= ALLOW_BEYOND; /* allow the beyond sequence */ /* ** The draft message name to return is defined by `which'. - ** Usually it is "cur" (for the current draft) or "new" + ** Usually it is seq_cur (for the current draft) or seq_beyond ** (to start a new draft). */ if (!m_convert(mp, which))