aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-18 02:11:42 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-18 02:11:42 +0000
commit6c99f53cc0cec575d9ee2b954f856d2848cc126f (patch)
tree056db18786315de4c2e35998454314394f1a2324
parentdb6cafdaf9a350bfda9435cfc035e00d1fd4401a (diff)
remote mailbox: added timeout. Show dialog on error.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2033 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.ja4
-rw-r--r--src/rpop3.c53
3 files changed, 58 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6010f6d9..5caf8a98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-18
+
+ * src/rpop3.c: added timeout. Show dialog on error.
+
2008-09-17
* libsylph/pop.c
diff --git a/ChangeLog.ja b/ChangeLog.ja
index c7d58b60..03bea20b 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,7 @@
+2008-09-18
+
+ * src/rpop3.c: タイムアウトを追加。エラー時にダイアログを表示。
+
2008-09-17
* libsylph/pop.c
diff --git a/src/rpop3.c b/src/rpop3.c
index 78048fdd..d6cc2bc9 100644
--- a/src/rpop3.c
+++ b/src/rpop3.c
@@ -51,6 +51,7 @@
#include "gtkutils.h"
#include "manage_window.h"
#include "alertpanel.h"
+#include "prefs_common.h"
#define POP3_TOP (N_POP3_STATE + 1000)
#define POP3_TOP_RECV (N_POP3_STATE + 1001)
@@ -211,6 +212,8 @@ gint rpop3_account(PrefsAccount *account)
}
}
+ session_set_timeout(session, prefs_common.io_timeout_secs * 1000);
+
ret = rpop3_start(session);
while (!rpop3_window.finished)
@@ -350,18 +353,62 @@ static gint rpop3_start(Session *session)
{
g_return_val_if_fail(session != NULL, -1);
- rpop3_status_label_set(_("Connecting to %s:%d"),
+ rpop3_status_label_set(_("Connecting to %s:%d ..."),
session->server, session->port);
if (session_connect(session, session->server, session->port) < 0) {
- log_warning(_("Can't connect to POP3 server: %s:%d\n"),
- session->server, session->port);
+ manage_window_focus_in(rpop3_window.window, NULL, NULL);
+ alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
+ session->server, session->port);
return -1;
}
while (session_is_connected(session))
gtk_main_iteration();
+ switch (POP3_SESSION(session)->error_val) {
+ case PS_AUTHFAIL:
+ manage_window_focus_in(rpop3_window.window, NULL, NULL);
+ if (POP3_SESSION(session)->error_msg)
+ alertpanel_error(_("Authentication failed:\n%s"),
+ POP3_SESSION(session)->error_msg);
+ else
+ alertpanel_error(_("Authentication failed."));
+ return -1;
+ case PS_SUCCESS:
+ break;
+ default:
+ manage_window_focus_in(rpop3_window.window, NULL, NULL);
+ if (POP3_SESSION(session)->error_msg)
+ alertpanel_error
+ (_("Error occurred during POP3 session:\n%s"),
+ POP3_SESSION(session)->error_msg);
+ else
+ alertpanel_error(_("Error occurred during POP3 session."));
+ return -1;
+ }
+
+ switch (session->state) {
+ case SESSION_EOF:
+ manage_window_focus_in(rpop3_window.window, NULL, NULL);
+ alertpanel_error(_("Connection closed by the remote host."));
+ return -1;
+ case SESSION_TIMEOUT:
+ manage_window_focus_in(rpop3_window.window, NULL, NULL);
+ alertpanel_error(_("Session timed out."));
+ return -1;
+ case SESSION_ERROR:
+ 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"),
+ session->server, session->port);
+ else
+ alertpanel_error(_("Error occurred during POP3 session."));
+ return -1;
+ default:
+ break;
+ }
+
return 0;
}