aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-25 07:17:54 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-25 07:17:54 +0000
commit749d0bd1eb364a5efc52d2f0a0b4b7731c9332ba (patch)
tree9b3c627281eba34f2e6447dfb63cd1dae90b3bd7 /src
parentd8bb0c2d9a035c9ce315877b18a12ba5df9113b5 (diff)
match the output header for printing to the message view.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@679 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/displayheader.c59
-rw-r--r--src/displayheader.h37
-rw-r--r--src/textview.c49
4 files changed, 5 insertions, 141 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 70445ac2..c3fafdb4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,7 +33,6 @@ sylpheed_SOURCES = \
prefs_template.c prefs_template.h \
prefs_actions.c prefs_actions.h \
account_dialog.c account_dialog.h \
- displayheader.c displayheader.h \
template.c template.h \
addressbook.c addressbook.h \
addr_compl.c addr_compl.h \
diff --git a/src/displayheader.c b/src/displayheader.c
deleted file mode 100644
index 1db374cd..00000000
--- a/src/displayheader.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <glib.h>
-
-#include "displayheader.h"
-
-gchar *display_header_prop_get_str(DisplayHeaderProp *dp)
-{
- return g_strconcat(dp->hidden ? "-" : "", dp->name, NULL);
-}
-
-DisplayHeaderProp *display_header_prop_read_str(gchar *buf)
-{
- DisplayHeaderProp *dp;
-
- dp = g_new0(DisplayHeaderProp, 1);
-
- dp->hidden = FALSE;
- if (*buf == '-') {
- dp->hidden = TRUE;
- buf++;
- }
- if (*buf == '\0') {
- g_free(dp);
- return NULL;
- }
- dp->name = g_strdup(buf);
-
- return dp;
-}
-
-void display_header_prop_free(DisplayHeaderProp *dp)
-{
- if (!dp) return;
-
- g_free(dp->name);
- g_free(dp);
-}
diff --git a/src/displayheader.h b/src/displayheader.h
deleted file mode 100644
index e7baa2be..00000000
--- a/src/displayheader.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __DISPLAYHEADER_H__
-#define __DISPLAYHEADER_H__
-
-#include <glib.h>
-
-typedef struct _DisplayHeaderProp DisplayHeaderProp;
-
-struct _DisplayHeaderProp
-{
- gchar *name;
- gboolean hidden;
-};
-
-gchar *display_header_prop_get_str (DisplayHeaderProp *dp);
-DisplayHeaderProp *display_header_prop_read_str (gchar *buf);
-void display_header_prop_free (DisplayHeaderProp *dp);
-
-#endif /* __DISPLAYHEADER_H__ */
diff --git a/src/textview.c b/src/textview.c
index 4463d199..3fa4557c 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1235,58 +1235,20 @@ void textview_set_position(TextView *textview, gint pos)
static GPtrArray *textview_scan_header(TextView *textview, FILE *fp,
const gchar *encoding)
{
- gchar buf[BUFFSIZE];
- GPtrArray *headers, *sorted_headers;
- GSList *disphdr_list;
- Header *header;
- gint i;
-
g_return_val_if_fail(fp != NULL, NULL);
if (textview->show_all_headers)
return procheader_get_header_array_asis(fp, encoding);
if (!prefs_common.display_header) {
+ gchar buf[BUFFSIZE];
+
while (fgets(buf, sizeof(buf), fp) != NULL)
if (buf[0] == '\r' || buf[0] == '\n') break;
return NULL;
}
- headers = procheader_get_header_array_asis(fp, encoding);
-
- sorted_headers = g_ptr_array_new();
-
- for (disphdr_list = prefs_common.disphdr_list; disphdr_list != NULL;
- disphdr_list = disphdr_list->next) {
- DisplayHeaderProp *dp =
- (DisplayHeaderProp *)disphdr_list->data;
-
- for (i = 0; i < headers->len; i++) {
- header = g_ptr_array_index(headers, i);
-
- if (!g_ascii_strcasecmp(header->name, dp->name)) {
- if (dp->hidden)
- procheader_header_free(header);
- else
- g_ptr_array_add(sorted_headers, header);
-
- g_ptr_array_remove_index(headers, i);
- i--;
- }
- }
- }
-
- if (prefs_common.show_other_header) {
- for (i = 0; i < headers->len; i++) {
- header = g_ptr_array_index(headers, i);
- g_ptr_array_add(sorted_headers, header);
- }
- g_ptr_array_free(headers, TRUE);
- } else
- procheader_header_array_destroy(headers);
-
-
- return sorted_headers;
+ return procheader_get_header_array_for_display(fp, encoding);
}
static void textview_show_header(TextView *textview, GPtrArray *headers)
@@ -1300,12 +1262,12 @@ static void textview_show_header(TextView *textview, GPtrArray *headers)
g_return_if_fail(headers != NULL);
buffer = gtk_text_view_get_buffer(text);
+ gtk_text_buffer_get_end_iter(buffer, &iter);
for (i = 0; i < headers->len; i++) {
header = g_ptr_array_index(headers, i);
g_return_if_fail(header->name != NULL);
- gtk_text_buffer_get_end_iter(buffer, &iter);
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, header->name, -1,
"header_title", "header", NULL);
@@ -1323,7 +1285,6 @@ static void textview_show_header(TextView *textview, GPtrArray *headers)
(!strncmp(header->name, "X-Mailer", 8) ||
!strncmp(header->name, "X-Newsreader", 12)) &&
strstr(header->body, "Sylpheed") != NULL) {
- gtk_text_buffer_get_end_iter(buffer, &iter);
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, header->body, -1,
"header", "emphasis", NULL);
@@ -1334,7 +1295,7 @@ static void textview_show_header(TextView *textview, GPtrArray *headers)
textview_make_clickable_parts
(textview, "header", NULL, header->body);
}
- gtk_text_buffer_get_end_iter(buffer, &iter); //
+ gtk_text_buffer_get_end_iter(buffer, &iter);
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, "\n", 1, "header", NULL);
}