sync with sylpheed 0.6.2cvs3
authorPaul Mangan <paul@claws-mail.org>
Thu, 20 Sep 2001 11:53:09 +0000 (11:53 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 20 Sep 2001 11:53:09 +0000 (11:53 +0000)
13 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/inc.c
src/mimeview.c
src/procmime.c
src/procmime.h
src/procmsg.c
src/quote_fmt_parse.y
src/summary_search.c
src/summary_search.h

index 6f01e65..d47b157 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2001-09-20
+
+       * src/inc.c: fix for background POP3 hangs and crashes (thanks to
+         Sergey Vlasov).
+       * src/summary_search.c: added body searching function.
+       * src/procmime.[ch]: procmime_find_string(): changed arguments
+         and return value. Added case sensitivity option.
+
+2001-09-20
+
+       * src/procmime.[ch]:
+         procmime_find_string()
+         procmime_find_string_part(): new. It searchs the string from
+         messages.
+         Renamed procmime_get_text_part() to
+         procmime_get_first_text_content().
+         procmime_get_text_content(): new. It returns the text contents
+         of the specified MIME part.
+         procmime_mimeinfo_next(): new. It returns the next node of
+         MimeInfo tree.
+
+2001-09-19
+
+       * src/procmime.c: procmime_get_text_part(): modified so that it
+         finds a text part in nested multipart message correctly.
+       * src/procmime.h: added an example of MimeInfo structure.
+       * src/mimeview.c: mimeview_show_message(): search the first text
+         part.
+
 2001-09-17
 
        * src/mainwindow.c: ac_menu_popup_closed(): fixed the bug that
index e7b8c6a..bb65282 100644 (file)
@@ -1,3 +1,10 @@
+2001-09-20 [paul]
+
+       * configure.in
+               change to version 0.6.2claws2
+
+       * sync with sylpheed 0.6.2cvs3
+
 2001-09-19 [melvin]
 
        * src/gtkspell.c
index a595fd5..f293bf5 100644 (file)
@@ -1,3 +1,31 @@
+2001-09-20
+
+       * src/inc.c: ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Î POP3 ¥×¥í¥»¥¹¤Î¥Ï¥ó¥°¤Þ¤¿¤Ï¥¯¥é¥Ã¥·¥å
+         ¤ò½¤Àµ(Sergey Vlasov ¤µ¤ó thanks)¡£
+       * src/summary_search.c: ËÜʸ¸¡º÷µ¡Ç½¤òÄɲá£
+       * src/procmime.[ch]: procmime_find_string(): °ú¿ô¤ÈÌá¤êÃͤòÊѹ¹¡£
+         Â羮ʸ»ú¤Î¶èÊ̤Υª¥×¥·¥ç¥ó¤òÄɲá£
+
+2001-09-20
+
+       * src/procmime.[ch]:
+         procmime_find_string()
+         procmime_find_string_part(): ¿·µ¬¡£¥á¥Ã¥»¡¼¥¸¤«¤éʸ»úÎó¤ò¸¡º÷¤¹¤ë¡£
+         procmime_get_text_part() ¤ò procmime_get_first_text_content() ¤Ë
+         Ì¾¾ÎÊѹ¹¡£
+         procmime_get_text_content(): ¿·µ¬¡£»ØÄꤷ¤¿ MIME ¥Ñ¡¼¥È¤Î¥Æ¥­¥¹¥È
+         ÆâÍƤòÊÖ¤¹¡£
+         procmime_mimeinfo_next(): ¿·µ¬¡£ MimeInfo ¥Ä¥ê¡¼¤Î¼¡¤Î¥Î¡¼¥É¤ò
+         ÊÖ¤¹¡£
+
+2001-09-19
+
+       * src/procmime.c: procmime_get_text_part(): Æþ¤ì»Ò¾õ¤Î¥Þ¥ë¥Á¥Ñ¡¼¥È
+         ¥á¥Ã¥»¡¼¥¸¤Î¥Æ¥­¥¹¥È¥Ñ¡¼¥È¤òÀµ¤·¤¯¸«¤Ä¤±¤ë¤è¤¦¤Ë½¤Àµ¡£
+       * src/procmime.h: MimeInfo ¹½Â¤ÂΤÎÎã¤òÄɲá£
+       * src/mimeview.c: mimeview_show_message(): ºÇ½é¤Î¥Æ¥­¥¹¥È¥Ñ¡¼¥È¤ò
+         Ãµ¤¹¤è¤¦¤Ë¤·¤¿¡£
+
 2001-09-17
 
        * src/mainwindow.c: ac_menu_popup_closed(): segfault ¤òµ¯¤³¤¹¥Ð¥°
index 94bc138..c146532 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws1
+EXTRA_VERSION=claws2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 65d04ca..f06fb89 100644 (file)
@@ -661,7 +661,7 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                FILE *fp;
                gchar *quote_str;
 
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                else {
                        gchar * qmark;
@@ -990,8 +990,7 @@ Compose *compose_forward(PrefsAccount * account, MsgInfo *msginfo,
        } else {
                FILE *fp;
                gchar *quote_str;
-
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                else {
                        gchar * qmark;
@@ -1124,7 +1123,7 @@ void compose_reedit(MsgInfo *msginfo)
        text = GTK_STEXT(compose->text);
        gtk_stext_freeze(text);
 
-       if ((fp = procmime_get_text_part(msginfo)) == NULL)
+       if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                g_warning(_("Can't get text part\n"));
        else {
                while (fgets(buf, sizeof(buf), fp) != NULL)
index 1ef5271..c35c73b 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -665,7 +665,8 @@ static IncState inc_pop3_session_do(IncSession *session)
                                      automaton_input_cb, atm);
 #endif
 
-       gtk_main();
+       while (!atm->terminated)
+               gtk_main_iteration();
 
        log_verbosity_set(FALSE);
        recv_set_ui_func(NULL, NULL);
@@ -688,10 +689,8 @@ static gint pop3_automaton_terminate(SockInfo *source, Automaton *atm)
                gtk_timeout_remove(atm->timeout_tag);
                atm->timeout_tag = 0;
        }
-       if (source) {
+       if (source)
                sock_close(source);
-               gtk_main_quit();
-       }
 
        atm->terminated = TRUE;
 
index abcefe1..dae4b64 100644 (file)
@@ -269,7 +269,7 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
        }
        mimeview->file = g_strdup(file);
 
-       /* skip headers */
+       /* skip MIME part headers */
        if (mimeinfo->mime_type == MIME_MULTIPART) {
                if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0)
                perror("fseek");
@@ -294,8 +294,21 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
        gtk_signal_handler_unblock_by_func(GTK_OBJECT(ctree),
                                           mimeview_selected, mimeview);
 
-       if ((node = gtk_ctree_node_nth(ctree, 0))) {
+       /* search first text part */
+       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+            node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
+               MimeInfo *partinfo;
+
+               partinfo = gtk_ctree_node_get_row_data(ctree, node);
+               if (partinfo && partinfo->mime_type == MIME_TEXT)
+                       break;
+       }
+       if (!node)
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+
+       if (node) {
                gtk_ctree_select(ctree, node);
+               gtkut_ctree_set_focus_row(ctree, node);
                gtk_widget_grab_focus(mimeview->ctree);
        }
 }
index c2b47ee..a57a13c 100644 (file)
@@ -159,6 +159,31 @@ void procmime_mimeinfo_replace(MimeInfo *old, MimeInfo *new)
        }
 }
 
