diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-07-25 11:45:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-25 11:45:55 +0800 |
commit | 6a601c210be648e1cb61da744a715656027aa175 (patch) | |
tree | ac100996d459b6d9ccdc496b114af5caa7c04f07 /camel | |
parent | f2aca892ee6085ce48240a1ebd2897a56d1e8989 (diff) | |
download | gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar.gz gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar.bz2 gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar.lz gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar.xz gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.tar.zst gsoc2013-evolution-6a601c210be648e1cb61da744a715656027aa175.zip |
Updated to give special attention to the root folder.
2000-07-24 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-store.c (get_folder): Updated to give special
attention to the root folder.
* providers/imap/camel-imap-folder.c (imap_get_subfolder_names_internal):
Updated to handle the root folder
(imap_get_message_count_internal): return 0 if folder can't hold messages
(camel_imap_folder_new): Change so that root folder gets special attention
and always gets can_hold_messages set to FALSE
svn path=/trunk/; revision=4308
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 11 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 11 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.h | 3 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 49 |
4 files changed, 50 insertions, 24 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index a778fbbf7d..d221224436 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,14 @@ +2000-07-24 Jeffrey Stedfast <fejj@helixcode.com> + + * providers/imap/camel-imap-store.c (get_folder): Updated to give special + attention to the root folder. + + * providers/imap/camel-imap-folder.c (imap_get_subfolder_names_internal): + Updated to handle the root folder + (imap_get_message_count_internal): return 0 if folder can't hold messages + (camel_imap_folder_new): Change so that root folder gets special attention + and always gets can_hold_messages set to FALSE + 2000-07-24 Dan Winship <danw@helixcode.com> * camel-folder.c: Remove exceptions from a number of methods that diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index a8e4a7d602..6651e77d61 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -180,12 +180,16 @@ CamelFolder * camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex) { CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL)); + CamelURL *url = CAMEL_SERVICE (parent)->url; char *dir_sep; dir_sep = CAMEL_IMAP_STORE (parent)->dir_sep; CF_CLASS (folder)->init (folder, parent, NULL, folder_name, dir_sep, FALSE, ex); - + + if (!strcmp (folder_name, url->path + 1)) + folder->can_hold_messages = FALSE; + imap_get_subfolder_names_internal (folder, ex); imap_get_summary_internal (folder, ex); @@ -369,6 +373,7 @@ imap_get_message_count_internal (CamelFolder *folder, CamelException *ex) gint status, count = 0; g_return_val_if_fail (folder != NULL, 0); + g_return_val_if_fail (folder->can_hold_messages, 0); dir_sep = CAMEL_IMAP_STORE (folder->parent_store)->dir_sep; @@ -684,8 +689,10 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex) dir_sep = CAMEL_IMAP_STORE (folder->parent_store)->dir_sep; if (url && url->path) { - if (!strcmp (folder->full_name, "INBOX")) + if (!strcmp (folder->full_name, url->path + 1)) namespace = g_strdup (url->path + 1); + else if (!strcmp (folder->full_name, "INBOX")) + namespace = g_strdup (url->path + 1); /* FIXME: erm...not sure */ else namespace = g_strdup_printf ("%s%s%s", url->path + 1, dir_sep, folder->full_name); } else { diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h index ba2d1daa70..fed98d311c 100644 --- a/camel/providers/imap/camel-imap-folder.h +++ b/camel/providers/imap/camel-imap-folder.h @@ -62,7 +62,8 @@ typedef struct { /* public methods */ CamelFolder *camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex); -void camel_imap_folder_set_namespace (CamelFolder *folder, gchar *namespace); + +void camel_imap_folder_changed (CamelFolder *folder, CamelException *ex); /* Standard Gtk function */ GtkType camel_imap_folder_get_type (void); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 2554588461..a8f6f8c6f0 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -66,7 +66,7 @@ static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboo CamelException *ex); static char *get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex); static gboolean imap_noop (gpointer data); -static gboolean stream_is_alive (CamelStream *istream); +/*static gboolean stream_is_alive (CamelStream *istream);*/ static int camel_imap_status (char *cmdid, char *respbuf); static void @@ -171,7 +171,7 @@ try_connect (CamelService *service, CamelException *ex) memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr)); fd = socket (h->h_addrtype, SOCK_STREAM, 0); - if (fd == -1 || connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) { + if (fd == -1 || connect (fd, (struct sockaddr *)&sin, sizeof (sin)) == -1) { /* We don't want to set a CamelException here */ @@ -423,7 +423,7 @@ imap_connect (CamelService *service, CamelException *ex) } /* Lets add a timeout so that we can hopefully prevent getting disconnected */ - store->timeout_id = gtk_timeout_add (60000, imap_noop, store); + store->timeout_id = gtk_timeout_add (600000, imap_noop, store); return TRUE; } @@ -594,6 +594,7 @@ folder_is_selectable (CamelStore *store, const char *folder_path) static CamelFolder * get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex) { + CamelURL *url = CAMEL_SERVICE (store)->url; CamelFolder *new_folder; char *folder_path, *dir_sep; @@ -601,28 +602,27 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx g_return_val_if_fail (folder_name != NULL, NULL); dir_sep = CAMEL_IMAP_STORE (store)->dir_sep; - + if (!strcmp (folder_name, dir_sep)) - folder_path = g_strdup ("INBOX"); + folder_path = g_strdup (url->path + 1); else folder_path = g_strdup (folder_name); - + new_folder = camel_imap_folder_new (store, folder_path, ex); -#if 0 - if (camel_exception_is_set (ex)) { - camel_exception_clear (ex); - g_free (folder_path); - return NULL; - } -#endif + + if (!strcmp (folder_name, dir_sep)) + return new_folder; + if (create && !imap_create (new_folder, ex)) { - if (!folder_is_selectable (store, folder_path)) + if (!folder_is_selectable (store, folder_path)) { camel_exception_clear (ex); - - g_free (folder_path); - /* FIXME: destroy new_folder */ - - return NULL; + new_folder->can_hold_messages = FALSE; + return new_folder; + } else { + g_free (folder_path); + gtk_object_unref (GTK_OBJECT (new_folder)); + return NULL; + } } return new_folder; @@ -648,6 +648,7 @@ imap_noop (gpointer data) return TRUE; } +#if 0 static gboolean stream_is_alive (CamelStream *istream) { @@ -664,6 +665,7 @@ stream_is_alive (CamelStream *istream) return FALSE; } +#endif static int camel_imap_status (char *cmdid, char *respbuf) @@ -970,8 +972,13 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** g_ptr_array_free (data, TRUE); - if (folder && recent > 0) - gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed", 0); + if (folder && recent > 0) { + CamelException *ex; + + ex = camel_exception_new (); + camel_imap_folder_changed (folder, ex); + camel_exception_free (ex); + } return status; } |