sync with sylpheed 0.7.2cvs22
authorPaul Mangan <paul@claws-mail.org>
Sat, 2 Mar 2002 10:02:42 +0000 (10:02 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sat, 2 Mar 2002 10:02:42 +0000 (10:02 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/messageview.c
src/mimeview.c
src/textview.c

index fb2107ac4ad692f91f14cbf7b6f9d1d5dec5c1f8..8dfa8ba0a58e4aede0ae1756c8a2db5689d70f37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-03-01
+
+       * src/messageview.c: messageview_show(): set header state of
+         MimeView's TextView, too.
+       * src/mimeview.c: mimeview_show_message(): call
+         textview_show_message() to display message.
+       * src/textview.c: textview_add_part(): new. It adds the content
+         of message part without clearing the view.
+         textview_show_message(): display all parts with appropriate
+         style.
+         textview_write_body(): separated from textview_show_part().
+
 2002-02-28
 
        * src/mainwindow.c
          src/prefs_filter.c
          src/prefs_template.c
          src/summary_search.c
-         src/summaryview.c: use MANAGE_WINDO_SIGNALS_CONNECT() macro to
+         src/summaryview.c: use MANAGE_WINDOW_SIGNALS_CONNECT() macro to
          connect signals for window management.
 
 2002-02-21
 
        * src/alertpanel.c: alertpanel_create(): fixed truncated message.
        * src/rfc2015.c: rfc2015_decrypt_message(): fixed the case problem
-         of content-type (thanks to René Rebe for the patch).
+         of content-type (thanks to René Rebe for the patch).
        * src/codeconv.c: code_get_code_conv_func(): fixed the ISO-8859-1
          detection.
        * src/prefs_common.c: prefs_send_create(): made some more character
          src/mainwindow.c
          src/summaryview.[ch]
          src/sourcewindow.[ch]: integrated the viewing source patch from
-         DINH V. Hoà (thanks!).
+         DINH V. Hoßþ(thanks!).
 
 2001-03-10
 
index 2a5180f3a5b1164b46fe118fa88fb4cf65f9c2fc..d211c5a174e6b846182527f03f1a75cf735210f5 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-02 [paul]      0.7.2claws24
+
+       * sync with sylpheed 0.7.2cvs22
+               see ChangeLog entry 2002-03-01
+
 2002-03-01 [hoa]       0.7.2claws23
 
        * src/mainwindow.c
index 6c8aa89dc2cb704f3c5eae42260ee6cf280f3f08..dff6f083c1902ae102ed70dc1b15df268d6f0371 100644 (file)
@@ -1,3 +1,14 @@
+2002-03-01
+
+       * src/messageview.c: messageview_show(): MimeView ¤Î TextView ¤Î
+         ¥Ø¥Ã¥À¤Î¾õÂÖ¤â»ØÄꤹ¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/mimeview.c: mimeview_show_message(): ¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë¤Î¤Ë
+         textview_show_message() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+       * src/textview.c: textview_add_part(): ¿·µ¬¡£¥Ó¥å¡¼¤ò¥¯¥ê¥¢¤»¤º¤Ë
+         ¥á¥Ã¥»¡¼¥¸¥Ñ¡¼¥È¤ÎÆâÍƤòÄɲ乤롣
+         textview_show_message(): Á´¥Ñ¡¼¥È¤òŬÀڤʥ¹¥¿¥¤¥ë¤Çɽ¼¨¡£
+         textview_write_body(): textview_show_part() ¤«¤éʬΥ¡£
+
 2002-02-28
 
        * src/mainwindow.c
          src/prefs_template.c
          src/summary_search.c
          src/summaryview.c: ¥¦¥£¥ó¥É¥¦´ÉÍý¤Î¤¿¤á¤Ë¥·¥°¥Ê¥ë¤òÀܳ¤¹¤ë¤Î¤Ë
-         MANAGE_WINDO_SIGNALS_CONNECT() ¥Þ¥¯¥í¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         MANAGE_WINDOW_SIGNALS_CONNECT() ¥Þ¥¯¥í¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
 
 2002-02-21
 
index 9783441be6721be6800ddb35753c8983eedc6857..901afbd193af4d395c56b708edd7ee41963fc099 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws23
+EXTRA_VERSION=claws24
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index bf0b66e9243159dc84a6ba810fe5394c635b3eec..9e798f0b8d743c82e42322a1c5c7c76c65dd7b31 100644 (file)
@@ -416,6 +416,7 @@ void messageview_show(MessageView *messageview, MsgInfo *msginfo,
        procmsg_msginfo_free(tmpmsginfo);
 
        textview_set_all_headers(messageview->textview, all_headers);
+       textview_set_all_headers(messageview->mimeview->textview, all_headers);
 
        if (mimeinfo->mime_type != MIME_TEXT) {
                messageview_change_view_type(messageview, MVIEW_MIME);
index 850b95bced5887bca27b46d1574ea9f05a820032..de2c7bd09e34eb3815e97f511e31612f235f32e3 100644 (file)
@@ -327,17 +327,11 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
                partinfo = gtk_ctree_node_get_row_data(ctree, node);
                if (partinfo &&
                    (partinfo->mime_type == MIME_TEXT ||
-                    partinfo->mime_type == MIME_TEXT_HTML)) {
-                       if (fseek(fp, partinfo->fpos, SEEK_SET) < 0)
-                               perror("fseek");
-                       else
-                               textview_show_part
-                                       (mimeview->messageview->textview,
-                                        partinfo, fp);
+                    partinfo->mime_type == MIME_TEXT_HTML))
                        break;
-               }
        }
        fclose(fp);
+       textview_show_message(mimeview->messageview->textview, mimeinfo, file);
 
        if (!node)
                node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
index 3c6e9dd50ee51659101d482ab2ac44123fbb1da8..d2921686a65dd38790c732fc53ebe2e41054a99e 100644 (file)
@@ -92,12 +92,14 @@ static GdkColor emphasis_color = {
        (gushort)0xcfff
 };
 
+#if 0
 static GdkColor error_color = {
        (gulong)0,
        (gushort)0xefff,
        (gushort)0,
        (gushort)0
 };
+#endif
 
 static GdkFont *text_sb_font;
 static GdkFont *text_mb_font;
@@ -110,6 +112,13 @@ static GdkFont *spacingfont;
 static void textview_show_ertf         (TextView       *textview,
                                         FILE           *fp,
                                         CodeConverter  *conv);
+static void textview_add_part          (TextView       *textview,
+                                        MimeInfo       *mimeinfo,
+                                        FILE           *fp);
+static void textview_write_body                (TextView       *textview,
+                                        MimeInfo       *mimeinfo,
+                                        FILE           *fp,
+                                        CodeConverter  *conv);
 static void textview_show_html         (TextView       *textview,
                                         FILE           *fp,
                                         CodeConverter  *conv);
@@ -285,13 +294,41 @@ void textview_show_message(TextView *textview, MimeInfo *mimeinfo,
                           const gchar *file)
 {
        FILE *fp;
+       const gchar *charset = NULL;
+       GPtrArray *headers = NULL;
 
        if ((fp = fopen(file, "r")) == NULL) {
                FILE_OP_ERROR(file, "fopen");
                return;
        }
 
-       textview_show_part(textview, mimeinfo, fp);
+       if (prefs_common.force_charset)
+               charset = prefs_common.force_charset;
+       else if (mimeinfo->charset)
+               charset = mimeinfo->charset;
+       textview_set_font(textview, charset);
+       textview_clear(textview);
+       textview->body_pos = 0;
+       textview->cur_pos  = 0;
+
+       if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0) perror("fseek");
+       headers = textview_scan_header(textview, fp);
+       if (headers) {
+               textview_show_header(textview, headers);
+               procheader_header_array_destroy(headers);
+       }
+
+       while (mimeinfo != NULL) {
+               textview_add_part(textview, mimeinfo, fp);
+               if (mimeinfo->parent && mimeinfo->parent->content_type &&
+                   !strcasecmp(mimeinfo->parent->content_type,
+                               "multipart/alternative"))
+                       mimeinfo = mimeinfo->parent->next;
+               else if (mimeinfo->sub)
+                       mimeinfo = mimeinfo->next;
+               else
+                       mimeinfo = procmime_mimeinfo_next(mimeinfo);
+       }
 
        fclose(fp);
 }
