[anjal] Fix invalid UTF8 strings from mail preview.



commit c694a506abf6f032bfe99f5cb529f5574bca609c
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Wed May 20 17:26:22 2009 +0530

    Fix invalid UTF8 strings from mail preview.
---
 eds-anjal-2-27.patch |   11 ++++++-----
 eds-anjal.patch      |   35 +++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/eds-anjal-2-27.patch b/eds-anjal-2-27.patch
index 73de5ef..1408e6a 100644
--- a/eds-anjal-2-27.patch
+++ b/eds-anjal-2-27.patch
@@ -365,18 +365,19 @@ index 2a97067..e9a6f4d 100644
  void camel_content_info_dump (CamelMessageContentInfo *ci, int depth);
  
 diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
-index d24bb19..be5198d 100644
+index d24bb19..4037c9e 100644
 --- a/camel/camel-mime-part-utils.c
 +++ b/camel/camel-mime-part-utils.c
-@@ -47,6 +47,7 @@
+@@ -47,6 +47,8 @@
  #include "camel-stream-filter.h"
  #include "camel-stream-fs.h"
  #include "camel-stream-mem.h"
 +#include "camel-stream-buffer.h"
++#include "camel-utf8.h"
  
  #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))
  	       #include <stdio.h>*/
-@@ -136,3 +137,81 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
+@@ -136,3 +138,81 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
  
  	g_free (encoding);
  }
@@ -447,8 +448,8 @@ index d24bb19..be5198d 100644
 +				g_string_insert (str, 100, "\n");
 +			}
 +			/* We don't mark dirty, as we don't store these */
-+			((CamelMessageInfoBase *) info)->preview = str->str;
-+			g_string_free(str, FALSE);
++			((CamelMessageInfoBase *) info)->preview = camel_utf8_make_valid(str->str);
++			g_string_free(str, TRUE);
 +		
 +			camel_object_unref (bstream);
 +		}
diff --git a/eds-anjal.patch b/eds-anjal.patch
index 2eb8eef..b842703 100644
--- a/eds-anjal.patch
+++ b/eds-anjal.patch
@@ -1,8 +1,8 @@
 diff --git a/camel/camel-db.c b/camel/camel-db.c
-index 8cc23d1..f074879 100644
+index ceb2102..492a11f 100644
 --- a/camel/camel-db.c
 +++ b/camel/camel-db.c
-@@ -1060,6 +1060,60 @@ camel_db_get_folder_deleted_uids (CamelDB *db, char *folder_name, CamelException
+@@ -981,6 +981,60 @@ camel_db_get_folder_deleted_uids (CamelDB *db, char *folder_name, CamelException
  }
  
  static int
@@ -63,7 +63,7 @@ index 8cc23d1..f074879 100644
  read_vuids_callback (void *ref, int ncol, char ** cols, char ** name)
  {
  	 GPtrArray *array = (GPtrArray *)ref;
-@@ -1160,6 +1214,11 @@ camel_db_create_message_info_table (CamelDB *cdb, const char *folder_name, Camel
+@@ -1081,6 +1135,11 @@ camel_db_create_message_info_table (CamelDB *cdb, const char *folder_name, Camel
  	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
  	sqlite3_free (table_creation_query);
  
@@ -75,7 +75,7 @@ index 8cc23d1..f074879 100644
  	/* FIXME: sqlize folder_name before you create the index */
  	safe_index = g_strdup_printf("SINDEX-%s", folder_name);
  	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, mail_cc, mlist, part, labels, usertags, cinfo, bdata)", safe_index, folder_name);
-@@ -1167,6 +1226,13 @@ camel_db_create_message_info_table (CamelDB *cdb, const char *folder_name, Camel
+@@ -1088,6 +1147,13 @@ camel_db_create_message_info_table (CamelDB *cdb, const char *folder_name, Camel
  	g_free (safe_index);
  	sqlite3_free (table_creation_query);
  
@@ -103,7 +103,7 @@ index 3eaeeb1..7451b90 100644
  #endif
  
 diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
-index f448f84..3375e03 100644
+index d947aca..cf1cbdd 100644
 --- a/camel/camel-folder-summary.c
 +++ b/camel/camel-folder-summary.c
 @@ -61,6 +61,7 @@
@@ -222,7 +222,7 @@ index f448f84..3375e03 100644
  int
  camel_folder_summary_reload_from_db (CamelFolderSummary *s, CamelException *ex)
  {
-@@ -921,9 +1014,26 @@ camel_folder_summary_reload_from_db (CamelFolderSummary *s, CamelException *ex)
+@@ -921,17 +1014,34 @@ camel_folder_summary_reload_from_db (CamelFolderSummary *s, CamelException *ex)
  	if (!g_getenv("CAMEL_FREE_INFOS") && !s->timeout_handle) 
  		s->timeout_handle = g_timeout_add_seconds (SUMMARY_CACHE_DROP, (GSourceFunc) cfs_try_release_memory, s);
  
@@ -238,6 +238,7 @@ index f448f84..3375e03 100644
  	return ret == 0 ? 0 : -1;
  }
  
+-static void 
 +void
 +camel_folder_summary_add_preview (CamelFolderSummary *s, CamelMessageInfo *info)
 +{
@@ -246,9 +247,18 @@ index f448f84..3375e03 100644
 +	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 +}
 +
- static void 
++void 
  camel_folder_summary_dump (CamelFolderSummary *s)
  {
+ 	int i;
+ 
+ 	printf("Dumping %s\n", s->folder ? s->folder->full_name:"nil");
+ 	for (i=0; i<s->uids->len; i++)
+-		printf("%s\t", (char *)s->uids->pdata[i]);
++		printf("%s\t",s->uids->pdata[i] ?  (char *)s->uids->pdata[i] : "nill");
+ 	printf("\n");
+ }
+ 
 @@ -1403,6 +1513,12 @@ save_message_infos_to_db (CamelFolderSummary *s, gboolean fresh_mirs, CamelExcep
  	return 0;
  }
@@ -365,18 +375,19 @@ index c553971..d3308c1 100644
  void camel_content_info_dump (CamelMessageContentInfo *ci, int depth);
  
 diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
-index 1946e7d..5396800 100644
+index 1946e7d..0b481e2 100644
 --- a/camel/camel-mime-part-utils.c
 +++ b/camel/camel-mime-part-utils.c
-@@ -47,6 +47,7 @@
+@@ -47,6 +47,8 @@
  #include "camel-stream-filter.h"
  #include "camel-stream-fs.h"
  #include "camel-stream-mem.h"
 +#include "camel-stream-buffer.h"
++#include "camel-utf8.h"
  
  #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))
  	       #include <stdio.h>*/
-@@ -136,3 +137,81 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
+@@ -136,3 +138,81 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
  
  	g_free (encoding);
  }
@@ -447,8 +458,8 @@ index 1946e7d..5396800 100644
 +				g_string_insert (str, 100, "\n");
 +			}
 +			/* We don't mark dirty, as we don't store these */
-+			((CamelMessageInfoBase *) info)->preview = str->str;
-+			g_string_free(str, FALSE);
++			((CamelMessageInfoBase *) info)->preview = camel_utf8_make_valid(str->str);
++			g_string_free(str, TRUE);
 +		
 +			camel_object_unref (bstream);
 +		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]