+2003-01-17
+
+ * src/quoted-printable.c: qp_encode_line(): fixed linebreak
+ duplication bug if the source string has CRLF.
+ * src/utils.[ch]:
+ canonicalize_str(): new. Returns newly allocated canonicalized
+ string.
+ uncanonicalize_file(): new. Uncanonicalize (CRLF -> LF) text.
+ uncanonicalize_file_replace(): new.
+ * src/compose.c: always canonicalize body before processing, and
+ uncanonicalize before returning.
+
+2003-01-17
+
+ * src/procmime.c: procmime_get_encoding_for_charset(): prefer
+ ENC_8BIT for Russian charsets.
+ * src/compose.c: compose_write_to_file(): use base64 when signing
+ 8bit message.
+
2003-01-16
* src/prefs_common.c: prefs_send_create(): added a description for
+2003-01-17 [paul] 0.8.8claws108
+
+ * sync with 0.8.8cvs11
+ see ChangeLog 2003-01-17
+
2003-01-16 [colin] 0.8.8claws107
* src/procmsg.c
+2003-01-17
+
+ * src/quoted-printable.c: qp_encode_line(): ¸µ¤Îʸ»úÎó¤Ë CRLF ¤¬
+ ¤¢¤Ã¤¿¾ì¹ç¤Ë²þ¹Ô¤¬½ÅÊ£¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+ * src/utils.[ch]
+ canonicalize_str(): ¿·µ¬¡£¿·µ¬¤Ë³ÎÊݤµ¤ì¤¿Àµµ¬²½¤µ¤ì¤¿Ê¸»úÎó¤ò
+ ÊÖ¤¹¡£
+ uncanonicalize_file(): ¿·µ¬¡£Àµµ¬²½¤ò²ò½ü¤¹¤ë(CRLF -> LF)¡£
+ uncanonicalize_file_replace(): ¿·µ¬¡£
+ * src/compose.c: ½èÍý¤ÎÁ°¤Ë¾ï¤ËËÜʸ¤òÀµµ¬²½¤·¡¢Ìá¤ëÁ°¤ËÀµµ¬²½¤ò
+ ²ò½ü¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2003-01-17
+
+ * src/procmime.c: procmime_get_encoding_for_charset(): ¥í¥·¥¢¸ì
+ charset ¤Î¾ì¹ç¤Ï ENC_8BIT ¤òÁª¤Ö¤è¤¦¤Ë¤·¤¿¡£
+ * src/compose.c: compose_write_to_file(): 8bit ¥á¥Ã¥»¡¼¥¸¤ò½ð̾¤¹¤ë
+ ¾ì¹ç¤Ï base64 ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
2003-01-16
* src/prefs_common.c: prefs_send_create(): Content-Transfer-Encoding
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws107
+EXTRA_VERSION=claws108
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
if (IS_LBREAK(inp)) {
*outp++ = '\n';
len = 0;
+ if (*inp == '\r')
+ inp++;
inp++;
} else if (ch == '\t' || ch == ' ') {
if (IS_LBREAK(inp + 1)) {
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* convert line endings into CRLF. If the last line doesn't end with
* linebreak, add it.
*/
+gchar *canonicalize_str(const gchar *str)
+{
+ const gchar *p;
+ guint new_len = 0;
+ gchar *out, *outp;
+
+ for (p = str; *p != '\0'; ++p) {
+ if (*p != '\r') {
+ ++new_len;
+ if (*p == '\n')
+ ++new_len;
+ }
+ }
+ if (p == str || *(p - 1) != '\n')
+ new_len += 2;
+
+ out = outp = g_malloc(new_len + 1);
+ for (p = str; *p != '\0'; ++p) {
+ if (*p != '\r') {
+ if (*p == '\n')
+ *outp++ = '\r';
+ *outp++ = *p;
+ }
+ }
+ if (p == str || *(p - 1) != '\n') {
+ *outp++ = '\r';
+ *outp++ = '\n';
+ }
+ *outp = '\0';
+
+ return out;
+}
+
gint canonicalize_file(const gchar *src, const gchar *dest)
{
FILE *src_fp, *dest_fp;
}
if (ferror(src_fp)) {
- FILE_OP_ERROR(src, "fread");
+ FILE_OP_ERROR(src, "fgets");
err = TRUE;
}
fclose(src_fp);
return 0;
}
+gint uncanonicalize_file(const gchar *src, const gchar *dest)
+{
+ FILE *src_fp, *dest_fp;
+ gchar buf[BUFFSIZE];
+ gboolean err = FALSE;
+
+ if ((src_fp = fopen(src, "rb")) == NULL) {
+ FILE_OP_ERROR(src, "fopen");
+ return -1;
+ }
+
+ if ((dest_fp = fopen(dest, "wb")) == NULL) {
+ FILE_OP_ERROR(dest, "fopen");
+ fclose(src_fp);
+ return -1;
+ }
+
+ if (change_file_mode_rw(dest_fp, dest) < 0) {
+ FILE_OP_ERROR(dest, "chmod");
+ g_warning("can't change file mode\n");
+ }
+
+ while (fgets(buf, sizeof(buf), src_fp) != NULL) {
+ strcrchomp(buf);
+ if (fputs(buf, dest_fp) == EOF) {
+ g_warning("writing to %s failed.\n", dest);
+ fclose(dest_fp);
+ fclose(src_fp);
+ unlink(dest);
+ return -1;
+ }
+ }
+
+ if (ferror(src_fp)) {
+ FILE_OP_ERROR(src, "fgets");
+ err = TRUE;
+ }
+ fclose(src_fp);
+ if (fclose(dest_fp) == EOF) {
+ FILE_OP_ERROR(dest, "fclose");
+ err = TRUE;
+ }
+
+ if (err) {
+ unlink(dest);
+ return -1;
+ }
+
+ return 0;
+}
+
+gint uncanonicalize_file_replace(const gchar *file)
+{
+ gchar *tmp_file;
+
+ tmp_file = get_tmp_file();
+
+ if (uncanonicalize_file(file, tmp_file) < 0) {
+ g_free(tmp_file);
+ return -1;
+ }
+
+ if (move_file(tmp_file, file, TRUE) < 0) {
+ g_warning("can't replace %s .\n", file);
+ unlink(tmp_file);
+ g_free(tmp_file);
+ return -1;
+ }
+
+ g_free(tmp_file);
+ return 0;
+}
+
gint change_file_mode_rw(FILE *fp, const gchar *file)
{
#if HAVE_FCHMOD
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
off_t offset,
size_t length,
const gchar *dest);
+
+gchar *canonicalize_str (const gchar *str);
gint canonicalize_file (const gchar *src,
const gchar *dest);
gint canonicalize_file_replace (const gchar *file);
+gint uncanonicalize_file (const gchar *src,
+ const gchar *dest);
+gint uncanonicalize_file_replace(const gchar *file);
+
gint change_file_mode_rw (FILE *fp,
const gchar *file);
FILE *my_tmpfile (void);
return -1;
}
- if (canonicalize_file_replace(tmp_file) < 0 ||
- compose_create_signers_list(compose, &key_list) < 0 ||
+ if (compose_create_signers_list(compose, &key_list) < 0 ||
rfc2015_clearsign(tmp_file, key_list) < 0) {
unlink(tmp_file);
g_free(tmp_file);
size_t len;
gchar *chars;
gchar *buf;
+ gchar *canon_buf;
const gchar *out_codeset;
EncodingType encoding;
if (!is_draft &&
compose->use_signing && !compose->gnupg_mode &&
encoding == ENC_8BIT)
- encoding = ENC_QUOTED_PRINTABLE;
+ encoding = ENC_BASE64;
#endif
src_codeset = conv_get_current_charset_str();
}
g_free(chars);
- /* Canonicalize line endings in the message text */
- {
- gchar *canon_buf, *out;
- const gchar *p;
- guint new_len = 0;
-
- for (p = buf ; *p; ++p) {
- if (*p != '\r') {
- ++new_len;
- if (*p == '\n')
- ++new_len;
- }
- }
-
- out = canon_buf = g_new(gchar, new_len + 1);
- for (p = buf; *p; ++p) {
- if (*p != '\r') {
- if (*p == '\n')
- *out++ = '\r';
- *out++ = *p;
- }
- }
- *out = '\0';
-
- free(buf);
- buf = canon_buf;
- }
+ canon_buf = canonicalize_str(buf);
+ g_free(buf);
+ buf = canon_buf;
#if USE_GPGME
if (!is_draft && compose->use_signing && compose->gnupg_mode) {
}
#if USE_GPGME
- if (is_draft)
+ if (is_draft) {
+ uncanonicalize_file_replace(file);
return 0;
+ }
if ((compose->use_signing && !compose->gnupg_mode) ||
compose->use_encryption) {
}
#endif /* USE_GPGME */
+ uncanonicalize_file_replace(file);
+
return 0;
}
else if (!strcasecmp(charset, "ISO-8859-5") ||
!strncasecmp(charset, "KOI8-", 5) ||
!strcasecmp(charset, "Windows-1251"))
- return ENC_BASE64;
+ return ENC_8BIT;
else if (!strncasecmp(charset, "ISO-8859-", 9))
return ENC_QUOTED_PRINTABLE;
else
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by