Hello, dear Stephen.

"Stephen Isard" <ksaexz5...@snkmail.com> wrote:
 |On Wed, 5 Oct 2016, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |> hereby i announce S-nail v14.8.12, the «Bubas».

 |Sorry to report that it still doesn't work for my problem imap server.

I'm afraid it does so as good as it can.

 |This is a linux machine where the inbox is at /var/spool/mail/username 
 |and the mail folders are in the user's own file space at ~/Mail.
 |The account definition includes the line:
 |set folder=imaps://username@servername/Mail/
 |Mailx copes with this by making username@servername/Mail the folder 
 |directory, and replacing the trailing Mail/ by INBOX for the inbox. 
 |s-nail-14.8.12 is failing to strip off Mail/ and I am getting the error 
 |message
 |IMAP error: Mailbox doesn't exist: Mail/INBOX

^.^  Now i get it a bit.
Yes, it seems there is a need to create an "INBOX" to be able to
use /Mail in *folder* for the purpose of accessing things via +.
That is the hack that makes this work, ensure a trailing slash in
*folder* to force "INBOX" to be appended.  And recognizing the
condition that *folder* is actually, well, a folder.

But it is true, given your plenty of StephenCare and Ralph's two
and a quarter Hinkleys i thought implicitly being "a folder" isn't
the worst for *folder*.  That should also work fine, i think.
(Late, but still.)  On [stable/{latest,stable,v14.8}] and attached.

And i'm still thinking about how to overcome that special
treatment of *folder* for IMAP and IMAP only.  If i can
reinstantiate IMAP for v14.9 i think that is all gone and you have
to set *inbox* or whatever in addition.  No more automatic
connection, then, unless *folder* is IMAP and *inbox* points into
it.  Or something?  How do the others do it.  More so, what do we
want?  I think that *folder* / *inbox* should be it, with *inbox*
defaulting to $MAIL, on a per-`account' base.  ..Think so..

Ciao!

--steffen
CommitDate: 2016-10-06 15:19:52 +0200

    Simplify *folder* (implicit trail solidus) (Stephen Isard, Ralph Corderoy)
---
 fio.c  | 22 ++++++++--------------
 imap.c |  7 ++++---
 lex.c  |  2 --
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/fio.c b/fio.c
index 4471355..6761ca7 100644
--- a/fio.c
+++ b/fio.c
@@ -1327,19 +1327,7 @@ jnext:
    }
 
    if (res[0] == '+' && getfold(cbuf, sizeof cbuf)) {
-      size_t i;
-      bool_t soll;
-
-      i = strlen(cbuf);
-      soll = (i > 0 && cbuf[i - 1] == '/');
-      if(which_protocol(cbuf) == PROTO_IMAP){
-         bool_t hpath;
-
-         hpath = (strcmp(cbuf, protbase(cbuf)) != 0);
-         res = str_concat_csvl(&s, cbuf, (hpath || soll ? "" : "/"),
-               &res[1], NULL)->s;
-      }else
-         res = str_concat_csvl(&s, cbuf, (soll ? "" : "/"), &res[1], NULL)->s;
+      res = str_concat_csvl(&s, cbuf, &res[1], NULL)->s;
       dyn = TRU1;
 
       if (res[0] == '%' && res[1] == ':') {
@@ -1483,8 +1471,14 @@ getfold(char *name, size_t size)
    char const *folder;
    NYD_ENTER;
 
-   if ((folder = ok_vlook(folder)) != NULL)
+   if ((folder = ok_vlook(folder)) != NULL){
+      size_t i;
+
+      i = strlen(folder);
+      if(i > 0 && folder[i - 1] != '/')
+         folder = savecat(folder, "/");
       n_strlcpy(name, folder, size);
+   }
    NYD_LEAVE;
    return (folder != NULL);
 }
diff --git a/imap.c b/imap.c
index 9329bb5..5678f3c 100644
--- a/imap.c
+++ b/imap.c
@@ -1320,8 +1320,8 @@ jduppass:
    mb.mb_perm = (fm & FEDIT_RDONLY) ? 0 : MB_DELE;
    mb.mb_type = MB_IMAP;
    cache_dequeue(&mb);
-   if (imap_select(&mb, &mailsize, &msgCount,
-         (urlp->url_path.s != NULL ? urlp->url_path.s : "INBOX"), fm) != OKAY) {
+   assert(urlp->url_path.s != NULL);
+   if (imap_select(&mb, &mailsize, &msgCount, urlp->url_path.s, fm) != OKAY) {
       /*sclose(&mb.mb_sock);
       imap_timer_off();*/
       safe_signal(SIGINT, saveint);
@@ -2477,10 +2477,11 @@ imap_append(const char *xserver, FILE *fp)
 
    if (!url_parse(&url, CPROTO_IMAP, xserver))
       goto j_leave;
+   assert(url.url_path.s != NULL);
    if (!ok_blook(v15_compat) &&
          (!url.url_had_user || url.url_pass.s != NULL))
       n_err(_("New-style URL used without *v15-compat* being set!\n"));
-   mbx = (url.url_path.s != NULL) ? url.url_path.s : "INBOX";
+   mbx = url.url_path.s;
 
    imaplock = 1;
    if ((saveint = safe_signal(SIGINT, SIG_IGN)) != SIG_IGN)
diff --git a/lex.c b/lex.c
index bb72fe5..8a63923 100644
--- a/lex.c
+++ b/lex.c
@@ -168,8 +168,6 @@ jdocopy:
    /* Don't display an absolute path but "+FOLDER" if under *folder* */
    if (getfold(tbuf, sizeof tbuf)) {
       i = strlen(tbuf);
-      if (i < sizeof(tbuf) -1)
-         tbuf[i++] = '/';
       if (!strncmp(tbuf, mailp, i)) {
          mailp += i;
          *dispp++ = '+';
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
__________________________________
S-nail-users@lists.sourceforge.net

Reply via email to