evolution-data-server r9830 - in trunk: . camel docs/reference/addressbook/libebook/tmpl docs/reference/camel/tmpl



Author: sragavan
Date: Mon Dec 15 06:34:32 2008
New Revision: 9830
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9830&view=rev

Log:
2008-12-15  Srinivasa Ragavan  <sragavan novell com>
	
	** Fix for bug #558926 and #546637

	* camel/camel-vee-folder.c:
	* camel/camel-vee-summary.c:
	* camel/camel-vtrash-folder.c:




Modified:
   trunk/ChangeLog
   trunk/camel/ChangeLog
   trunk/camel/camel-vee-folder.c
   trunk/camel/camel-vee-summary.c
   trunk/camel/camel-vtrash-folder.c
   trunk/docs/reference/addressbook/libebook/tmpl/e-contact.sgml
   trunk/docs/reference/camel/tmpl/camel-unused.sgml

Modified: trunk/camel/camel-vee-folder.c
==============================================================================
--- trunk/camel/camel-vee-folder.c	(original)
+++ trunk/camel/camel-vee-folder.c	Mon Dec 15 06:34:32 2008
@@ -150,7 +150,7 @@
 		camel_vee_folder_construct(vf, parent_store, full, name, flags);
 	}
 
-	d(printf("returning folder %s %p, count = %d\n", name, vf, camel_folder_get_message_count((CamelFolder *)vf)));
+	d(printf("returning folder %s %p, count = %d\n", full, vf, camel_folder_get_message_count((CamelFolder *)vf)));
 
 	if (vf) {
 		tmp = g_strdup_printf("%s/%s.cmeta", ((CamelService *)parent_store)->url->path, full);
@@ -2018,13 +2018,14 @@
 		camel_object_unhook_event((CamelObject *)o, "summary_reloaded", (CamelObjectEventHookFunc) summary_reloaded, data);
 	}
 	
+	/*
 	m = camel_session_thread_msg_new(session, &folder_flags_ops, sizeof(*m));
 	m->sub = summary->folder;
 	camel_object_ref((CamelObject *)summary->folder);
 	m->vf = vf;
 	camel_object_ref((CamelObject *)vf);
 	camel_session_thread_queue(session, &m->msg, 0);
-	
+	*/
 }
 
 /* vfolder base implementaitons */
@@ -2099,6 +2100,94 @@
 	CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
 }
 
