diff options
author | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-06-22 00:46:58 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-06-22 00:46:58 +0800 |
commit | 4f689d0fb8e33e91fec8b8e0471d48f1e6993622 (patch) | |
tree | b7f6adc3bdf3df1e76dc832d3e56e2f0c098a840 /camel/gmime-utils.c | |
parent | 1703ec52d776954d5da61413b09a82f81b46dd02 (diff) | |
download | gsoc2013-evolution-4f689d0fb8e33e91fec8b8e0471d48f1e6993622.tar.gz gsoc2013-evolution-4f689d0fb8e33e91fec8b8e0471d48f1e6993622.tar.zst gsoc2013-evolution-4f689d0fb8e33e91fec8b8e0471d48f1e6993622.zip |
sync
svn path=/trunk/; revision=983
Diffstat (limited to 'camel/gmime-utils.c')
-rw-r--r-- | camel/gmime-utils.c | 64 |
1 files changed, 6 insertions, 58 deletions
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c index e2390b1499..917c426801 100644 --- a/camel/gmime-utils.c +++ b/camel/gmime-utils.c @@ -127,62 +127,7 @@ _store_header_pair_from_gstring (GHashTable *header_table, GString *header_line) } -GHashTable * -get_header_table_from_file (FILE *file) -{ - int next_char; - - gboolean crlf = FALSE; - gboolean end_of_header_line = FALSE; - gboolean end_of_headers = FALSE; - gboolean end_of_file = FALSE; - GString *header_line=NULL; - GHashTable *header_table; - - header_table = g_hash_table_new (g_string_hash, g_string_equal_for_hash); - next_char = fgetc (file); - do { - header_line = g_string_new(""); - end_of_header_line = FALSE; - crlf = FALSE; - - /* read a whole header line */ - do { - switch (next_char) { - case EOF: - end_of_file=TRUE; - end_of_header_line = TRUE; - break; - case '\n': /* a blank line means end of headers */ - if (crlf) { - end_of_headers=TRUE; - end_of_header_line = TRUE; - } - else crlf = TRUE; - break; - case ' ': - case 't': - if (crlf) crlf = FALSE; - - default: - if (!crlf) header_line = g_string_append_c (header_line, next_char); - else end_of_header_line = TRUE; - } - /* if we have read a whole header line, we have also read - the first character of the next line to be sure the - crlf was not followed by a space or a tab char */ - if (!end_of_header_line) next_char = fgetc (file); - - } while ( !end_of_header_line ); - if ( strlen(header_line->str) ) - _store_header_pair_from_gstring (header_table, header_line); - g_string_free (header_line, FALSE); - - } while ( (!end_of_headers) && (!end_of_file) ); - - return header_table; -} - + GHashTable * get_header_table_from_stream (CamelStream *stream) @@ -218,8 +163,11 @@ get_header_table_from_stream (CamelStream *stream) else crlf = TRUE; break; case ' ': - case 't': - if (crlf) crlf = FALSE; + case '\t': + if (crlf) { + crlf = FALSE; + next_char = ' '; + } default: if (!crlf) header_line = g_string_append_c (header_line, next_char); |