evolution r36243 - branches/mail-dbus-remoting/mail



Author: sragavan
Date: Mon Sep  1 18:10:18 2008
New Revision: 36243
URL: http://svn.gnome.org/viewvc/evolution?rev=36243&view=rev

Log:
Add apis to deal with summaries (search, get summary)


Modified:
   branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c
   branches/mail-dbus-remoting/mail/camel-folder-remote.c

Modified: branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c	Mon Sep  1 18:10:18 2008
@@ -293,6 +293,32 @@
 
 		unread = camel_folder_get_unread_message_count(folder);
 		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &unread, DBUS_TYPE_INVALID);
+	} else if (strcmp(method, "camel_folder_get_summary_ptr") == 0) {
+		gboolean ret;
+		int ptr;
+
+		ret = dbus_message_get_args (message, NULL,
+				DBUS_TYPE_STRING, &folder_hash_key,
+				DBUS_TYPE_INVALID);
+		folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+
+		ptr = folder->summary;
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &ptr, DBUS_TYPE_INVALID);
+	} else if (strcmp(method, "camel_folder_search_by_expression") == 0) {
+		gboolean ret;
+		char *exp;
+		gpointer uids;
+		CamelException ex;
+
+		camel_exception_init(&ex);
+		ret = dbus_message_get_args (message, NULL,
+				DBUS_TYPE_STRING, &folder_hash_key,									 
+				DBUS_TYPE_STRING, &exp,
+				DBUS_TYPE_INVALID);
+		folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+
+		uids = camel_folder_search_by_expression (folder, exp,  &ex);
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &uids, DBUS_TYPE_INVALID);
 	} else if (strcmp (method, "camel_vee_folder_set_expression") == 0) {
 			gboolean ret;
 			const char *query; 

Modified: branches/mail-dbus-remoting/mail/camel-folder-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote.c	Mon Sep  1 18:10:18 2008
@@ -144,7 +144,7 @@
 {
 	gboolean ret;
 	DBusError error;
-	char *store_hash_key;
+	char *store_hash_key = NULL;
 	CamelObjectRemote *rstore=NULL;
 
 	dbus_error_init (&error);
@@ -158,7 +158,7 @@
 			"s=>s", folder->object_id, &store_hash_key); 
 
 	if (!ret) {
-		g_warning ("Error: Get parent store from camel folder remote: %s\n", error.message);
+		 g_warning ("Error: Get parent store from camel folder remote: %s %s\n", error.message, store_hash_key);
 		return NULL;
 	}
 
@@ -503,6 +503,64 @@
 	return unread;
 }
 
+gpointer
+camel_folder_crude_get_summary (CamelFolderRemote *folder)
+{
+	gboolean ret;
+	DBusError error;
+	int ptr;
+	gpointer summary;
+	
+	dbus_error_init (&error);
+	/* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+	ret = dbind_context_method_call (evolution_dbus_peek_context(), 
+			CAMEL_DBUS_NAME,
+			CAMEL_FOLDER_OBJECT_PATH,
+			CAMEL_FOLDER_INTERFACE,
+			"camel_folder_get_summary_ptr",
+			&error, 
+			"s=>i", folder->object_id, &ptr); 
+
+	if (!ret) {
+		g_warning ("Error: Camel folder get unread message count: %s\n", error.message);
+		return 0;
+	}
+
+	summary = (gpointer) ptr;
+	d(printf("Camel folder get unread message count remotely\n"));
+	
+	return summary;
+}
+
+gpointer
+camel_folder_remote_search_by_expression (CamelFolderRemote *folder, char *exp, CamelException *ex)
+{
+	gboolean ret;
+	DBusError error;
+	int ptr;
+	gpointer uids;
+
+	dbus_error_init (&error);
+	/* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+	ret = dbind_context_method_call (evolution_dbus_peek_context(), 
+			CAMEL_DBUS_NAME,
+			CAMEL_FOLDER_OBJECT_PATH,
+			CAMEL_FOLDER_INTERFACE,
+			"camel_folder_search_by_expression",
+			&error, "ss=>i", folder->object_id, exp, &ptr); 
+
+	if (!ret) {
+		g_warning ("Error: Camel folder get unread message count: %s\n", error.message);
+		return 0;
+	}
+
+	uids = (gpointer) ptr;
+	d(printf("Camel folder get unread message count remotely\n"));
+	
+	return uids;
+}
+
+
 void
 camel_folder_remote_set_vee_folder_expression (CamelFolderRemote *folder, const char *query)
 {



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