aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-06-03 01:50:26 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-06-03 01:50:26 +0800
commit95d963dec575e1c6f451d36b0870e92c0de6cde3 (patch)
tree12faf7d49494c8a190f11e84b8e8b24f51038c20
parent3bf07b8693c59ce11edb1eff5e2ae301d1a66544 (diff)
downloadgsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.gz
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.bz2
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.lz
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.xz
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.zst
gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.zip
** This and jeffs patch for #43862.
2003-06-02 Not Zed <NotZed@Ximian.com> ** This and jeffs patch for #43862. * mail-folder-cache.c (store_online_cb): If the store is still around, then flow on to a get folderinfo update, otherwise just clear up. * mail-ops.c (mail_store_set_offline): return the msgid of this so it can be cancelled. 2003-05-30 Jeffrey Stedfast <fejj@ximian.com> * mail-folder-cache.c (mail_note_store): If the session is 'online' and we are noting a CamelDiscoStore, make sure that it is changed to online status and call mail_get_folderinfo(). svn path=/trunk/; revision=21369
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/mail-folder-cache.c47
-rw-r--r--mail/mail-ops.c6
-rw-r--r--mail/mail-ops.h6
4 files changed, 64 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 567c5057f2..5933f09baa 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2003-06-02 Not Zed <NotZed@Ximian.com>
+
+ ** This and jeffs patch for #43862.
+
+ * mail-folder-cache.c (store_online_cb): If the store is still
+ around, then flow on to a get folderinfo update, otherwise just
+ clear up.
+
+ * mail-ops.c (mail_store_set_offline): return the msgid of this so
+ it can be cancelled.
+
+2003-05-30 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-folder-cache.c (mail_note_store): If the session is
+ 'online' and we are noting a CamelDiscoStore, make sure that it is
+ changed to online status and call mail_get_folderinfo().
+
2003-05-30 Jeffrey Stedfast <fejj@ximian.com>
* mail-local.c (load_metainfo): Stat the XML file before trying to
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 2ec4e72912..6803119733 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -42,6 +42,7 @@
#include "mail-mt.h"
#include "mail-folder-cache.h"
#include "mail-ops.h"
+#include "mail-session.h"
/* For notifications of changes */
#include "mail-vfolder.h"
@@ -640,7 +641,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
struct _update_data {
struct _update_data *next;
struct _update_data *prev;
-
+
int id; /* id for cancellation */
void (*done)(CamelStore *store, CamelFolderInfo *info, void *data);
@@ -799,6 +800,25 @@ ping_cb (gpointer user_data)
return TRUE;
}
+static void
+store_online_cb (CamelStore *store, void *data)
+{
+ struct _update_data *ud = data;
+
+ LOCK(info_lock);
+
+ if (g_hash_table_lookup(stores, store) != NULL) {
+ /* re-use the cancel id. we're already in the store update list too */
+ ud->id = mail_get_folderinfo(store, update_folders, ud);
+ } else {
+ /* the store vanished, that means we were probably cancelled, or at any rate,
+ need to clean ourselves up */
+ g_free(ud);
+ }
+
+ UNLOCK(info_lock);
+}
+
void
mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage,
void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data)
@@ -849,16 +869,27 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St
camel_object_hook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL);
}
-
- if (!CAMEL_IS_DISCO_STORE (store) ||
- camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_ONLINE ||
- camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) {
+ /* We might get a race when setting up a store, such that it is still left in offline mode,
+ after we've gone online. This catches and fixes it up when the shell opens us */
+ if (CAMEL_IS_DISCO_STORE(store)
+ && camel_session_is_online(session)
+ && camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) {
ud = g_malloc(sizeof(*ud));
ud->done = done;
ud->data = data;
- ud->id = mail_get_folderinfo(store, update_folders, ud);
-
- e_dlist_addtail(&si->folderinfo_updates, (EDListNode *)ud);
+ /* Note: we use the 'id' here, even though its not the right id, its still ok */
+ ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud);
+
+ e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud);
+ } else if (!CAMEL_IS_DISCO_STORE(store)
+ || camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_ONLINE
+ || camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) {
+ ud = g_malloc (sizeof (*ud));
+ ud->done = done;
+ ud->data = data;
+ ud->id = mail_get_folderinfo (store, update_folders, ud);
+
+ e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud);
}
UNLOCK(info_lock);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 787614f19b..f3469bf3e6 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -2269,12 +2269,13 @@ static struct _mail_msg_op set_offline_op = {
set_offline_free,
};
-void
+int
mail_store_set_offline (CamelStore *store, gboolean offline,
void (*done)(CamelStore *, void *data),
void *data)
{
struct _set_offline_msg *m;
+ int id;
/* Cancel any pending connect first so the set_offline_op
* thread won't get queued behind a hung connect op.
@@ -2289,7 +2290,10 @@ mail_store_set_offline (CamelStore *store, gboolean offline,
m->data = data;
m->done = done;
+ id = m->msg.seq;
e_thread_put(mail_thread_queued, (EMsg *)m);
+
+ return id;
}
/* ** Execute Shell Command ***************************************************** */
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 49dd8d5d85..47b082b0ff 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -156,9 +156,9 @@ void mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids);
void mail_prep_offline(const char *uri, CamelOperation *cancel,
void (*done)(const char *, void *data),
void *data);
-void mail_store_set_offline(CamelStore *store, gboolean offline,
- void (*done)(CamelStore *, void *data),
- void *data);
+int mail_store_set_offline(CamelStore *store, gboolean offline,
+ void (*done)(CamelStore *, void *data),
+ void *data);
/* filter driver execute shell command async callback */
void mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, void *data);