aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-10-17 05:00:59 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-10-17 05:00:59 +0800
commitff8aed099f0921cde2c5797167a476b7eb185eab (patch)
tree6cb2ee21134265507d5c7f83dc28d904fd5a5839 /camel
parent8b23fc59ea35cf92650e0d3ec5bdbf4c75b19e15 (diff)
downloadgsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar.gz
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar.bz2
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar.lz
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar.xz
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.tar.zst
gsoc2013-evolution-ff8aed099f0921cde2c5797167a476b7eb185eab.zip
Only send the LOGOUT command if the store is connected. (imap_connect):
2000-10-16 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (imap_disconnect): Only send the LOGOUT command if the store is connected. (imap_connect): Set the 'connected' state to TRUE when we successfully connect. (get_folder_info): if (!topfi), 'topfi' was allocated but then 'fi' was set. I think Dan meant to set topfi since fi is an uninitialized value at this point. * providers/imap/camel-imap-command.c (imap_read_response): Check for the untagged BYE response and set the 'connected' state to FALSE if we receive the BYE response. Return NULL if we get a BYE response. svn path=/trunk/; revision=5944
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog21
-rw-r--r--camel/providers/imap/camel-imap-command.c11
-rw-r--r--camel/providers/imap/camel-imap-store.c25
-rw-r--r--camel/providers/imap/camel-imap-store.h2
4 files changed, 47 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d2e8bc5805..34cf859bcd 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+2000-10-16 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * providers/imap/camel-imap-store.c (imap_disconnect): Only send
+ the LOGOUT command if the store is connected.
+ (imap_connect): Set the 'connected' state to TRUE when we
+ successfully connect.
+ (get_folder_info): if (!topfi), 'topfi' was allocated but then
+ 'fi' was set. I think Dan meant to set topfi since fi is an
+ uninitialized value at this point.
+
+ * providers/imap/camel-imap-command.c (imap_read_response): Check
+ for the untagged BYE response and set the 'connected' state to
+ FALSE if we receive the BYE response. Return NULL if we get a BYE
+ response.
+
2000-10-16 Dan Winship <danw@helixcode.com>
* providers/imap/camel-imap-store.c (get_folder_info): Deal with
@@ -70,7 +85,8 @@
Fix camel_summary_* function rename
(imap_get_message_info_internal): Likewise.
- * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a spelling mistake.
+ * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a
+ spelling mistake.
* camel-folder-summary.c (camel_summary_format_address): Uh, why
do we encode and then decode here ... sigh. This is not the way
@@ -82,7 +98,8 @@
2000-10-11 Chris Toshok <toshok@helixcode.com>
- * providers/nntp/camel-nntp-store.c (nntp_store_unsubscribe_folder): remove the leading '/'.
+ * providers/nntp/camel-nntp-store.c
+ (nntp_store_unsubscribe_folder): remove the leading '/'.
(nntp_store_subscribe_folder): same.
(nntp_store_folder_subscribed): same.
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index ea1f3aaccf..7a6045d16d 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -170,6 +170,15 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
g_free (respbuf);
goto next;
}
+ } else {
+ p = imap_next_word (respbuf);
+ if (!g_strncasecmp (p, "BYE", 3)) {
+ /* connection was lost, no more data to fetch */
+ store->connected = FALSE;
+ g_free (respbuf);
+ respbuf = NULL;
+ break;
+ }
}
g_ptr_array_add (response->untagged, respbuf);
@@ -187,7 +196,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
if (expunged)
g_array_free (expunged, TRUE);
- if (camel_exception_is_set (ex)) {
+ if (!respbuf || camel_exception_is_set (ex)) {
camel_imap_response_free (response);
return NULL;
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index a561cab96d..6ad48107b1 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -108,11 +108,13 @@ camel_imap_store_init (gpointer object, gpointer klass)
CAMEL_SERVICE_URL_NEED_HOST |
CAMEL_SERVICE_URL_ALLOW_PATH |
CAMEL_SERVICE_URL_ALLOW_AUTH);
-
+
remote_store->default_port = 143;
imap_store->dir_sep = NULL;
imap_store->current_folder = NULL;
+
+ imap_store->connected = FALSE;
}
CamelType
@@ -259,6 +261,9 @@ imap_connect (CamelService *service, CamelException *ex)
}
}
+ /* At this point we know we're connected... */
+ store->connected = TRUE;
+
/* Now lets find out the IMAP capabilities */
response = camel_imap_command (store, NULL, ex, "CAPABILITY");
if (!response)
@@ -324,11 +329,13 @@ imap_disconnect (CamelService *service, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
CamelImapResponse *response;
-
- /* send the logout command */
- response = camel_imap_command (store, NULL, ex, "LOGOUT");
- camel_imap_response_free (response);
-
+
+ if (store->connected) {
+ /* send the logout command */
+ response = camel_imap_command (store, NULL, ex, "LOGOUT");
+ camel_imap_response_free (response);
+ }
+
g_free (store->dir_sep);
store->dir_sep = NULL;
@@ -416,7 +423,7 @@ static CamelFolder *
get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex)
{
CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelFolder *new_folder;
+ CamelFolder *new_folder = NULL;
char *folder_path, *summary_file, *p;
gboolean selectable;
@@ -554,8 +561,8 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
if (!topfi) {
camel_exception_clear (ex);
topfi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup (namespace);
- fi->name = g_strdup (namespace);
+ topfi->full_name = g_strdup (namespace);
+ topfi->name = g_strdup (namespace);
}
response = camel_imap_command (imap_store, NULL, ex,
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index a211457dbe..3c492c5aa3 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -57,6 +57,8 @@ typedef struct {
gboolean has_status_capability;
gchar *dir_sep, *storage_path;
+
+ gboolean connected;
} CamelImapStore;