aboutsummaryrefslogtreecommitdiffhomepage
path: root/gmime-filter-headers.h
diff options
context:
space:
mode:
authorGravatar Michal Sojka <sojkam1@fel.cvut.cz>2010-03-03 08:50:56 +0100
committerGravatar Carl Worth <cworth@cworth.org>2010-04-13 09:23:54 -0700
commit452fbedcd5db101378b01c957a7f0574eb708afc (patch)
tree2c1d5ce3d44b78745489915ff7608f99de3b2a9a /gmime-filter-headers.h
parent9193455fa1476ea3957475e77379b75efa6dd90b (diff)
Decode headers in reply
When headers contain non-ASCII characters, they are encoded according to rfc2047. Nomtuch reply command emits the headers in the encoded form, which makes them hard to read by humans who compose the reply. For example instead of "Subject: Re: Rozlučka" one currently sees "Subject: Re: =?iso-8859-2?q?Rozlu=E8ka?=". This patch adds a new GMime filter which is used to decode headers to UTF-8 and uses this filter when notmuch reply outputs headers. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Diffstat (limited to 'gmime-filter-headers.h')
-rw-r--r--gmime-filter-headers.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/gmime-filter-headers.h b/gmime-filter-headers.h
new file mode 100644
index 00000000..47d1d456
--- /dev/null
+++ b/gmime-filter-headers.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2009 Keith Packard <keithp@keithp.com>
+ * Copyright © 2010 Michal Sojka <sojkam1@fel.cvut.cz>
+ *
+ * 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 3 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 _GMIME_FILTER_HEADERS_H_
+#define _GMIME_FILTER_HEADERS_H_
+
+#include <gmime/gmime-filter.h>
+
+G_BEGIN_DECLS
+
+#define GMIME_TYPE_FILTER_HEADERS (g_mime_filter_headers_get_type ())
+#define GMIME_FILTER_HEADERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeaders))
+#define GMIME_FILTER_HEADERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeadersClass))
+#define GMIME_IS_FILTER_HEADERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_FILTER_HEADERS))
+#define GMIME_IS_FILTER_HEADERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_FILTER_HEADERS))
+#define GMIME_FILTER_HEADERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeadersClass))
+
+typedef struct _GMimeFilterHeaders GMimeFilterHeaders;
+typedef struct _GMimeFilterHeadersClass GMimeFilterHeadersClass;
+
+/**
+ * GMimeFilterHeaders:
+ * @parent_object: parent #GMimeFilter
+ * @saw_nl: previous char was a \n
+ * @line: temporary buffer for line unfolding
+ * @line_size: size of currently allocated nemory for @line
+ * @lineptr: pointer to the first unused character in @line
+ *
+ * A filter to decode rfc2047 encoded headers
+ **/
+struct _GMimeFilterHeaders {
+ GMimeFilter parent_object;
+
+ gboolean saw_nl;
+ char *line;
+ size_t line_size;
+ char *lineptr;
+};
+
+struct _GMimeFilterHeadersClass {
+ GMimeFilterClass parent_class;
+
+};
+
+
+GType g_mime_filter_headers_get_type (void);
+
+GMimeFilter *g_mime_filter_headers_new (void);
+
+G_END_DECLS
+
+
+#endif /* _GMIME_FILTER_HEADERS_H_ */