@@ -303,7 +340,6 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
        const gchar *boundary = NULL;
        gint boundary_len = 0;
        const gchar *charset = NULL;
-       FILE *tmpfp;
        GPtrArray *headers = NULL;
        CodeConverter *conv;
 
@@ -325,7 +361,9 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
                boundary_len = strlen(boundary);
        }
 
-       if (!boundary && (mimeinfo->mime_type == MIME_TEXT || mimeinfo->mime_type == MIME_TEXT_HTML || mimeinfo->mime_type == MIME_TEXT_ENRICHED)) {
+       if (!boundary && (mimeinfo->mime_type == MIME_TEXT || 
+                         mimeinfo->mime_type == MIME_TEXT_HTML || 
+                         mimeinfo->mime_type == MIME_TEXT_ENRICHED)) {
        
                if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0)
                        perror("fseek");
@@ -378,8 +416,6 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
                charset = mimeinfo->charset;
        textview_set_font(textview, charset);
 
-       conv = conv_code_converter_new(charset);
-
        textview_clear(textview);
        text = GTK_STEXT(textview->text);
        gtk_stext_freeze(text);
@@ -392,29 +428,92 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
                procheader_header_array_destroy(headers);
        }
 
-/* #if 0 */
-       tmpfp = procmime_decode_content(NULL, fp, mimeinfo);
+       conv = conv_code_converter_new(charset);
+       textview_write_body(textview, mimeinfo, fp, conv);
+       conv_code_converter_destroy(conv);
 
