evolution-data-server r8620 - trunk/camel
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8620 - trunk/camel
- Date: Sat, 5 Apr 2008 03:18:53 +0100 (BST)
Author: fejj
Date: Sat Apr 5 03:18:52 2008
New Revision: 8620
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8620&view=rev
Log:
2008-04-04 Jeffrey Stedfast <fejj novell com>
* camel-folder-summary.c (summary_format_address): Unfold the
header before decoding it.
(summary_format_string): Same.
* camel-mime-message.c (process_header): Unfold certain headers.
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-folder-summary.c
trunk/camel/camel-mime-message.c
Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c (original)
+++ trunk/camel/camel-folder-summary.c Sat Apr 5 03:18:52 2008
@@ -1669,34 +1669,43 @@
summary_format_address(struct _camel_header_raw *h, const char *name, const char *charset)
{
struct _camel_header_address *addr;
- const char *text;
- char *ret;
-
- text = camel_header_raw_find (&h, name, NULL);
- addr = camel_header_address_decode (text, charset);
- if (addr) {
- ret = camel_header_address_list_format (addr);
+ char *text, *str;
+
+ if (!(text = (char *) camel_header_raw_find (&h, name, NULL)))
+ return NULL;
+
+ while (isspace ((unsigned) *text))
+ text++;
+
+ text = camel_header_unfold (text);
+
+ if ((addr = camel_header_address_decode (text, charset))) {
+ str = camel_header_address_list_format (addr);
camel_header_address_list_clear (&addr);
+ g_free (text);
} else {
- ret = g_strdup (text);
+ str = text;
}
-
- return ret;
+
+ return str;
}
static char *
summary_format_string (struct _camel_header_raw *h, const char *name, const char *charset)
{
- const char *text;
-
- text = camel_header_raw_find (&h, name, NULL);
- if (text) {
- while (isspace ((unsigned) *text))
- text++;
- return camel_header_decode_string (text, charset);
- } else {
+ char *text, *str;
+
+ if (!(text = (char *) camel_header_raw_find (&h, name, NULL)))
return NULL;
- }
+
+ while (isspace ((unsigned) *text))
+ text++;
+
+ text = camel_header_unfold (text);
+ str = camel_header_decode_string (text, charset);
+ g_free (text);
+
+ return str;
}
Modified: trunk/camel/camel-mime-message.c
==============================================================================
--- trunk/camel/camel-mime-message.c (original)
+++ trunk/camel/camel-mime-message.c Sat Apr 5 03:18:52 2008
@@ -602,7 +602,9 @@
/* ... then clean up the follow-on state */
state = camel_mime_parser_step (mp, &buf, &len);
switch (state) {
- case CAMEL_MIME_PARSER_STATE_EOF: case CAMEL_MIME_PARSER_STATE_FROM_END: /* these doesn't belong to us */
+ case CAMEL_MIME_PARSER_STATE_EOF:
+ case CAMEL_MIME_PARSER_STATE_FROM_END:
+ /* these doesn't belong to us */
camel_mime_parser_unstep (mp);
case CAMEL_MIME_PARSER_STATE_MESSAGE_END:
break;
@@ -658,28 +660,33 @@
CamelMimeMessage *message = CAMEL_MIME_MESSAGE (medium);
CamelInternetAddress *addr;
const char *charset;
-
+ char *unfolded;
+
header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, name);
switch (header_type) {
case HEADER_FROM:
addr = camel_internet_address_new();
- if (camel_address_decode((CamelAddress *)addr, value) <= 0) {
+ unfolded = camel_header_unfold (value);
+ if (camel_address_decode ((CamelAddress *) addr, unfolded) <= 0) {
camel_object_unref(addr);
} else {
if (message->from)
camel_object_unref(message->from);
message->from = addr;
}
+ g_free (unfolded);
break;
case HEADER_REPLY_TO:
addr = camel_internet_address_new();
- if (camel_address_decode((CamelAddress *)addr, value) <= 0) {
+ unfolded = camel_header_unfold (value);
+ if (camel_address_decode ((CamelAddress *) addr, unfolded) <= 0) {
camel_object_unref(addr);
} else {
if (message->reply_to)
camel_object_unref(message->reply_to);
message->reply_to = addr;
}
+ g_free (unfolded);
break;
case HEADER_SUBJECT:
g_free (message->subject);
@@ -688,7 +695,10 @@
charset = e_iconv_charset_name (charset);
} else
charset = NULL;
- message->subject = g_strstrip (camel_header_decode_string (value, charset));
+
+ unfolded = camel_header_unfold (value);
+ message->subject = g_strstrip (camel_header_decode_string (unfolded, charset));
+ g_free (unfolded);
break;
case HEADER_TO:
case HEADER_CC:
@@ -697,10 +707,13 @@
case HEADER_RESENT_CC:
case HEADER_RESENT_BCC:
addr = g_hash_table_lookup (message->recipients, name);
- if (value)
- camel_address_decode (CAMEL_ADDRESS (addr), value);
- else
+ if (value) {
+ unfolded = camel_header_unfold (value);
+ camel_address_decode (CAMEL_ADDRESS (addr), unfolded);
+ g_free (unfolded);
+ } else {
camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ }
return FALSE;
case HEADER_DATE:
if (value) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]