aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c23
-rw-r--r--camel/providers/imap/camel-imap-message-cache.c3
-rw-r--r--camel/providers/imap/camel-imap-store.c12
3 files changed, 26 insertions, 12 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index ef5cec4656..1a2f5a79e9 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -478,9 +478,12 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
/* If the folder isn't selected, select it (which will force
* a rescan if one is needed).
- */
+ * Also, if this is the INBOX, some servers (cryus) wont tell
+ * us with a NOOP of new messages, so force a reselect which
+ * should do it. */
CAMEL_SERVICE_LOCK (imap_store, connect_lock);
- if (imap_store->current_folder != folder) {
+ if (imap_store->current_folder != folder
+ || strcasecmp(folder->full_name, "INBOX") == 0) {
CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
response = camel_imap_command (imap_store, folder, ex, NULL);
if (response) {
@@ -498,6 +501,14 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
if (imap_folder->need_rescan)
imap_rescan (folder, camel_folder_summary_count (folder->summary), ex);
else {
+#if 0
+ /* on some servers need to CHECKpoint INBOX to recieve new messages?? */
+ /* rfc2060 suggests this, but havent seen a server that requires it */
+ if (strcasecmp(folder->full_name, "INBOX") == 0) {
+ response = camel_imap_command (imap_store, folder, ex, "CHECK");
+ camel_imap_response_free (imap_store, response);
+ }
+#endif
response = camel_imap_command (imap_store, folder, ex, "NOOP");
camel_imap_response_free (imap_store, response);
}
@@ -1853,6 +1864,8 @@ get_message_simple (CamelImapFolder *imap_folder, const char *uid,
stream);
camel_object_unref (CAMEL_OBJECT (stream));
if (ret == -1) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Unable to retrieve message: %s"), strerror(errno));
camel_object_unref (CAMEL_OBJECT (msg));
return NULL;
}
@@ -1886,7 +1899,11 @@ imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
return NULL;
mi = camel_folder_summary_uid (folder->summary, uid);
- g_return_val_if_fail (mi != NULL, NULL);
+ if (mi == NULL) {
+ camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ _("Cannot get message: %s\n %s"), uid, _("No such message"));
+ return NULL;
+ }
/* If the message is small, fetch it in one piece. */
if (mi->size < IMAP_SMALL_BODY_SIZE) {
diff --git a/camel/providers/imap/camel-imap-message-cache.c b/camel/providers/imap/camel-imap-message-cache.c
index b29a2280ef..0701ca45e4 100644
--- a/camel/providers/imap/camel-imap-message-cache.c
+++ b/camel/providers/imap/camel-imap-message-cache.c
@@ -395,6 +395,9 @@ camel_imap_message_cache_get (CamelImapMessageCache *cache, const char *uid,
CamelStream *stream;
char *path, *key;
+ if (uid[0] == 0)
+ return NULL;
+
path = g_strdup_printf ("%s/%s.%s", cache->path, uid, part_spec);
key = strrchr (path, '/') + 1;
stream = g_hash_table_lookup (cache->parts, key);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 7eb3c3accb..af4192e0c6 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -179,20 +179,14 @@ camel_imap_store_finalize (CamelObject *object)
{
CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
+ /* This frees current_folder, folders, authtypes, streams, and namespace. */
+ camel_service_disconnect((CamelService *)imap_store, TRUE, NULL);
+
if (imap_store->summary) {
camel_store_summary_save((CamelStoreSummary *)imap_store->summary);
camel_object_unref(imap_store->summary);
}
- if (imap_store->istream)
- camel_object_unref (CAMEL_OBJECT (imap_store->istream));
-
- if (imap_store->ostream)
- camel_object_unref (CAMEL_OBJECT (imap_store->ostream));
-
- /* This frees current_folder, folders, authtypes, and namespace. */
- imap_disconnect_offline (CAMEL_SERVICE (object), FALSE, NULL);
-
if (imap_store->base_url)
g_free (imap_store->base_url);
if (imap_store->storage_path)