+/* This entire code will be useless, since we sync the counts always. */
+static int
+vf_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
+{
+	CamelFolder *folder = (CamelFolder *)object;
+	int i;
+	guint32 tag;
+	int unread = -1, deleted = 0, junked = 0, visible = 0, count = -1, junked_not_deleted = -1;
+
+	for (i=0;i<args->argc;i++) {
+		CamelArgGet *arg = &args->argv[i];
+
+		tag = arg->tag;
+
+		/* NB: this is a copy of camel-folder.c with the unread count logic altered.
+		   makes sure its still atomically calculated */
+		switch (tag & CAMEL_ARG_TAG) {
+		case CAMEL_FOLDER_ARG_UNREAD:
+		case CAMEL_FOLDER_ARG_DELETED:
+		case CAMEL_FOLDER_ARG_JUNKED:
+		case CAMEL_FOLDER_ARG_JUNKED_NOT_DELETED:	
+		case CAMEL_FOLDER_ARG_VISIBLE:
+			
+			/* This is so we can get the values atomically, and also so we can calculate them only once */
+			if (unread == -1) {
+				int j;
+				CamelMessageInfoBase *info;
+				CamelVeeMessageInfo *vinfo;
+
+				unread = deleted = visible = junked = junked_not_deleted = 0;
+				count = camel_folder_summary_count(folder->summary);
+				for (j=0; j<count; j++) {
+					if ((info = (CamelMessageInfoBase *) camel_folder_summary_index(folder->summary, j))) {
+						guint32 flags;
+
+						vinfo = (CamelVeeMessageInfo *) info;
+						flags = vinfo->old_flags;// ? vinfo->old_flags : camel_message_info_flags(info);
+
+						if ((flags & (CAMEL_MESSAGE_SEEN)) == 0)
+							unread++;
+						if (flags & CAMEL_MESSAGE_DELETED)
+							deleted++;
+						if (flags & CAMEL_MESSAGE_JUNK) {
+							junked++;
+								if (! (flags & CAMEL_MESSAGE_DELETED))
+									junked_not_deleted++;						
+						}
+						if ((flags & (CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_JUNK)) == 0)
+							visible++;
+						camel_message_info_free(info);
+					}
+				}
+			}
+
+			switch (tag & CAMEL_ARG_TAG) {
+			case CAMEL_FOLDER_ARG_UNREAD:
+				count = unread == -1 ? 0 : unread;
+				break;
+			case CAMEL_FOLDER_ARG_DELETED:
+				count = deleted == -1 ? 0 : deleted;
+				break;
+			case CAMEL_FOLDER_ARG_JUNKED:
+				count = junked == -1 ? 0 : junked;
+				break;
+			case CAMEL_FOLDER_ARG_JUNKED_NOT_DELETED:
+				count = junked_not_deleted == -1 ? 0 : junked_not_deleted;
+				break;				
+			case CAMEL_FOLDER_ARG_VISIBLE:
+				count = visible == -1 ? 0 : visible;
+				break;
+			}
+			folder->summary->unread_count = unread == -1 ? 0 : unread;
+			folder->summary->deleted_count = deleted == -1 ? 0 : deleted;
+			junked = folder->summary->junk_count = junked == -1 ? 0 : junked;
+			folder->summary->junk_not_deleted_count = junked_not_deleted == -1 ? 0 : junked_not_deleted;
+			folder->summary->visible_count = visible == -1 ? 0 : visible;			
+			*arg->ca_int = count;
+			break;
+		default:
+			continue;
+		}
+
+		arg->tag = (tag & CAMEL_ARG_TYPE) | CAMEL_ARG_IGNORE;
+	}
+
+	return ((CamelObjectClass *)camel_vee_folder_parent)->getv(object, ex, args);
+}
+
 static void
 camel_vee_folder_class_init (CamelVeeFolderClass *klass)
 {
@@ -2106,6 +2195,8 @@
 
 	camel_vee_folder_parent = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
 
+	((CamelObjectClass *)klass)->getv = vf_getv; 
+
 	folder_class->refresh_info = vee_refresh_info;
 	folder_class->sync = vee_sync;
 	folder_class->expunge = vee_expunge;

Modified: trunk/camel/camel-vee-summary.c
==============================================================================
--- trunk/camel/camel-vee-summary.c	(original)
+++ trunk/camel/camel-vee-summary.c	Mon Dec 15 06:34:32 2008
@@ -176,20 +176,33 @@
 {
 	int res = FALSE;
 	CamelVeeFolder *vf = (CamelVeeFolder *)mi->summary->folder;
-	const char *exp = g_getenv("CAMEL_VFOLDER_UNREAD_EXP");
+	static char *exp = NULL;
+	static only_once = FALSE;
 	gboolean hacked_unread_folder = FALSE;
+	char *meta = NULL;
 
 	/* HACK: Ugliest of all hacks. Its virtually not possible now
 	 * to maintain counts and the non matching uids of unread vfolder here.
 	 * So, I hardcode unread vfolder expression and hack it. */
+	if (!only_once) {
+		exp =  g_getenv("CAMEL_VFOLDER_UNREAD_EXP") ? g_strcompress(g_getenv("CAMEL_VFOLDER_UNREAD_EXP")) : NULL;
+		only_once = TRUE;
+	}
+
 	if (!exp || !*exp)
-		exp = unread_str;
+		exp = g_strcompress(unread_str);
+
 	if (camel_debug("vfolderexp"))
 		printf("Expression for vfolder '%s' is '%s'\n", mi->summary->folder->full_name, g_strescape(vf->expression, ""));
 
 	if (strstr(exp, vf->expression) &&  (vf->flags & CAMEL_STORE_VEE_FOLDER_SPECIAL) == 0)
 		hacked_unread_folder = TRUE;
 
+	meta = camel_object_meta_get (mi->summary->folder, "vfolder:unread");
+	if (!hacked_unread_folder && meta && strcmp (meta, "true") == 0)
+		hacked_unread_folder = TRUE;
+	g_free(meta);
+
 	if (mi->uid) {
 		guint32 old_visible, old_unread, old_deleted, old_junked, old_junked_not_deleted;
 		guint32 visible, unread, deleted, junked, junked_not_deleted;
@@ -418,7 +431,7 @@
 {
 	CamelVeeMessageInfo *mi;
 	char *vuid;
-
+	GHashTable * fcache;
 	vuid = g_malloc(strlen(uid)+9);
 	memcpy(vuid, hash, 8);
 	strcpy(vuid+8, uid);
@@ -441,6 +454,8 @@
 
 	mi = (CamelVeeMessageInfo *)camel_message_info_new(&s->summary);
 	mi->summary = summary;
+	fcache = camel_folder_summary_get_flag_cache(summary);
+	mi->old_flags = GPOINTER_TO_UINT(g_hash_table_lookup (fcache, uid));
 	/* We would do lazy loading of flags, when the folders are loaded to memory through folder_reloaded signal */
 	camel_object_ref (summary);
 	mi->info.uid = (char *) camel_pstring_strdup (vuid);

Modified: trunk/camel/camel-vtrash-folder.c
==============================================================================
--- trunk/camel/camel-vtrash-folder.c	(original)
+++ trunk/camel/camel-vtrash-folder.c	Mon Dec 15 06:34:32 2008
@@ -151,7 +151,7 @@
 						guint32 flags;
 
 						vinfo = (CamelVeeMessageInfo *) info;
-						flags = vinfo->old_flags ? vinfo->old_flags : camel_message_info_flags(info);
+						flags = vinfo->old_flags;// ? vinfo->old_flags : camel_message_info_flags(info);
 
 						if ((flags & (CAMEL_MESSAGE_SEEN)) == 0)
 							unread++;

Modified: trunk/docs/reference/addressbook/libebook/tmpl/e-contact.sgml
==============================================================================
--- trunk/docs/reference/addressbook/libebook/tmpl/e-contact.sgml	(original)
+++ trunk/docs/reference/addressbook/libebook/tmpl/e-contact.sgml	Mon Dec 15 06:34:32 2008
@@ -736,6 +736,13 @@
 @E_CONTACT_IM_GADUGADU: 
 @E_CONTACT_GEO: 
 @E_CONTACT_TEL: 
+ E_CONTACT_IM_SKYPE_HOME_1: 
+ E_CONTACT_IM_SKYPE_HOME_2: 
+ E_CONTACT_IM_SKYPE_HOME_3: 
+ E_CONTACT_IM_SKYPE_WORK_1: 
+ E_CONTACT_IM_SKYPE_WORK_2: 
+ E_CONTACT_IM_SKYPE_WORK_3: 
+ E_CONTACT_IM_SKYPE: 
 @E_CONTACT_FIELD_LAST: 
 @E_CONTACT_FIELD_FIRST: 
 @E_CONTACT_LAST_SIMPLE_STRING: 

Modified: trunk/docs/reference/camel/tmpl/camel-unused.sgml
==============================================================================
--- trunk/docs/reference/camel/tmpl/camel-unused.sgml	(original)
+++ trunk/docs/reference/camel/tmpl/camel-unused.sgml	Mon Dec 15 06:34:32 2008
@@ -186,6 +186,30 @@
 camel-search-private
 
 
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Title ##### -->
+camel-search-sql-sexp.h
+
+
 <!-- ##### SECTION ./tmpl/camel-types.sgml:Long_Description ##### -->
 <para>
 



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