+2003-01-15
+
+ * src/quoted-printable.[ch]: qp_encode_line(): fixed a bug if the
+ line doesn't end with linebreak.
+
+2003-01-15
+
+ * implemented quoted-printable encoding.
+ * src/quoted-printable.[ch]: qp_encode_line(): new.
+ * src/compose.c:
+ compose_write_to_file()
+ compose_write_attach(): implemented quoted-printable encoding.
+ compose_attach_property_create(): enabled quoted-printable menu
+ item.
+ * src/procmime.c: procmime_get_encoding_for_charset(): return
+ ENC_QUOTED_PRINTABLE for ISO-8859-* and CP125* charset.
+ * src/Makefile.am: added $(LIBICONV) to sylpheed_LDADD for libiconv
+ support.
+
2003-01-14
* src/folderview.c
+2003-01-15 [paul] 0.8.8claws102
+
+ * sync with 0.8.8cvs8
+ see ChangeLog 2002-01-15
+
2003-01-15 [colin] 0.8.8claws101
* src/Makefile.am
+2003-01-15
+
+ * src/quoted-printable.[ch]: qp_encode_line(): ¹Ô¤¬²þ¹Ô¤Ç½ª¤ï¤é¤Ê¤¤
+ ¾ì¹ç¤Î¥Ð¥°¤ò½¤Àµ¡£
+
+2003-01-15
+
+ * quoted-printable Éä¹æ²½¤ò¼ÂÁõ¡£
+ * src/quoted-printable.[ch]: qp_encode_line(): ¿·µ¬¡£
+ * src/compose.c:
+ compose_write_to_file()
+ compose_write_attach(): quoted-printable Éä¹æ²½¤ò¼ÂÁõ¡£
+ compose_attach_property_create(): quoted-printable ¥á¥Ë¥å¡¼¹àÌܤò
+ ͸ú¤Ë¤·¤¿¡£
+ * src/procmime.c: procmime_get_encoding_for_charset(): ISO-8859-*
+ ¤È CP125* ʸ»ú¥»¥Ã¥È¤Î¾ì¹ç¤Ï ENC_QUOTED_PRINTABLE ¤òÊÖ¤¹¤è¤¦¤Ë
+ ¤·¤¿¡£
+ * src/Makefile.am: libiconv Âбþ¤Î¤¿¤á¤Ë sylpheed_LDADD ¤Ë
+ $(LIBICONV) ¤òÄɲá£
+
2003-01-14
* src/folderview.c
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws101
+EXTRA_VERSION=claws102
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
/*
* 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
static gboolean get_hex_value(guchar *out, gchar c1, gchar c2);
static void get_hex_str(gchar *out, guchar ch);
+#define MAX_LINELEN 76
+
+#define IS_LBREAK(p) \
+ (*(p) == '\0' || *(p) == '\n' || (*(p) == '\r' && *((p) + 1) == '\n'))
+
+#define SOFT_LBREAK_IF_REQUIRED(n) \
+ if (len + (n) > MAX_LINELEN || \
+ (len + (n) == MAX_LINELEN && (!IS_LBREAK(inp + 1)))) { \
+ *outp++ = '='; \
+ *outp++ = '\n'; \
+ len = 0; \
+ }
+
+void qp_encode_line(gchar *out, const guchar *in)
+{
+ const guchar *inp = in;
+ gchar *outp = out;
+ guchar ch;
+ gint len = 0;
+
+ while (*inp != '\0') {
+ ch = *inp;
+
+ if (IS_LBREAK(inp)) {
+ *outp++ = '\n';
+ len = 0;
+ inp++;
+ } else if (ch == '\t' || ch == ' ') {
+ if (IS_LBREAK(inp + 1)) {
+ SOFT_LBREAK_IF_REQUIRED(3);
+ *outp++ = '=';
+ get_hex_str(outp, ch);
+ outp += 2;
+ len += 3;
+ inp++;
+ } else {
+ SOFT_LBREAK_IF_REQUIRED(1);
+ *outp++ = *inp++;
+ len++;
+ }
+ } else if ((ch >= 33 && ch <= 60) || (ch >= 62 && ch <= 126)) {
+ SOFT_LBREAK_IF_REQUIRED(1);
+ *outp++ = *inp++;
+ len++;
+ } else {
+ SOFT_LBREAK_IF_REQUIRED(3);
+ *outp++ = '=';
+ get_hex_str(outp, ch);
+ outp += 2;
+ len += 3;
+ inp++;
+ }
+ }
+
+ if (len > 0)
+ *outp++ = '\n';
+
+ *outp = '\0';
+}
+
gint qp_decode_line(gchar *str)
{
gchar *inp = str, *outp = str;
/*
* 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
#include <glib.h>
+void qp_encode_line (gchar *out,
+ const guchar *in);
gint qp_decode_line (gchar *str);
+
gint qp_decode_q_encoding (guchar *out,
const gchar *in,
gint inlen);
#include "statusbar.h"
#include "about.h"
#include "base64.h"
+#include "quoted-printable.h"
#include "codeconv.h"
#include "utils.h"
#include "gtkutils.h"
if (!is_draft &&
compose->use_signing && !compose->gnupg_mode &&
encoding == ENC_8BIT)
- encoding = ENC_BASE64;
+ encoding = ENC_QUOTED_PRINTABLE;
#endif
src_codeset = conv_get_current_charset_str();
fputs(outbuf, fp);
fputc('\n', fp);
}
+ } else if (encoding == ENC_QUOTED_PRINTABLE) {
+ gchar *outbuf;
+ size_t outlen;
+
+ outbuf = g_malloc(len * 4);
+ qp_encode_line(outbuf, buf);
+ outlen = strlen(outbuf);
+ if (fwrite(outbuf, sizeof(gchar), outlen, fp) != outlen) {
+ FILE_OP_ERROR(file, "fwrite");
+ fclose(fp);
+ unlink(file);
+ g_free(outbuf);
+ g_free(buf);
+ return -1;
+ }
+ g_free(outbuf);
} else if (fwrite(buf, sizeof(gchar), len, fp) != len) {
FILE_OP_ERROR(file, "fwrite");
fclose(fp);
fprintf(fp, "Content-Transfer-Encoding: %s\n\n",
procmime_get_encoding_str(ainfo->encoding));
- switch (ainfo->encoding) {
-
- case ENC_7BIT:
- case ENC_8BIT:
- /* if (ainfo->encoding == ENC_7BIT) { */
-
- while (fgets(buf, sizeof(buf), attach_fp) != NULL) {
- strcrchomp(buf);
- fputs(buf, fp);
- }
- break;
- /* } else { */
- case ENC_BASE64:
+ if (ainfo->encoding == ENC_BASE64) {
+ gchar inbuf[B64_LINE_SIZE], outbuf[B64_BUFFSIZE];
while ((len = fread(inbuf, sizeof(gchar),
B64_LINE_SIZE, attach_fp))
fputs(outbuf, fp);
fputc('\n', fp);
}
- break;
- default:
- debug_print("Tried to write attachment in unsupported encoding type\n");
- break;
+ } else if (ainfo->encoding == ENC_QUOTED_PRINTABLE) {
+ gchar inbuf[BUFFSIZE], outbuf[BUFFSIZE * 4];
+
+ while (fgets(inbuf, sizeof(inbuf), attach_fp) != NULL) {
+ qp_encode_line(outbuf, inbuf);
+ fputs(outbuf, fp);
+ }
+ } else {
+ gchar buf[BUFFSIZE];
+
+ while (fgets(buf, sizeof(buf), attach_fp) != NULL) {
+ strcrchomp(buf);
+ fputs(buf, fp);
+ }
}
fclose(attach_fp);
#if 0
gtk_widget_set_sensitive(menuitem, FALSE);
#endif
- MENUITEM_ADD(optmenu_menu, menuitem, "quoted-printable", ENC_QUOTED_PRINTABLE);
- gtk_widget_set_sensitive(menuitem, FALSE);
+ MENUITEM_ADD(optmenu_menu, menuitem, "quoted-printable",
+ ENC_QUOTED_PRINTABLE);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), optmenu_menu);
+
MENUITEM_ADD(optmenu_menu, menuitem, "base64", ENC_BASE64);
gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), optmenu_menu);
/*
* 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
else if (!strncasecmp(charset, "ISO-2022-", 9) ||
!strcasecmp(charset, "US-ASCII"))
return ENC_7BIT;
+ else if (!strncasecmp(charset, "ISO-8859-", 9) ||
+ !strncasecmp(charset, "CP125", 5))
+ return ENC_QUOTED_PRINTABLE;
else
return ENC_8BIT;
- /* return ENC_BASE64; */
- /* return ENC_QUOTED_PRINTABLE; */
}
EncodingType procmime_get_encoding_for_file(const gchar *file)