diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-17 07:31:34 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-17 07:31:34 +0800 |
commit | d103befa6dce296f571319c0b69700b1f06d4a83 (patch) | |
tree | f570bff7dff692580118577bb330f00600a64063 /camel | |
parent | a7da845f7f90ea4be385b10ef8f9001c3ceebce9 (diff) | |
download | gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar.gz gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar.bz2 gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar.lz gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar.xz gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.tar.zst gsoc2013-evolution-d103befa6dce296f571319c0b69700b1f06d4a83.zip |
If we are online and message flags have changed in the current folder,
2001-08-16 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (imap_keepalive): If we are
online and message flags have changed in the current folder, sync
the flags else do a NOOP. This fixes bug #4666. Also lock around
the NOOP command.
* providers/imap/camel-imap-folder.c (imap_sync_online): Don't
ever send "STORE FLAGS.SILENT ()" since Cyrus imapd doesn't like
this (and maybe others too?) so what we'll do instead is to send
"STORE -FLAGS.SILENT (\Seen \Answered \Deleted \Marked)" to clear
all the flags (since this is in essence what we want to do
anyway).
svn path=/trunk/; revision=12136
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 23 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 10 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 46 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.h | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-utils.c | 11 |
5 files changed, 61 insertions, 33 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 71e7942b4f..28c7f6ba77 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,10 @@ 2001-08-16 Jeffrey Stedfast <fejj@ximian.com> + * providers/imap/camel-imap-store.c (imap_keepalive): If we are + online and message flags have changed in the current folder, sync + the flags else do a NOOP. This fixes bug #4666. Also lock around + the NOOP command. + * providers/imap/camel-imap-folder.c (imap_sync_online): Don't ever send "STORE FLAGS.SILENT ()" since Cyrus imapd doesn't like this (and maybe others too?) so what we'll do instead is to send @@ -9,22 +14,22 @@ 2001-08-16 Peter Williams <peterw@ximian.com> - * providers/imap/camel-imap-store.c (imap_connect_online): Fix this - again. Sigh. Problem of namespace = "" may not yet be completely - solved. + * providers/imap/camel-imap-store.c (imap_connect_online): Fix + this again. Sigh. Problem of namespace = "" may not yet be + completely solved. 2001-08-15 Peter Williams <peterw@ximian.com> - * camel-tcp-stream-openssl.c (ssl_error_to_errno): New function. Try - to approximate the SSL error into errno. - (errlib_error_to_errno): New function, try to approximate OpenSSl's - error library's error (ERR_*) into errno. + * camel-tcp-stream-openssl.c (ssl_error_to_errno): New + function. Try to approximate the SSL error into errno. + (errlib_error_to_errno): New function, try to approximate + OpenSSl's error library's error (ERR_*) into errno. (stream_read): Try to set errno using ssl_error_to_errno. (stream_write): Same. (open_ssl_connection): Same. - * providers/imap/camel-imap-store.c (imap_connect_online): Oh crap, - huge killer typo. + * providers/imap/camel-imap-store.c (imap_connect_online): Oh + crap, huge killer typo. 2001-08-14 Peter Williams <peterw@ximian.com> diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index d6ac6d3c82..a0eec3a67b 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -677,7 +677,7 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) /* Save the summary */ imap_sync_offline (folder, ex); - + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } @@ -685,7 +685,7 @@ static void imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { int i; - + for (i = 0; i < uids->len; i++) { camel_folder_summary_remove_uid (folder->summary, uids->pdata[i]); /* We intentionally don't remove it from the cache because @@ -693,7 +693,7 @@ imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException */ } camel_folder_summary_save (folder->summary); - + camel_disco_diary_log (CAMEL_DISCO_STORE (folder->parent_store)->diary, CAMEL_DISCO_DIARY_FOLDER_EXPUNGE, folder, uids); } @@ -704,7 +704,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); CamelImapResponse *response; char *set; - + set = imap_uid_array_to_set (folder->summary, uids); CAMEL_IMAP_STORE_LOCK (store, command_lock); response = camel_imap_command (store, folder, ex, @@ -717,7 +717,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * g_free (set); return; } - + if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { response = camel_imap_command (store, folder, ex, "UID EXPUNGE %s", set); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index fb47561d0c..cde667d9cc 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -157,9 +157,9 @@ camel_imap_store_finalize (CamelObject *object) g_free (imap_store->storage_path); #ifdef ENABLE_THREADS - e_mutex_destroy(imap_store->priv->command_lock); + e_mutex_destroy (imap_store->priv->command_lock); #endif - g_free(imap_store->priv); + g_free (imap_store->priv); } static void @@ -175,14 +175,14 @@ camel_imap_store_init (gpointer object, gpointer klass) imap_store->current_folder = NULL; imap_store->connected = FALSE; imap_store->subscribed_folders = NULL; - + imap_store->tag_prefix = imap_tag_prefix++; if (imap_tag_prefix > 'Z') imap_tag_prefix = 'A'; - + imap_store->priv = g_malloc0 (sizeof (*imap_store->priv)); #ifdef ENABLE_THREADS - imap_store->priv->command_lock = e_mutex_new(E_MUTEX_REC); + imap_store->priv->command_lock = e_mutex_new (E_MUTEX_REC); #endif } @@ -1487,12 +1487,46 @@ unsubscribe_folder (CamelStore *store, const char *folder_name, camel_folder_info_free (fi); } +static gboolean +folder_flags_have_changed (CamelFolder *folder) +{ + CamelMessageInfo *info; + int i, max; + + max = camel_folder_summary_count (folder->summary); + for (i = 0; i < max; i++) { + info = camel_folder_summary_index (folder->summary, i); + if (!info) + continue; + if (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) { + return TRUE; + } + } + + return FALSE; +} + static void imap_keepalive (CamelRemoteStore *store) { CamelImapStore *imap_store = CAMEL_IMAP_STORE (store); CamelImapResponse *response; - + + /* FIXME: should this check to see if we are online? */ + + /* Note: the idea here is to sync the flags of our currently + selected folder if there have been changes... */ + + if (imap_store->current_folder && folder_flags_have_changed (imap_store->current_folder)) { + camel_folder_sync (imap_store->current_folder, FALSE, NULL); + } + + /* ...but we also want to NOOP so that we get an untagged response. */ + + CAMEL_IMAP_STORE_LOCK (store, command_lock); + response = camel_imap_command (imap_store, NULL, NULL, "NOOP"); camel_imap_response_free (imap_store, response); + + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h index accbc8b9ae..c467d6066b 100644 --- a/camel/providers/imap/camel-imap-store.h +++ b/camel/providers/imap/camel-imap-store.h @@ -61,13 +61,13 @@ typedef enum { struct _CamelImapStore { CamelDiscoStore parent_object; struct _CamelImapStorePrivate *priv; - + /* Information about the command channel / connection status */ gboolean connected; char tag_prefix; guint32 command; CamelFolder *current_folder; - + /* Information about the server */ CamelImapServerLevel server_level; guint32 capabilities, parameters; diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index df8ddc4f0e..ce547a5198 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -549,17 +549,6 @@ imap_parse_body (char **body_p, CamelFolder *folder, *body_p = body; } -static void -strip (char *str, char c) -{ - char *src, *dst; - - for (src = dst = str; *src; src++) - if (*src != c) - *dst++ = *src; - *dst = '\0'; -} - /** * imap_quote_string: * @str: the string to quote, which must not contain CR or LF |