1 /* 2 * LibSylph -- E-Mail client library 3 * Copyright (C) 1999-2007 Hiroyuki Yamamoto 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef __PROCHEADER_H__ 21 #define __PROCHEADER_H__ 22 23 #include <glib.h> 24 #include <stdio.h> 25 #include <time.h> 26 27 #include "procmsg.h" 28 29 typedef struct _HeaderEntry HeaderEntry; 30 typedef struct _Header Header; 31 32 struct _HeaderEntry 33 { 34 gchar *name; 35 gchar *body; 36 gboolean unfold; 37 }; 38 39 struct _Header 40 { 41 gchar *name; 42 gchar *body; 43 }; 44 45 gint procheader_get_one_field (gchar *buf, 46 size_t len, 47 FILE *fp, 48 HeaderEntry hentry[]); 49 gchar *procheader_get_unfolded_line (gchar *buf, 50 size_t len, 51 FILE *fp); 52 53 GSList *procheader_get_header_list_from_file (const gchar *file); 54 GSList *procheader_get_header_list (FILE *fp); 55 GSList *procheader_get_header_list_from_msginfo (MsgInfo *msginfo); 56 GSList *procheader_add_header_list (GSList *hlist, 57 const gchar *header_name, 58 const gchar *body); 59 GSList *procheader_copy_header_list (GSList *hlist); 60 GSList *procheader_merge_header_list (GSList *hlist1, 61 GSList *hlist2); 62 GSList *procheader_merge_header_list_dup (GSList *hlist1, 63 GSList *hlist2); 64 gint procheader_find_header_list (GSList *hlist, 65 const gchar *header_name); 66 void procheader_header_list_destroy (GSList *hlist); 67 68 GPtrArray *procheader_get_header_array (FILE *fp, 69 const gchar *encoding); 70 GPtrArray *procheader_get_header_array_asis (FILE *fp, 71 const gchar *encoding); 72 GPtrArray *procheader_get_header_array_for_display 73 (FILE *fp, 74 const gchar *encoding); 75 void procheader_header_array_destroy (GPtrArray *harray); 76 77 void procheader_header_free (Header *header); 78 79 void procheader_get_header_fields (FILE *fp, 80 HeaderEntry hentry[]); 81 MsgInfo *procheader_parse_file (const gchar *file, 82 MsgFlags flags, 83 gboolean full); 84 MsgInfo *procheader_parse_str (const gchar *str, 85 MsgFlags flags, 86 gboolean full); 87 MsgInfo *procheader_parse_stream (FILE *fp, 88 MsgFlags flags, 89 gboolean full); 90 91 gchar *procheader_get_fromname (const gchar *str); 92 gchar *procheader_get_toname (const gchar *str); 93 94 stime_t procheader_date_parse (gchar *dest, 95 const gchar *src, 96 gint len); 97 void procheader_date_get_localtime (gchar *dest, 98 gint len, 99 const stime_t timer); 100 101 #endif /* __PROCHEADER_H__ */ 102