diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | libsylph/utils.c | 39 | ||||
-rw-r--r-- | libsylph/utils.h | 1 | ||||
-rw-r--r-- | src/compose.c | 8 |
5 files changed, 61 insertions, 1 deletions
@@ -1,5 +1,12 @@ 2006-09-19 + * libsylph/utils.[ch] + src/compose.c: compose_write_to_file(): chomp all trailing spaces + when signing with PGP/MIME instead of using quoted-printable for + compatibility with other MUAs. + +2006-09-19 + * src/compose.c: compose_write_to_file(): check Bcc recipients before encryption. diff --git a/ChangeLog.ja b/ChangeLog.ja index aa056da6..2d8d2f98 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2006-09-19 + * libsylph/utils.[ch] + src/compose.c: compose_write_to_file(): 他 MUA との互換性のため、 + PGP/MIME で署名する場合は quoted-printable の代わりに行末の空白を + 除去するようにした。 + +2006-09-19 + * src/compose.c: compose_write_to_file(): 暗号化の前に Bcc の宛先を チェックするようにした。 diff --git a/libsylph/utils.c b/libsylph/utils.c index 525c9a1b..9992de51 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -2920,6 +2920,45 @@ gchar *normalize_newlines(const gchar *str) return out; } +gchar *strchomp_all(const gchar *str) +{ + const gchar *p = str; + const gchar *newline, *last; + gchar *out, *outp; + + out = outp = g_malloc(strlen(str) + 1); + while (*p != '\0') { + newline = strchr(p, '\n'); + if (newline) { + for (last = newline; + p < last && g_ascii_isspace(*(last - 1)); --last) + ; + strncpy(outp, p, last - p); + outp += last - p; + + if (p < newline && *(newline - 1) == '\r') { + strncpy(outp, newline - 1, 2); + outp += 2; + } else { + *outp++ = *newline; + } + + p = newline + 1; + } else { + for (last = p + strlen(p); + p < last && g_ascii_isspace(*(last - 1)); --last) + ; + strncpy(outp, p, last - p); + outp += last - p; + break; + } + } + + *outp = '\0'; + + return out; +} + FILE *get_outgoing_rfc2822_file(FILE *fp) { gchar buf[BUFFSIZE]; diff --git a/libsylph/utils.h b/libsylph/utils.h index b8fe7051..1f358ca1 100644 --- a/libsylph/utils.h +++ b/libsylph/utils.h @@ -431,6 +431,7 @@ gint uncanonicalize_file (const gchar *src, gint uncanonicalize_file_replace(const gchar *file); gchar *normalize_newlines (const gchar *str); +gchar *strchomp_all (const gchar *str); FILE *get_outgoing_rfc2822_file (FILE *fp); gchar *get_outgoing_rfc2822_str (FILE *fp); diff --git a/src/compose.c b/src/compose.c index a3ca459e..78cd461d 100644 --- a/src/compose.c +++ b/src/compose.c @@ -2976,13 +2976,19 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, buf = canon_buf; #if USE_GPGME - /* force encoding to protect trailing spaces */ + /* chomp all trailing spaces */ if (rfc2015_is_available() && !is_draft && compose->use_signing && !compose->account->clearsign) { + gchar *tmp; + tmp = strchomp_all(buf); + g_free(buf); + buf = tmp; +#if 0 if (encoding == ENC_7BIT) encoding = ENC_QUOTED_PRINTABLE; else if (encoding == ENC_8BIT) encoding = ENC_BASE64; +#endif } if (rfc2015_is_available() && !is_draft && |