aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-25 10:01:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-25 10:01:04 +0000
commit966bdae3e0ff9129ba5832f3e59b302c22371211 (patch)
treed6346d41c70c9ac6cac35ed5aca120c138b34a9f
parent104671cac3692b816ee3636b778d37d0f4dee485 (diff)
removed CR+LF to LF conversion on receiving.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@779 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.ja7
-rw-r--r--libsylph/pop.c10
-rw-r--r--libsylph/procmime.c5
-rw-r--r--libsylph/recv.c58
5 files changed, 35 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 75ea2189..4ba85787 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-11-25
+ * libsylph/pop.c
+ libsylph/recv.c: don't convert CR+LF to LF.
+ * libsylph/procmime.c: procmime_decode_content(): don't uncanonicalize
+ message/rfc822.
+
+2005-11-25
+
* src/imageview.c: size_allocate_cb(): don't update image view if
image_data doesn't exist.
* src/mimeview.c: mimeview_change_view_type(): clear hidden view.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 37b9e29b..a14876e2 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,12 @@
2005-11-25
+ * libsylph/pop.c
+ libsylph/recv.c: CR+LF を LF に変換しないようにした。
+ * libsylph/procmime.c: procmime_decode_content(): message/rfc822 を
+ 正規化解除しないようにした。
+
+2005-11-25
+
* src/imageview.c: size_allocate_cb(): image_data が存在しなければ
イメージビューを更新しないようにした。
* src/mimeview.c: mimeview_change_view_type(): 隠したビューをクリア
diff --git a/libsylph/pop.c b/libsylph/pop.c
index b61eb377..ec703191 100644
--- a/libsylph/pop.c
+++ b/libsylph/pop.c
@@ -549,15 +549,9 @@ static gint pop3_write_msg_to_file(const gchar *file, FILE *src_fp, guint len)
gint len;
len = strlen(buf);
- if (len > 0) {
+ if (len > 0)
last_ch = buf[len - 1];
- if (last_ch == '\n' && len > 1 &&
- buf[len - 2] == '\r') {
- buf[len - 2] = '\n';
- buf[len - 1] = '\0';
- } else if (last_ch == '\r')
- buf[len - 1] = '\0';
- } else
+ else
last_ch = '\0';
if ((last_ch == '\0' || last_ch == '\n') &&
diff --git a/libsylph/procmime.c b/libsylph/procmime.c
index 91500972..daca09ae 100644
--- a/libsylph/procmime.c
+++ b/libsylph/procmime.c
@@ -573,15 +573,14 @@ FILE *procmime_decode_content(FILE *outfp, FILE *infp, MimeInfo *mimeinfo)
gchar outbuf[BUFFSIZE];
gint len;
Base64Decoder *decoder;
- gboolean uncanonicalize = FALSE;
FILE *tmpfp = outfp;
#ifndef G_OS_WIN32
+ gboolean uncanonicalize = FALSE;
ContentType content_type;
content_type = procmime_scan_mime_type(mimeinfo->content_type);
if (content_type == MIME_TEXT ||
- content_type == MIME_TEXT_HTML ||
- content_type == MIME_MESSAGE_RFC822) {
+ content_type == MIME_TEXT_HTML) {
uncanonicalize = TRUE;
tmpfp = my_tmpfile();
if (!tmpfp) {
diff --git a/libsylph/recv.c b/libsylph/recv.c
index 3d2a7968..55890df5 100644
--- a/libsylph/recv.c
+++ b/libsylph/recv.c
@@ -130,6 +130,7 @@ gint recv_write(SockInfo *sock, FILE *fp)
gint len;
gint count = 0;
gint bytes = 0;
+ gchar *p;
GTimeVal tv_prev, tv_cur;
g_get_current_time(&tv_prev);
@@ -164,19 +165,13 @@ gint recv_write(SockInfo *sock, FILE *fp)
}
}
- if (len > 1 && buf[len - 1] == '\n' && buf[len - 2] == '\r') {
- buf[len - 2] = '\n';
- buf[len - 1] = '\0';
- len--;
- }
-
+ p = buf;
if (buf[0] == '.' && buf[1] == '.')
- memmove(buf, buf + 1, len--);
-
- if (!strncmp(buf, ">From ", 6))
- memmove(buf, buf + 1, len--);
+ p++;
+ else if (!strncmp(buf, ">From ", 6))
+ p++;
- if (fp && fputs(buf, fp) == EOF) {
+ if (fp && fputs(p, fp) == EOF) {
perror("fputs");
g_warning(_("Can't write to file.\n"));
fp = NULL;
@@ -190,46 +185,27 @@ gint recv_write(SockInfo *sock, FILE *fp)
gint recv_bytes_write(SockInfo *sock, glong size, FILE *fp)
{
- gchar *buf;
- gchar *prev, *cur;
+ gchar buf[BUFFSIZE];
+ glong count = 0;
if (size == 0)
return 0;
- buf = recv_bytes(sock, size);
- if (!buf)
- return -2;
-
- /* +------------------+----------------+--------------------------+ *
- * ^buf ^prev ^cur buf+size-1^ */
+ do {
+ gint read_count, to_read;
- prev = buf;
- while ((cur = memchr(prev, '\r', size - (prev - buf))) != NULL) {
- if (cur == buf + size - 1) break;
+ to_read = MIN(sizeof(buf), size - count);
+ read_count = sock_read(sock, buf, to_read);
+ if (read_count <= 0)
+ return -2;
- if (fp && (fwrite(prev, sizeof(gchar), cur - prev, fp) == EOF ||
- fwrite("\n", sizeof(gchar), 1, fp) == EOF)) {
+ if (fp && fwrite(buf, read_count, 1, fp) < 1) {
perror("fwrite");
g_warning(_("Can't write to file.\n"));
fp = NULL;
}
-
- if (*(cur + 1) == '\n')
- prev = cur + 2;
- else
- prev = cur + 1;
-
- if (prev - buf >= size) break;
- }
-
- if (prev - buf < size && fp &&
- fwrite(buf, sizeof(gchar), size - (prev - buf), fp) == EOF) {
- perror("fwrite");
- g_warning(_("Can't write to file.\n"));
- fp = NULL;
- }
-
- g_free(buf);
+ count += read_count;
+ } while (count < size);
if (!fp) return -1;