-       if (tmpfp) {
-               if (mimeinfo->mime_type == MIME_TEXT_HTML)
-                       textview_show_html(textview, tmpfp, conv);
-               else if (mimeinfo->mime_type == MIME_TEXT_ENRICHED)
-                       textview_show_ertf(textview, tmpfp, conv);
-               else
-                       while (fgets(buf, sizeof(buf), tmpfp) != NULL)
-                               textview_write_line(textview, buf, conv);
-               fclose(tmpfp);
+       gtk_stext_thaw(text);
+}
+
+static void textview_add_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
+{
+       GtkSText *text;
+       gchar buf[BUFFSIZE];
+       const gchar *boundary = NULL;
+       gint boundary_len = 0;
+       const gchar *charset = NULL;
+       GPtrArray *headers = NULL;
+       CodeConverter *conv;
+
+       g_return_if_fail(mimeinfo != NULL);
+       g_return_if_fail(fp != NULL);
+
+       if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0) {
+               perror("fseek");
+               return;
+       }
+
+       if (mimeinfo->mime_type == MIME_MULTIPART) {
+               if (mimeinfo->sub) {
+                       mimeinfo = mimeinfo->sub;
+                       if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0) {
+                               perror("fseek");
+                               return;
+                       }
+               } else
+                       return;
+       }
+       if (mimeinfo->parent && mimeinfo->parent->boundary) {
+               boundary = mimeinfo->parent->boundary;
+               boundary_len = strlen(boundary);
        }
