aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog20
-rw-r--r--camel/camel-folder.c7
-rw-r--r--camel/providers/imap/camel-imap-folder.c29
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c9
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c60
5 files changed, 64 insertions, 61 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 7ef5319d97..ddf99cac76 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,23 @@
+2000-10-19 Dan Winship <danw@helixcode.com>
+
+ * camel-folder.c (camel_folder_refresh_info): Update comment here
+ so refresh_info isn't just for reconnects any more. Make the
+ default implementation a no-op rather than an error.
+
+ * providers/nntp/camel-nntp-folder.c: Move refresh_info impl into
+ camel_nntp_folder_new, since it would have leaked memory and not
+ done anything useful if it was called later.
+
+ * providers/mbox/camel-mbox-folder.c: Remove no-longer-necessary
+ refresh_info impl.
+
+ * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
+ Update imap_folder->exists, but don't actually load the new
+ messages. This is a temporary workaround to deal with the IMAP
+ provider stealing the message list focus at annoying times.
+ (imap_copy_message_to, imap_move_message_to): Emit a
+ folder_changed by hand, for now.
+
2000-10-19 Ettore Perazzoli <ettore@helixcode.com>
* providers/imap/Makefile.am (libcamelimapinclude_HEADERS): Add
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 9b38f79e53..792d3c5d01 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -251,8 +251,7 @@ camel_folder_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
static void
refresh_info (CamelFolder *folder, CamelException *ex)
{
- g_warning ("CamelFolder::refresh_info not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
+ /* No op */
}
/**
@@ -260,9 +259,7 @@ refresh_info (CamelFolder *folder, CamelException *ex)
* @folder: The folder object
* @ex: exception object
*
- * Updates a folder's summary to be in sync with its backing store
- * (called upon creation and when the store's connection is lost
- * and then reestablished).
+ * Updates a folder's summary to be in sync with its backing store.
**/
void
camel_folder_refresh_info (CamelFolder *folder, CamelException *ex)
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 38dd495eac..cd9e374bc6 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -475,9 +475,16 @@ imap_copy_message_to (CamelFolder *source, const char *uid,
uid, folder_path);
camel_imap_response_free (response);
g_free (folder_path);
+
+ /* FIXME: This should go away once folder_changed is being
+ * emitted by camel_imap_folder_changed on appends again.
+ */
+ if (!camel_exception_is_set (ex)) {
+ camel_object_trigger_event (CAMEL_OBJECT (destination),
+ "folder_changed", NULL);
+ }
}
-/* FIXME: Duplication of code! */
static void
imap_move_message_to (CamelFolder *source, const char *uid,
CamelFolder *destination, CamelException *ex)
@@ -495,6 +502,12 @@ imap_move_message_to (CamelFolder *source, const char *uid,
if (camel_exception_is_set (ex))
return;
+ /* FIXME: This should go away once folder_changed is being
+ * emitted by camel_imap_folder_changed on appends again.
+ */
+ camel_object_trigger_event (CAMEL_OBJECT (destination),
+ "folder_changed", NULL);
+
camel_folder_delete_message (source, uid);
}
@@ -804,17 +817,13 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
for (i = 0; i < expunged->len; i++) {
id = g_array_index (expunged, int, i);
- d(fprintf (stderr, "Expunging message %d from the summary (i = %d)\n", id + i, i));
- camel_folder_summary_remove_index (imap_folder->summary, id - 1);
+ camel_folder_summary_remove_index (
+ imap_folder->summary, id - 1);
}
+ camel_object_trigger_event (CAMEL_OBJECT (folder),
+ "folder_changed", NULL);
}
- if (exists > imap_folder->exists) {
- int old = imap_folder->exists;
-
+ if (exists != 0)
imap_folder->exists = exists;
- imap_update_summary (folder, old + 1, exists, ex);
- }
-
- camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", NULL);
}
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 55e2916ed4..9f8dcce3c0 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -56,7 +56,6 @@ static CamelFolderClass *parent_class = NULL;
#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static void mbox_refresh_info (CamelFolder *folder, CamelException *ex);
static void mbox_sync(CamelFolder *folder, gboolean expunge, CamelException *ex);
static gint mbox_get_message_count(CamelFolder *folder);
static gint mbox_get_unread_message_count(CamelFolder *folder);
@@ -94,7 +93,6 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->refresh_info = mbox_refresh_info;
camel_folder_class->sync = mbox_sync;
camel_folder_class->get_message_count = mbox_get_message_count;
camel_folder_class->get_unread_message_count = mbox_get_unread_message_count;
@@ -228,13 +226,6 @@ camel_mbox_folder_new(CamelStore *parent_store, const char *full_name, guint32 f
}
static void
-mbox_refresh_info (CamelFolder *folder, CamelException *ex)
-{
- /* we are always in a consistent state, or fix it when we need to */
- return;
-}
-
-static void
mbox_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
{
CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index e04571ef36..c9fb19373a 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -58,38 +58,6 @@ static CamelFolderClass *parent_class=NULL;
static void
-nntp_refresh_info (CamelFolder *folder, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
-
- /* load the summary if we have that ability */
- if (folder->has_summary_capability) {
- const gchar *root_dir_path;
-
- root_dir_path = camel_nntp_store_get_toplevel_dir (CAMEL_NNTP_STORE(folder->parent_store));
-
- nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary",
- root_dir_path,
- folder->name);
-
- nntp_folder->summary = camel_folder_summary_new ();
- camel_folder_summary_set_filename (nntp_folder->summary,
- nntp_folder->summary_file_path);
-
- if (-1 == camel_folder_summary_load (nntp_folder->summary)) {
- /* Bad or nonexistant summary file */
- camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store,
- nntp_folder, ex);
- if (camel_exception_get_id (ex))
- return;
-
- /* XXX check return value */
- camel_folder_summary_save (nntp_folder->summary);
- }
- }
-}
-
-static void
nntp_folder_sync (CamelFolder *folder, gboolean expunge,
CamelException *ex)
{
@@ -295,7 +263,6 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->refresh_info = nntp_refresh_info;
camel_folder_class->sync = nntp_folder_sync;
camel_folder_class->get_message_count = nntp_folder_get_message_count;
camel_folder_class->set_message_flags = nntp_folder_set_message_flags;
@@ -331,14 +298,33 @@ CamelFolder *
camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelException *ex)
{
CamelFolder *folder = CAMEL_FOLDER (camel_object_new (CAMEL_NNTP_FOLDER_TYPE));
+ CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
+ const gchar *root_dir_path;
camel_folder_construct (folder, parent, folder_name, folder_name);
folder->has_summary_capability = TRUE;
- camel_folder_refresh_info (folder, ex);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- folder = NULL;
+ root_dir_path = camel_nntp_store_get_toplevel_dir (CAMEL_NNTP_STORE(folder->parent_store));
+ nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary",
+ root_dir_path,
+ folder->name);
+
+ nntp_folder->summary = camel_folder_summary_new ();
+ camel_folder_summary_set_filename (nntp_folder->summary,
+ nntp_folder->summary_file_path);
+
+ if (-1 == camel_folder_summary_load (nntp_folder->summary)) {
+ /* Bad or nonexistant summary file */
+ camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store,
+ nntp_folder, ex);
+ if (camel_exception_get_id (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ return NULL;
+ }
+
+ /* XXX check return value */
+ camel_folder_summary_save (nntp_folder->summary);
}
+
return folder;
}