Hello, nice to hear from you again!

[email protected] (Dirk-Wilhelm Peters) wrote:
 |if a new mail contains only 7bit ASCII-characters, it is always sent
 |in 7bit transfer mode according to the man page. This also happens if
 |a signature is appended, even if the signature contains 8-bit characters
 |in the current tty encoding. This causes problems when replying to this
 |quoted message at a later time.

Yes, looking into that again there was a long standing ([6f633dc],
2013-02-09) TODO note stating that the signature needs to be
embedded into the body!  Oh, it is ever so surprising how long
that piece of cake takes!  (A negative surprise, that is.)
Good that you brought that back onto the table now!

 |For example:
 |
 |The message contains plain text (7bit), ttycharset is set to
 |"ISO-8859-1", and the signature contains 8bit characters in ISO-8859-1,
 |e.g., umlauts.
 |The message sends fine & is displayed correctly in s-nail.

Only by accident, can only be by accident.

 |If I reply to this same message, the newly appended signature is
 |broken: The message is send as UTF-8 because of the quoted old signature,
 |but the newly appended signature is not converted.
 |
 |Maybe this is a misconfiguration on my side, but I have not figured out
 |how to solve this.

Oh no, unfortunately not.

 |Tested with s-nail 14.8.6.

The attached diff should result in the desired behaviour, to be
applied onto v14.8.6 via

  ? | MESSAGE-NUMBER 'cd YOUR-NAIL-DIR && patch -p1'

from within S-nail itself.
Thanks, the change will be in v14.9.
Ciao!

--steffen
diff --git a/collect.c b/collect.c
index a7862cd..4153251 100644
--- a/collect.c
+++ b/collect.c
@@ -761,8 +761,6 @@ jcont:
          if ((size_t)cnt != fwrite(linebuf, sizeof *linebuf, cnt, _coll_fp))
             goto jerr;
       }
-      if (fflush(_coll_fp))
-         goto jerr;
       goto jout;
    }
 
@@ -1029,15 +1027,58 @@ jputline:
    }
 
 jout:
-   if (_coll_fp != NULL) {
-      if ((cp = ok_vlook(NAIL_TAIL)) != NULL) {
-         if (putesc(cp, _coll_fp) < 0)
+   /* Place signature? */
+   if((cp = ok_vlook(signature)) != NULL && *cp != '\0'){
+      FILE *fp;
+      size_t i;
+
+      if((quote = file_expand(cp)) == NULL){
+         n_err(_("*signature* expands to invalid file: \"%s\"\n"), cp);
+         goto jerr;
+      }
+
+      if((fp = Fopen(cp = quote, "r")) == NULL){
+         n_err(_("Can't open *signature* \"%s\": %s\n"), cp, strerror(errno));
+         goto jerr;
+      }
+
+      if(linebuf == NULL)
+         linebuf = smalloc(linesize = LINESIZE);
+      c = '\0';
+
+      while((i = fread(linebuf, sizeof *linebuf, linesize, fp)) > 0){
+         c = linebuf[i - 1];
+         if(i != fwrite(linebuf, sizeof *linebuf, i, _coll_fp))
             goto jerr;
-         if ((options & OPT_INTERACTIVE) && putesc(cp, stdout) < 0)
+      }
+
+      {  int e = errno, ise = ferror(fp);
+
+         Fclose(fp);
+
+         if(ise){
+            n_err(_("Errors while reading *signature* \"%s\": %s\n"),
+               cp, strerror(e));
             goto jerr;
+         }
       }
-      rewind(_coll_fp);
+
+      if(c != '\0' && c != '\n')
+         putc('\n', _coll_fp);
+   }
+
+   if(fflush(_coll_fp))
+      goto jerr;
+
+   if ((cp = ok_vlook(NAIL_TAIL)) != NULL) {
+      if (putesc(cp, _coll_fp) < 0)
+         goto jerr;
+      if ((options & OPT_INTERACTIVE) && putesc(cp, stdout) < 0)
+         goto jerr;
    }
+   rewind(_coll_fp);
+
+jleave:
    if (linebuf != NULL)
       free(linebuf);
    handlerpop();
@@ -1060,7 +1101,7 @@ jerr:
       Fclose(_coll_fp);
       _coll_fp = NULL;
    }
-   goto jout;
+   goto jleave;
 }
 
 FL void
diff --git a/sendout.c b/sendout.c
index f7f09ba..fd1ba38 100644
--- a/sendout.c
+++ b/sendout.c
@@ -75,9 +75,6 @@ static int           __attach_file(struct attachment *ap, FILE *fo);
 static bool_t        _sendbundle_setup_creds(struct sendbundle *sbpm,
                         bool_t signing_caps);
 
-/* Put the signature file at fo. TODO layer rewrite: *integrate in body*!! */
-static int           put_signature(FILE *fo, int convert);
-
 /* Attach a message to the file buffer */
 static int           attach_message(struct attachment *ap, FILE *fo);
 
@@ -476,49 +473,6 @@ jleave:
 }
 
 static int
-put_signature(FILE *fo, int convert)
-{
-   char buf[SEND_LINESIZE], *sig, c = '\n';
-   FILE *fsig;
-   size_t sz;
-   int rv;
-   NYD_ENTER;
-
-   if ((sig = ok_vlook(signature)) == NULL || *sig == '\0') {
-      rv = 0;
-      goto jleave;
-   }
-   rv = -1;
-
-   if ((sig = file_expand(sig)) == NULL)
-      goto jleave;
-
-   if ((fsig = Fopen(sig, "r")) == NULL) {
-      n_perr(sig, 0);
-      goto jleave;
-   }
-   while ((sz = fread(buf, sizeof *buf, SEND_LINESIZE, fsig)) != 0) {
-      c = buf[sz - 1];
-      if (xmime_write(buf, sz, fo, convert, TD_NONE) < 0)
-         goto jerr;
-   }
-   if (ferror(fsig)) {
-jerr:
-      n_perr(sig, 0);
-      Fclose(fsig);
-      goto jleave;
-   }
-   Fclose(fsig);
-   if (c != '\n')
-      putc('\n', fo);
-
-   rv = 0;
-jleave:
-   NYD_LEAVE;
-   return rv;
-}
-
-static int
 attach_message(struct attachment *ap, FILE *fo)
 {
    struct message *mp;
@@ -587,8 +541,6 @@ make_multipart(struct header *hp, int convert, FILE *fi, FILE *fo,
 
       if (ferror(fi))
          goto jleave;
-      if (charset != NULL)
-         put_signature(fo, convert);
    }
 
    for (att = hp->h_attach; att != NULL; att = att->a_flink) {
@@ -717,8 +669,6 @@ jerr:
          nfi = NULL;
          goto jleave;
       }
-      if (charset != NULL)
-         put_signature(nfo, convert); /* XXX if (text/) !! */
    }
 
 #ifdef HAVE_ICONV
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
S-nail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s-nail-users

Reply via email to