-/* #else
-       tmpfp = procmime_get_text_content(mimeinfo, fp);
 
-       while (fgets(buf, sizeof(buf), tmpfp) != NULL)
-               textview_write_line(textview, buf, conv);
+       while (fgets(buf, sizeof(buf), fp) != NULL)
+               if (buf[0] == '\r' || buf[0] == '\n') break;
 
-       fclose(tmpfp);
-#endif */
+       /* display attached RFC822 single text message */
+       if (mimeinfo->parent && mimeinfo->mime_type == MIME_MESSAGE_RFC822) {
+               if (headers) procheader_header_array_destroy(headers);
+               if (!mimeinfo->sub || mimeinfo->sub->children) return;
+               headers = textview_scan_header(textview, fp);
+               mimeinfo = mimeinfo->sub;
+       } else if (!mimeinfo->parent &&
+                  mimeinfo->mime_type == MIME_MESSAGE_RFC822) {
+               if (headers) procheader_header_array_destroy(headers);
+               if (!mimeinfo->sub) return;
+               headers = textview_scan_header(textview, fp);
+               mimeinfo = mimeinfo->sub;
+       }
 
-       conv_code_converter_destroy(conv);
+       if (prefs_common.force_charset)
+               charset = prefs_common.force_charset;
+       else if (mimeinfo->charset)
+               charset = mimeinfo->charset;
+
+       text = GTK_STEXT(textview->text);
+       gtk_stext_freeze(text);
+
+       if (headers) {
+               textview_show_header(textview, headers);
+               procheader_header_array_destroy(headers);
+       }
+
+       if (mimeinfo->mime_type != MIME_TEXT &&
+           mimeinfo->mime_type != MIME_TEXT_HTML &&
+           mimeinfo->mime_type != MIME_TEXT_ENRICHED) {
+               if (mimeinfo->filename)
+                       g_snprintf(buf, sizeof(buf), "\n[%s  %s (%d bytes)]\n",
+                                  mimeinfo->content_type, mimeinfo->filename,
+                                  mimeinfo->size);
+               else
+                       g_snprintf(buf, sizeof(buf), "\n[%s (%d bytes)]\n",
+                                  mimeinfo->content_type, mimeinfo->size);
+               gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
+       } else {
+               conv = conv_code_converter_new(charset);
+               textview_write_body(textview, mimeinfo, fp, conv);
+               conv_code_converter_destroy(conv);
+       }
 
        gtk_stext_thaw(text);
 }
@@ -476,6 +575,25 @@ void textview_show_signature_part(TextView *textview, MimeInfo *partinfo)
 
 #undef TEXT_INSERT
 
+static void textview_write_body(TextView *textview, MimeInfo *mimeinfo,
+                               FILE *fp, CodeConverter *conv)
+{
+       FILE *tmpfp;
+       gchar buf[BUFFSIZE];
+
+       tmpfp = procmime_decode_content(NULL, fp, mimeinfo);
+       if (tmpfp) {
+               if (mimeinfo->mime_type == MIME_TEXT_HTML)
+                       textview_show_html(textview, tmpfp, conv);
+               else if (mimeinfo->mime_type == MIME_TEXT_ENRICHED)
+                       textview_show_ertf(textview, tmpfp, conv);
+               else
+                       while (fgets(buf, sizeof(buf), tmpfp) != NULL)
+                               textview_write_line(textview, buf, conv);
+               fclose(tmpfp);
+       }
+}
+
 static void textview_show_html(TextView *textview, FILE *fp,
                               CodeConverter *conv)
 {
@@ -852,6 +970,7 @@ static void textview_write_link(TextView *textview, const gchar *url,
 
     /* this part is taken from textview_write_line. Right now the only place
      * that calls this function passes NULL for conv, but you never know. */
+#if 0
     if (!conv)
            strncpy2(buf, str, sizeof(buf));
     else if (conv_convert(conv, buf, sizeof(buf), str) < 0) {
@@ -862,6 +981,7 @@ static void textview_write_link(TextView *textview, const gchar *url,
                            -1);
            return;
     }
+#endif
 
     /* this part is based on the code in make_clickable_parts */
     if (prefs_common.enable_color) {