evolution-data-server r9232 - in trunk/camel: . providers/imap
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9232 - in trunk/camel: . providers/imap
- Date: Thu, 31 Jul 2008 05:00:29 +0000 (UTC)
Author: sragavan
Date: Thu Jul 31 05:00:29 2008
New Revision: 9232
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9232&view=rev
Log:
2008-07-31 Srinivasa Ragavan <sragavan novell com>
* camel/camel-db.c: Add delete folder functionality.
* camel/camel-folder-summary.c: Added code to check if the uid exists
in summary.
* camel/camel-folder-summary.h:
2008-07-31 Srinivasa Ragavan <sragavan novell com>
* camel/providers/imap/camel-imap-message-cache.c: Fix delete cache
code, when the summary is deleted.
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-db.c
trunk/camel/camel-folder-summary.c
trunk/camel/camel-folder-summary.h
trunk/camel/providers/imap/ChangeLog
trunk/camel/providers/imap/camel-imap-message-cache.c
Modified: trunk/camel/camel-db.c
==============================================================================
--- trunk/camel/camel-db.c (original)
+++ trunk/camel/camel-db.c Thu Jul 31 05:00:29 2008
@@ -447,18 +447,6 @@
}
int
-camel_db_delete_folder (CamelDB *cdb, const char *folder, CamelException *ex)
-{
- char *tab = sqlite3_mprintf ("DELETE FROM folders WHERE folder_name =%Q", folder);
- int ret;
-
- ret = camel_db_command (cdb, tab, ex);
- sqlite3_free (tab);
- CAMEL_DB_RELEASE_SQLITE_MEMORY;
- return ret;
-}
-
-int
camel_db_create_vfolder (CamelDB *db, const char *folder_name, CamelException *ex)
{
int ret;
@@ -924,7 +912,23 @@
return ret;
}
+int
+camel_db_delete_folder (CamelDB *cdb, const char *folder, CamelException *ex)
+{
+ int ret;
+ char *del;
+ del = sqlite3_mprintf ("DELETE FROM folders WHERE folder_name = %Q", folder);
+ ret = camel_db_command (cdb, del, ex);
+ sqlite3_free (del);
+
+ del = sqlite3_mprintf ("DROP TABLE %Q ", folder);
+ ret = camel_db_command (cdb, del, ex);
+ sqlite3_free (del);
+
+ CAMEL_DB_RELEASE_SQLITE_MEMORY;
+ return ret;
+}
void
camel_db_camel_mir_free (CamelMIRecord *record)
Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c (original)
+++ trunk/camel/camel-folder-summary.c Thu Jul 31 05:00:29 2008
@@ -428,6 +428,35 @@
}
+/**
+ * camel_folder_summary_check_uid
+ * @s: a #CamelFolderSummary object
+ * @uid: a uid
+ *
+ * Check if the uid is valid. This isn't very efficient, so it shouldn't be called iteratively.
+ *
+ *
+ * Returns: if the uid is present in the summary or not (%TRUE or %FALSE)
+ **/
+gboolean
+camel_folder_summary_check_uid (CamelFolderSummary *s, const char *uid)
+{
+ gboolean ret = FALSE;
+ int i;
+
+ CAMEL_SUMMARY_LOCK(s, summary_lock);
+
+ for (i=0; i<s->uids->len; i++) {
+ if(strcmp(s->uids->pdata[i], uid) == 0) {
+ CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+ return TRUE;
+ }
+ }
+
+ CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+
+ return ret;
+}
/**
* camel_folder_summary_array:
Modified: trunk/camel/camel-folder-summary.h
==============================================================================
--- trunk/camel/camel-folder-summary.h (original)
+++ trunk/camel/camel-folder-summary.h Thu Jul 31 05:00:29 2008
@@ -390,6 +390,7 @@
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);
+gboolean camel_folder_summary_check_uid (CamelFolderSummary *s, const char *uid);
GPtrArray *camel_folder_summary_array(CamelFolderSummary *summary);
Modified: trunk/camel/providers/imap/camel-imap-message-cache.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-message-cache.c (original)
+++ trunk/camel/providers/imap/camel-imap-message-cache.c Thu Jul 31 05:00:29 2008
@@ -178,17 +178,11 @@
else
uid = g_strdup (dname);
- #warning "this could be wrong"
- if (summary->loaded_infos && g_hash_table_lookup (summary->loaded_infos, uid))
+ if (camel_folder_summary_check_uid(summary, uid))
cache_put (cache, uid, dname, NULL);
+ else
+ g_ptr_array_add (deletes, g_strdup_printf ("%s/%s", cache->path, dname));
- /*
- info = camel_folder_summary_uid (summary, uid);
- if (info) {
- camel_message_info_free(info);
- cache_put (cache, uid, dname, NULL);
- } else
- g_ptr_array_add (deletes, g_strdup_printf ("%s/%s", cache->path, dname)); */
g_free (uid);
}
g_dir_close (dir);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]