+MimeInfo *procmime_mimeinfo_next(MimeInfo *mimeinfo)
+{
+       if (!mimeinfo) return NULL;
+
+       if (mimeinfo->children)
+               return mimeinfo->children;
+       if (mimeinfo->sub)
+               return mimeinfo->sub;
+       if (mimeinfo->next)
+               return mimeinfo->next;
+
+       for (mimeinfo = mimeinfo->parent; mimeinfo != NULL;
+            mimeinfo = mimeinfo->parent) {
+               if (mimeinfo->next)
+                       return mimeinfo->next;
+               if (mimeinfo->main) {
+                       mimeinfo = mimeinfo->main;
+                       if (mimeinfo->next)
+                               return mimeinfo->next;
+               }
+       }
+
+       return NULL;
+}
+
 MimeInfo *procmime_scan_message(MsgInfo *msginfo)
 {
        FILE *fp;
@@ -611,7 +636,62 @@ gint procmime_get_part(const gchar *outfile, const gchar *infile,
        return 0;
 }
 
-FILE *procmime_get_text_part(MsgInfo *msginfo)
+FILE *procmime_get_text_content(MimeInfo *mimeinfo, FILE *infp)
+{
+       FILE *tmpfp, *outfp;
+       gchar *src_codeset;
+       gboolean conv_fail = FALSE;
+       gchar buf[BUFFSIZE];
+
+       g_return_val_if_fail(mimeinfo != NULL, NULL);
+       g_return_val_if_fail(infp != NULL, NULL);
+       g_return_val_if_fail(mimeinfo->mime_type == MIME_TEXT ||
+                            mimeinfo->mime_type == MIME_TEXT_HTML, NULL);
+
+       if (fseek(infp, mimeinfo->fpos, SEEK_SET) < 0) {
+               perror("fseek");
+               return NULL;
+       }
+
+       while (fgets(buf, sizeof(buf), infp) != NULL)
+               if (buf[0] == '\r' || buf[0] == '\n') break;
+
+       tmpfp = procmime_decode_content(NULL, infp, mimeinfo);
+       if (!tmpfp)
+               return NULL;
+
+       if ((outfp = my_tmpfile()) == NULL) {
+               perror("tmpfile");
+               fclose(tmpfp);
+               return NULL;
+       }
+
+       src_codeset = prefs_common.force_charset
+               ? prefs_common.force_charset : mimeinfo->charset;
+
+       while (fgets(buf, sizeof(buf), tmpfp) != NULL) {
+               gchar *str;
+
+               str = conv_codeset_strdup(buf, src_codeset, NULL);
+               if (str) {
+                       fputs(str, outfp);
+                       g_free(str);
+               } else {
+                       conv_fail = TRUE;
+                       fputs(buf, outfp);
+               }
+       }
+       if (conv_fail) g_warning(_("Code conversion failed.\n"));
+
+       fclose(tmpfp);
+       rewind(outfp);
+
+       return outfp;
+}
+
+/* search the first text part of (multipart) MIME message,
+   decode, convert it and output to outfp. */
+FILE *procmime_get_first_text_content(MsgInfo *msginfo)
 {
        FILE *infp, *tmpfp, *outfp;
        MimeInfo *mimeinfo, *partinfo = NULL;
@@ -629,17 +709,11 @@ FILE *procmime_get_text_part(MsgInfo *msginfo)
                return NULL;
        }
 
-       if (mimeinfo->mime_type == MIME_MULTIPART) {
-               partinfo = mimeinfo->children;
-               if (partinfo && partinfo->mime_type == MIME_TEXT) {
-                       if (fseek(infp, partinfo->fpos, SEEK_SET) < 0) {
-                               perror("fseek");
-                               partinfo = NULL;
-                       }
-               } else
-                       partinfo = NULL;
-       } else if (mimeinfo->mime_type == MIME_TEXT) {
-               partinfo = mimeinfo;
+       partinfo = mimeinfo;
+       while (partinfo && partinfo->mime_type == MIME_MULTIPART)
+               partinfo = partinfo->children;
+
+       if (partinfo && partinfo->mime_type == MIME_TEXT) {
                if (fseek(infp, partinfo->fpos, SEEK_SET) < 0) {
                        perror("fseek");
                        partinfo = NULL;
@@ -691,6 +765,80 @@ FILE *procmime_get_text_part(MsgInfo *msginfo)
        return outfp;
 }
 
+gboolean procmime_find_string_part(MimeInfo *mimeinfo, const gchar *filename,
+                                  const gchar *str, gboolean case_sens)
+{
+
+       FILE *infp, *outfp;
+       gchar buf[BUFFSIZE];
+       gchar *(* StrFindFunc) (const gchar *haystack, const gchar *needle);
+
+       g_return_val_if_fail(mimeinfo != NULL, FALSE);
+       g_return_val_if_fail(mimeinfo->mime_type == MIME_TEXT ||
+                            mimeinfo->mime_type == MIME_TEXT_HTML, FALSE);
+       g_return_val_if_fail(str != NULL, FALSE);
+
+       if ((infp = fopen(filename, "r")) == NULL) {
+               FILE_OP_ERROR(filename, "fopen");
+               return FALSE;
+       }
+
+       outfp = procmime_get_text_content(mimeinfo, infp);
+       fclose(infp);
+
+       if (!outfp)
+               return FALSE;
+
+       if (case_sens)
+               StrFindFunc = strstr;
+       else
+               StrFindFunc = strcasestr;
+
+       while (fgets(buf, sizeof(buf), outfp) != NULL) {
+               if (StrFindFunc(buf, str) != NULL) {
+                       fclose(outfp);
+                       return TRUE;
+               }
+       }
+
+       fclose(outfp);
+
+       return FALSE;
+}
+
+gboolean procmime_find_string(MsgInfo *msginfo, const gchar *str,
+                             gboolean case_sens)
+{
+       MimeInfo *mimeinfo;
+       MimeInfo *partinfo;
+       gchar *filename;
+       gboolean found = FALSE;
+
+       g_return_val_if_fail(msginfo != NULL, NULL);
+       g_return_val_if_fail(str != NULL, NULL);
+
+       filename = procmsg_get_message_file(msginfo);
+       if (!filename) return FALSE;
+       mimeinfo = procmime_scan_message(msginfo);
+
+       for (partinfo = mimeinfo; partinfo != NULL;
+            partinfo = procmime_mimeinfo_next(partinfo)) {
+               if (partinfo->mime_type == MIME_TEXT ||
+                   partinfo->mime_type == MIME_TEXT_HTML) {
+                       if (procmime_find_string_part
+                               (partinfo, filename, str, case_sens) == TRUE) {
+                               found = TRUE;
+                               break;
+                       }
+               }
+       }
+
+       procmime_mimeinfo_free_all(mimeinfo);
+       g_free(filename);
+
+       return found;
+}
+
 gchar *procmime_get_tmp_file_name(MimeInfo *mimeinfo)
 {
        static guint32 id = 0;
index e99aba6..5a853c3 100644 (file)
@@ -63,6 +63,24 @@ struct _MimeType
        gchar *extension;
 };
 
+/*
+ * An example of MimeInfo structure:
+ *
+ * multipart/mixed            root  <-+ parent
+ *                                    |
+ *   multipart/alternative      children <-+ parent
+ *                                         |
+ *     text/plain                 children  --+
+ *                                            |
+ *     text/html                  next      <-+
+ *
+ *   message/rfc822             next  <-+ main
+ *                                      |
+ *                                sub (capsulated message)
+ *
+ *   image/jpeg                 next
+ */
+
 struct _MimeInfo
 {
        gchar *encoding;
@@ -109,6 +127,10 @@ void procmime_mimeinfo_free_all            (MimeInfo       *mimeinfo);
 
 MimeInfo *procmime_mimeinfo_insert     (MimeInfo       *parent,
                                         MimeInfo       *mimeinfo);
+void procmime_mimeinfo_replace         (MimeInfo       *old,
+                                        MimeInfo       *new);
+
+MimeInfo *procmime_mimeinfo_next       (MimeInfo       *mimeinfo);
 
 MimeInfo *procmime_scan_message                (MsgInfo        *msginfo);
 void procmime_scan_multipart_message   (MimeInfo       *mimeinfo,
@@ -130,7 +152,17 @@ FILE *procmime_decode_content              (FILE           *outfp,
 gint procmime_get_part                 (const gchar    *outfile,
                                         const gchar    *infile,
                                         MimeInfo       *mimeinfo);
-FILE *procmime_get_text_part           (MsgInfo        *msginfo);
+FILE *procmime_get_text_content                (MimeInfo       *mimeinfo,
+                                        FILE           *infp);
+FILE *procmime_get_first_text_content  (MsgInfo        *msginfo);
+
+gboolean procmime_find_string_part     (MimeInfo       *mimeinfo,
+                                        const gchar    *filename,
+                                        const gchar    *str,
+                                        gboolean        case_sens);
+gboolean procmime_find_string          (MsgInfo        *msginfo,
+                                        const gchar    *str,
+                                        gboolean        case_sens);
 
 gchar *procmime_get_tmp_file_name      (MimeInfo       *mimeinfo);
 
index 5fd293e..d359c80 100644 (file)
@@ -689,7 +689,7 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline)
 
        g_return_if_fail(msginfo);
 
-       if ((tmpfp = procmime_get_text_part(msginfo)) == NULL) {
+       if ((tmpfp = procmime_get_first_text_content(msginfo)) == NULL) {
                g_warning(_("Can't get text part\n"));
                return;
        }
index 9cde46d..23ad275 100644 (file)
@@ -264,7 +264,7 @@ special:
                gchar buf[BUFFSIZE];
                FILE * fp;
 
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        INSERT(buf);
@@ -276,7 +276,7 @@ special:
                gchar buf[BUFFSIZE];
                FILE * fp;
 
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        if (quote_str)
@@ -290,7 +290,7 @@ special:
                gchar buf[BUFFSIZE];
                FILE * fp;
 
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        if (strncmp(buf, "-- ", 3) == 0)
@@ -304,7 +304,7 @@ special:
                gchar buf[BUFFSIZE];
                FILE * fp;
 
-               if ((fp = procmime_get_text_part(msginfo)) == NULL)
+               if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                        g_warning(_("Can't get text part\n"));
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        if (strncmp(buf, "-- ", 3) == 0)
index b5f46b4..5b79761 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 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
@@ -53,6 +53,7 @@ static GtkWidget *window;
 static GtkWidget *from_entry;
 static GtkWidget *to_entry;
 static GtkWidget *subject_entry;
+static GtkWidget *body_entry;
 static GtkWidget *case_checkbtn;
 static GtkWidget *backward_checkbtn;
 static GtkWidget *all_checkbtn;
@@ -66,6 +67,7 @@ static void summary_search_clear(GtkButton *button, gpointer data);
 static void from_activated(void);
 static void to_activated(void);
 static void subject_activated(void);
+static void body_activated(void);
 static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data);
 
 void summary_search(SummaryView *summaryview)
@@ -92,6 +94,7 @@ static void summary_search_create(SummaryView *summaryview)
        GtkWidget *from_label;
        GtkWidget *to_label;
        GtkWidget *subject_label;
+       GtkWidget *body_label;
        GtkWidget *checkbtn_hbox;
        GtkWidget *confirm_area;
 
@@ -114,7 +117,7 @@ static void summary_search_create(SummaryView *summaryview)
        gtk_widget_show (vbox1);
        gtk_container_add (GTK_CONTAINER (window), vbox1);
 
-       table1 = gtk_table_new (3, 3, FALSE);
+       table1 = gtk_table_new (4, 3, FALSE);
        gtk_widget_show (table1);
        gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (table1), 4);
@@ -142,6 +145,13 @@ static void summary_search_create(SummaryView *summaryview)
        gtk_signal_connect(GTK_OBJECT(subject_entry), "activate",
                           GTK_SIGNAL_FUNC(subject_activated), summaryview);
 
+       body_entry = gtk_entry_new ();
+       gtk_widget_show (body_entry);
+       gtk_table_attach (GTK_TABLE (table1), body_entry, 1, 3, 3, 4,
+                         GTK_EXPAND|GTK_FILL, 0, 0, 0);
+       gtk_signal_connect(GTK_OBJECT(body_entry), "activate",
+                          GTK_SIGNAL_FUNC(body_activated), summaryview);
+
        from_label = gtk_label_new (_("From:"));
        gtk_widget_show (from_label);
        gtk_table_attach (GTK_TABLE (table1), from_label, 0, 1, 0, 1,
@@ -158,12 +168,18 @@ static void summary_search_create(SummaryView *summaryview)
 
        subject_label = gtk_label_new (_("Subject:"));
        gtk_widget_show (subject_label);
-
        gtk_table_attach (GTK_TABLE (table1), subject_label, 0, 1, 2, 3,
                          GTK_FILL, 0, 0, 0);
        gtk_label_set_justify (GTK_LABEL (subject_label), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment (GTK_MISC (subject_label), 1, 0.5);
 
+       body_label = gtk_label_new (_("Body"));
+       gtk_widget_show (body_label);
+       gtk_table_attach (GTK_TABLE (table1), body_label, 0, 1, 3, 4,
+                         GTK_FILL, 0, 0, 0);
+       gtk_label_set_justify (GTK_LABEL (body_label), GTK_JUSTIFY_RIGHT);
+       gtk_misc_set_alignment (GTK_MISC (body_label), 1, 0.5);
+
        checkbtn_hbox = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (checkbtn_hbox);
        gtk_box_pack_start (GTK_BOX (vbox1), checkbtn_hbox, TRUE, TRUE, 0);
@@ -225,6 +241,8 @@ static void summary_search_execute(GtkButton *button, gpointer data)
        gboolean from_matched;
        gboolean   to_matched;
        gboolean subj_matched;
+       gboolean body_matched;
+       gchar *body_str;
        wchar_t *wcs_hs, *fromwcs, *towcs, *subjwcs;
        wchar_t *(* WCSFindFunc) (const wchar_t *haystack,
                                  const wchar_t *needle);
@@ -252,6 +270,7 @@ static void summary_search_execute(GtkButton *button, gpointer data)
        fromwcs = (wchar_t *)GTK_ENTRY(from_entry)->text;
        towcs   = (wchar_t *)GTK_ENTRY(to_entry)->text;
        subjwcs = (wchar_t *)GTK_ENTRY(subject_entry)->text;
+       body_str = gtk_entry_get_text(GTK_ENTRY(body_entry));
 
        if (search_all) {
                gtk_clist_freeze(GTK_CLIST(ctree));
@@ -310,7 +329,7 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                                break;
                }
 
-               from_matched = to_matched = subj_matched = FALSE;
+               from_matched = to_matched = subj_matched = body_matched = FALSE;
 
                msginfo = gtk_ctree_node_get_row_data(ctree, node);
 
@@ -332,8 +351,12 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                                subj_matched = TRUE;
                        g_free(wcs_hs);
                }
+               if (*body_str) {
+                       if (procmime_find_string(msginfo, body_str, case_sens))
+                               body_matched = TRUE;
+               }
 
-               if (from_matched || to_matched || subj_matched) {
+               if (from_matched || to_matched || subj_matched || body_matched) {
                        if (search_all)
                                gtk_ctree_select(ctree, node);
                        else {
@@ -357,6 +380,7 @@ static void summary_search_clear(GtkButton *button, gpointer data)
        gtk_editable_delete_text(GTK_EDITABLE(from_entry),    0, -1);
        gtk_editable_delete_text(GTK_EDITABLE(to_entry),      0, -1);
        gtk_editable_delete_text(GTK_EDITABLE(subject_entry), 0, -1);
+       gtk_editable_delete_text(GTK_EDITABLE(body_entry),    0, -1);
 }
 
 static void from_activated(void)
@@ -374,6 +398,11 @@ static void subject_activated(void)
        gtk_button_clicked(GTK_BUTTON(search_btn));
 }
 
+static void body_activated(void)
+{
+       gtk_button_clicked(GTK_BUTTON(search_btn));
+}
+
 static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
        if (event && event->keyval == GDK_Escape)
index f2448fb..4c8d1d3 100644 (file)
@@ -28,4 +28,4 @@
 void summary_search(SummaryView *summaryview);
 void summary_search_cb(gpointer data, guint action, GtkWidget *widget);
 
-#endif __SUMMARY_SEARCH_H__
+#endif /* __SUMMARY_SEARCH_H__ */