evolution-data-server r8920 - branches/camel-db-summary/camel
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8920 - branches/camel-db-summary/camel
- Date: Thu, 5 Jun 2008 04:03:08 +0000 (UTC)
Author: psankar
Date: Thu Jun 5 04:03:08 2008
New Revision: 8920
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8920&view=rev
Log:
Give uid . get message info
Modified:
branches/camel-db-summary/camel/camel-folder-summary.c
branches/camel-db-summary/camel/camel-folder-summary.h
Modified: branches/camel-db-summary/camel/camel-folder-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.c (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.c Thu Jun 5 04:03:08 2008
@@ -363,33 +363,18 @@
camel_folder_summary_index (CamelFolderSummary *s, int i)
{
CamelMessageInfo *info = NULL;
- int ret;
CAMEL_SUMMARY_LOCK(s, summary_lock);
CAMEL_SUMMARY_LOCK(s, ref_lock);
- while (i < s->uids->len && !info) {
+ if (i < s->uids->len) {
char *uid;
-
uid = g_ptr_array_index (s->uids, i);
- info = g_hash_table_lookup (s->loaded_infos, uid);
- if (!info) {
- CamelDB *cdb;
- CamelException ex;// May be this should come from the caller
- char *folder_name;
-
- d(printf ("\ncamel_folder_summary_index called \n"));
- camel_exception_init (&ex);
- s->flags &= ~CAMEL_SUMMARY_DIRTY;
-
- folder_name = s->folder->full_name;
- cdb = s->folder->parent_store->cdb;
-
- ret = camel_db_read_message_info_record_with_uid (cdb, folder_name, uid, (gpointer**) &s, camel_read_mir_callback, &ex);
- if (ret != 0)
- return NULL;
- }
+ /* FIXME: Get exception from caller
+ and pass it on below */
+
+ info = camel_folder_summary_uid (s, uid);
}
CAMEL_SUMMARY_UNLOCK(s, ref_lock);
@@ -528,19 +513,40 @@
* Returns the summary item, or %NULL if the uid @uid is not available
**/
CamelMessageInfo *
-camel_folder_summary_uid(CamelFolderSummary *s, const char *uid)
+camel_folder_summary_uid (CamelFolderSummary *s, const char *uid)
{
CamelMessageInfo *info;
+ int ret;
CAMEL_SUMMARY_LOCK(s, summary_lock);
CAMEL_SUMMARY_LOCK(s, ref_lock);
-#error "Implement this"
-#if 0
- info = g_hash_table_lookup(s->messages_uid, uid);
- if (info)
- info->refcount++;
-#endif
+ info = g_hash_table_lookup (s->loaded_infos, uid);
+
+ if (!info) {
+ CamelDB *cdb;
+ CamelException ex;// May be this should come from the caller
+ char *folder_name;
+
+ d(printf ("\ncamel_folder_summary_uid called \n"));
+ camel_exception_init (&ex);
+ s->flags &= ~CAMEL_SUMMARY_DIRTY;
+
+ folder_name = s->folder->full_name;
+ cdb = s->folder->parent_store->cdb;
+
+ ret = camel_db_read_message_info_record_with_uid (cdb, folder_name, uid, (gpointer**) &s, camel_read_mir_callback, &ex);
+ if (ret != 0)
+ return NULL;
+
+ info = g_hash_table_lookup (s->loaded_infos, uid);
+
+ if (!info) {
+ /* Makes no sense now as the exception is local as of now. FIXME: Pass exception from caller */
+ camel_exception_set (&ex, CAMEL_EXCEPTION_SYSTEM, _(g_strdup_printf ("no uid [%s] exists", uid)));
+ }
+ }
+
CAMEL_SUMMARY_UNLOCK(s, ref_lock);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
Modified: branches/camel-db-summary/camel/camel-folder-summary.h
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.h (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.h Thu Jun 5 04:03:08 2008
@@ -359,6 +359,8 @@
int camel_folder_summary_count(CamelFolderSummary *summary);
CamelMessageInfo *camel_folder_summary_index(CamelFolderSummary *summary, int index);
CamelMessageInfo *camel_folder_summary_uid(CamelFolderSummary *summary, const char *uid);
+char * camel_folder_summary_uid_from_index (CamelFolderSummary *s, int i);
+
GPtrArray *camel_folder_summary_array(CamelFolderSummary *summary);
void camel_folder_summary_array_free(CamelFolderSummary *summary, GPtrArray *array);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]