aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-18 08:32:08 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-18 08:32:08 +0000
commit2a5d526422c62ec5da7102b5626f3c0992b508c2 (patch)
tree2c8e57e0250c664efebbd39691f149cc4bff102f /src
parente20432b598c36964f03a33fed255d051e0a90b23 (diff)
remote mailbox: enabled cancellation on connection.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2035 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/rpop3.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/rpop3.c b/src/rpop3.c
index 308040bf..e14adec7 100644
--- a/src/rpop3.c
+++ b/src/rpop3.c
@@ -378,11 +378,15 @@ static gint rpop3_start(Session *session)
return -1;
}
- while (session_is_connected(session))
+ while (session_is_connected(session)) {
+ if (session->state == SESSION_READY && rpop3_window.cancelled)
+ break;
gtk_main_iteration();
+ }
switch (POP3_SESSION(session)->error_val) {
case PS_AUTHFAIL:
+ session_disconnect(session);
manage_window_focus_in(rpop3_window.window, NULL, NULL);
if (POP3_SESSION(session)->error_msg)
alertpanel_error(_("Authentication failed:\n%s"),
@@ -393,6 +397,7 @@ static gint rpop3_start(Session *session)
case PS_SUCCESS:
break;
default:
+ session_disconnect(session);
manage_window_focus_in(rpop3_window.window, NULL, NULL);
if (POP3_SESSION(session)->error_msg)
alertpanel_error
@@ -405,14 +410,17 @@ static gint rpop3_start(Session *session)
switch (session->state) {
case SESSION_EOF:
+ session_disconnect(session);
manage_window_focus_in(rpop3_window.window, NULL, NULL);
alertpanel_error(_("Connection closed by the remote host."));
return -1;
case SESSION_TIMEOUT:
+ session_disconnect(session);
manage_window_focus_in(rpop3_window.window, NULL, NULL);
alertpanel_error(_("Session timed out."));
return -1;
case SESSION_ERROR:
+ session_disconnect(session);
manage_window_focus_in(rpop3_window.window, NULL, NULL);
if (POP3_SESSION(session)->state == POP3_READY)
alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
@@ -420,7 +428,14 @@ static gint rpop3_start(Session *session)
else
alertpanel_error(_("Error occurred during POP3 session."));
return -1;
+ case SESSION_READY:
+ session_disconnect(session);
+ debug_print("Session cancelled.\n");
+ return -1;
+ case SESSION_DISCONNECTED:
+ break;
default:
+ session_disconnect(session);
break;
}