X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fm_draft.c;h=e97dd1e851a3af0062292d3685e38639aa2d48c7;hp=df767ef240058db5ab39666ac6ca8ad98d254391;hb=fa591538beda05e6ce89323128705beabe4f543f;hpb=8041c8a4001e576d7600efaaf6628a791263490d diff --git a/sbr/m_draft.c b/sbr/m_draft.c index df767ef..e97dd1e 100644 --- a/sbr/m_draft.c +++ b/sbr/m_draft.c @@ -12,8 +12,8 @@ /* -** `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) @@ -22,22 +22,16 @@ m_draft(char *which) static char buffer[BUFSIZ]; char *folder; - folder = pluspath(draftfolder); - - 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, exit); + 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. */ @@ -49,15 +43,15 @@ 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)) - done(1); + exit(1); seq_setprev(mp); snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,