differentiate disk full and socket errors
authorColin Leroy <colin@colino.net>
Tue, 8 Oct 2002 19:44:00 +0000 (19:44 +0000)
committerColin Leroy <colin@colino.net>
Tue, 8 Oct 2002 19:44:00 +0000 (19:44 +0000)
ChangeLog.claws
configure.in
src/inc.c
src/inc.h
src/pop.c
src/recv.c

index 24d570ca82d625b9e1ba0e8957e4ffadcf3a4918..4a9ba4c7f4b3e76ae40c0d9a087534759b866c47 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-08 [colin]     0.8.5claws2
+
+       * src/inc.[ch]
+         src/pop.c
+         src/recv.c
+               Differentiate socket errors from disk full
+               errors
+
 2002-10-08 [christoph] 0.8.5claws1
 
        * Makefile.am
index fe3b86c536b27b4701af65ae3251189fe198896f..fefea704d626ceaddbffe8b95a7e5d858d2df828 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws1
+EXTRA_VERSION=claws2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 7dc89e417a10ee0b48da2d1b1a6cec5cf6d01e28..108b627ebe95d911d607bdfa4336fbf48bbd863b 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -551,6 +551,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                        break;
                case INC_ERROR:
                case INC_NOSPACE:
+               case INC_SOCKERR:
                        gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
                        gtk_clist_set_text(clist, num, 2, _("Error"));
                        break;
@@ -635,7 +636,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
                if (inc_state != INC_SUCCESS && inc_state != INC_CANCEL) {
                        error_num++;
-                       if (inc_state == INC_NOSPACE) {
+                       if (inc_state == INC_NOSPACE || inc_state == INC_SOCKERR) {
                                inc_put_error(inc_state);
                                break;
                        }
@@ -828,6 +829,9 @@ static IncState inc_pop3_session_do(IncSession *session)
        case PS_IOERR:
                session->inc_state = INC_NOSPACE;
                break;
+       case PS_SOCKET:
+               session->inc_state = INC_SOCKERR;
+               break;
        case PS_LOCKBUSY:
                session->inc_state = INC_LOCKED;
                break;
@@ -1046,6 +1050,9 @@ static void inc_put_error(IncState istate)
        case INC_NOSPACE:
                alertpanel_error(_("No disk space left."));
                break;
+       case INC_SOCKERR:
+               alertpanel_error(_("Socket error."));
+               break;
        case INC_LOCKED:
                if (!prefs_common.no_recv_err_panel)
                        alertpanel_error(_("Mailbox is locked."));
index 0c444b761cf2f5f757b809c683204a1d97d2f280..4a52e473ddf0e810bf1c715d2581b9adebf18c0f 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -45,6 +45,7 @@ typedef enum
        INC_LOCKED,
        INC_ERROR,
        INC_NOSPACE,
+       INC_SOCKERR,
        INC_CANCEL
 } IncState;
 
index 1f201e3429ec1200d09d6a01f4d884ba5b626f0d..5f884d7922ad9f003ad71f0a5d92675d70a80e49 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -462,7 +462,7 @@ gint pop3_top_recv(SockInfo *sock, gpointer data)
        Pop3State *state = (Pop3State *)data;
        gchar *filename, *path;
        gint next_state;
-       
+       gint write_val;
        if (pop3_ok(sock, NULL) != PS_SUCCESS) 
                return POP3_LOGOUT_SEND;
 
@@ -473,8 +473,8 @@ gint pop3_top_recv(SockInfo *sock, gpointer data)
        
        filename = g_strdup_printf("%s%i", path, state->cur_msg);
                                   
-       if (recv_write_to_file(sock, filename) < 0) {
-               state->error_val = PS_IOERR;
+       if ( (write_val = recv_write_to_file(sock, filename)) < 0) {
+               state->error_val = (write_val == -1 ? PS_IOERR : PS_SOCKET);
                return -1;
        }
 
@@ -502,12 +502,13 @@ gint pop3_retr_recv(SockInfo *sock, gpointer data)
        gchar *file;
        gint ok, drop_ok;
        gint next_state;
+       gint write_val;
        if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
                file = get_tmp_file();
-               if (recv_write_to_file(sock, file) < 0) {
+               if ( (write_val = recv_write_to_file(sock, file)) < 0) {
                        g_free(file);
                        if (!state->cancelled)
-                               state->error_val = PS_IOERR;
+                               state->error_val = (write_val == -1 ? PS_IOERR : PS_SOCKET);
                        return -1;
                }
 
index 902a62fc34b9154b46abf0baa0d51b8aad15d248..fbcb48b9242073e0e15afc8d4fe9137fd46199ef 100644 (file)
@@ -40,7 +40,7 @@ static gpointer               recv_ui_func_data;
 gint recv_write_to_file(SockInfo *sock, const gchar *filename)
 {
        FILE *fp;
-
+       int write_val;
        g_return_val_if_fail(filename != NULL, -1);
 
        if ((fp = fopen(filename, "wb")) == NULL) {
@@ -52,10 +52,10 @@ gint recv_write_to_file(SockInfo *sock, const gchar *filename)
        if (change_file_mode_rw(fp, filename) < 0)
                FILE_OP_ERROR(filename, "chmod");
 
-       if (recv_write(sock, fp) < 0) {
+       if ( (write_val = recv_write(sock, fp)) < 0) {
                fclose(fp);
                unlink(filename);
-               return -1;
+               return write_val;
        }
 
        if (fclose(fp) == EOF) {
@@ -110,7 +110,7 @@ gint recv_write(SockInfo *sock, FILE *fp)
        for (;;) {
                if (sock_gets(sock, buf, sizeof(buf)) < 0) {
                        g_warning(_("error occurred while retrieving data.\n"));
-                       return -1;
+                       return -2;
                }
 
                len = strlen(buf);