diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-07-25 07:10:21 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-25 07:10:21 +0800 |
commit | b4fa8e15a8014442a0a21cc121cedda16cdc272a (patch) | |
tree | 9ac726858a046c2cb277fbc2f1ab42d50993a81a /camel/providers/imap/camel-imap-store.c | |
parent | 0b016c6fa1ec3d14fec25d59f882c2d6cffd6e1f (diff) | |
download | gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar.gz gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar.bz2 gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar.lz gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar.xz gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.tar.zst gsoc2013-evolution-b4fa8e15a8014442a0a21cc121cedda16cdc272a.zip |
Initialize the summary and subfolder listing. (imap_summary_free): Now
2000-07-24 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (camel_imap_folder_new):
Initialize the summary and subfolder listing.
(imap_summary_free): Now takes a GPtrArray arg rather than a
CamelImapFolder as it increases it's usefullness for free()'ing
temporary summaries.
(imap_get_message_count_internal): A new convenience function for
getting the actual message count on a server to be used by
imap_get_summary_internal)
(imap_get_message_count): Since the Camel API is on the move again,
the future version of this function will not be able to make a
call to the store, it must only access previously fetched data (thus
the creation of the _internal function)
(imap_get_subfolder_names_internal): Again, because the future version
of imap_get_subfolder_names will not take an exception, we must rename
this function which will be called by camel_imap_folder_new()
(imap_get_subfolder_names): We now return the previously collected
subfolder listing that the _internal function fetched previously
(imap_get_summary_internal): Again, same idea as the previous _internal
functions...
(imap_get_summary): Again... now returns a previously aquired summary
* providers/imap/camel-imap-store.c (imap_noop): This will hopefully
prevent the imap store from disconnecting.
(imap_connect): Modified to add a gtk timeout event that will call
imap_noop() every 10 minutes (we may want to change this time value)
(imap_disconnect): Modified to remove the NOOP timeout event from the
store.
(camel_imap_command_extended): Commented out the code that would try
and detect if the store was disconnected and then reconnect if it was
needed.
svn path=/trunk/; revision=4298
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 777dc26e25..2554588461 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -65,6 +65,8 @@ static char *get_name (CamelService *service, gboolean brief); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create, 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 int camel_imap_status (char *cmdid, char *respbuf); static void @@ -105,6 +107,8 @@ camel_imap_store_init (gpointer object, gpointer klass) store->folders = g_hash_table_new (g_str_hash, g_str_equal); CAMEL_IMAP_STORE (store)->dir_sep = NULL; + CAMEL_IMAP_STORE (store)->current_folder = NULL; + CAMEL_IMAP_STORE (store)->timeout_id = 0; } GtkType @@ -270,7 +274,12 @@ imap_connect (CamelService *service, CamelException *ex) gchar *buf, *msg, *result, *errbuf = NULL; gboolean authenticated = FALSE; - + /* FIXME: do we really need this here? */ + if (store->timeout_id) { + gtk_timeout_remove (store->timeout_id); + store->timeout_id = 0; + } + h = camel_service_gethost (service, ex); if (!h) return FALSE; @@ -412,6 +421,9 @@ 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); return TRUE; } @@ -450,6 +462,11 @@ imap_disconnect (CamelService *service, CamelException *ex) store->dir_sep = NULL; store->current_folder = NULL; + + if (store->timeout_id) { + gtk_timeout_remove (store->timeout_id); + store->timeout_id = 0; + } return TRUE; } @@ -618,6 +635,20 @@ get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex) } static gboolean +imap_noop (gpointer data) +{ + CamelImapStore *store = CAMEL_IMAP_STORE (data); + char *result; + int status; + + status = camel_imap_command_extended (store, store->current_folder, &result, "NOOP"); + + g_free (result); + + return TRUE; +} + +static gboolean stream_is_alive (CamelStream *istream) { CamelStreamFs *fs_stream; @@ -791,7 +822,8 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** gchar *cmdid, *cmdbuf, *respbuf; GPtrArray *data; va_list app; - + +#if 0 /* First make sure we're connected... */ if (!service->connected || !stream_is_alive (store->istream)) { CamelException *ex; @@ -809,6 +841,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** camel_exception_free (ex); } +#endif if (folder && store->current_folder != folder && strncmp (fmt, "CREATE", 6)) { /* We need to select the correct mailbox first */ @@ -864,7 +897,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** if (!respbuf || !strncmp (respbuf, cmdid, strlen (cmdid))) { /* IMAP's last response starts with our command id */ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)")); - +#if 0 if (!respbuf && strcmp (fmt, "LOGOUT")) { /* we need to force a disconnect here? */ CamelException *ex; @@ -873,6 +906,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** imap_disconnect (service, ex); camel_exception_free (ex); } +#endif break; } |