sync with 0.9.3cvs15
authorPaul Mangan <paul@claws-mail.org>
Tue, 22 Jul 2003 11:38:24 +0000 (11:38 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 22 Jul 2003 11:38:24 +0000 (11:38 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/common/session.c
src/common/session.h
src/inc.c
src/inc.h
src/send_message.c

index 4966f84..68e7ece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+2003-07-22
+
+       * src/session.[ch]:
+         session_read_msg_cb()
+         session_read_data_cb(): fixed a bug that ran into infinite loop
+         if connection was closed by remote host (thanks to Yoichi Imai).
+         Added SESSION_EOF state to SessionState.
+         session_is_connected(): new.
+       * src/inc.[ch]: inc_put_error()
+         src/send_message.c: send_put_error(): also put log messages.
+
+2003-07-18
+
+       * more optimization of IMAP4.
+       * src/folder.[ch]: added a method add_msgs() that adds multiple files
+         to a folder.
+         Removed redundant scan() for the operations of FolderItem.
+       * src/imap.[ch]: implemented Folder::add_msgs() and optimized move
+         and copy from other Folder instances.
+       * src/mh.[ch]: implemented Folder::add_msgs() and cleaned up the code.
+         mh_fetch_msg(): scan folder if required.
+       * src/procmsg.[ch]: procmsg_get_message_file_list(): returns file
+         list from message list.
+       * src/summaryview.c: don't remove MSG_MARKED flags on
+         delete/move/copy operation.
+         summary_display_msg_full(): removed redundant message fetching.
+
+2003-07-17
+
+       * optimized move/copy/delete/mark operations of IMAP4 by using
+         sequence set when issuing commands (adopted claws' implementation
+         with cleaning it up).
+       * src/imap.[ch]:
+         imap_set_message_flags()
+         imap_cmd_envelope()
+         imap_cmd_copy()
+         imap_cmd_store(): take sequence set string instead of UID number.
+         imap_do_copy_msgs_with_dest(): optimized by using sequence set.
+         imap_cmd_fetch(): use BODY.PEEK instead of BODY.
+         imap_remove_all_msg()
+         imap_set_message_flags(): use FLAGS.SILENT instead of FLAGS.
+       * src/compose.c
+         src/summaryview.c: use imap_msg_list_{set,unset}_perm_flags()
+         instead of issuing commands for each message.
+
 2003-07-15
 
        * src/inc.c
index 80f84e8..b104e31 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-22 [paul]      0.9.3claws38
+
+       * sync with 0.9.3cvs15
+               see ChangeLog 2003-07-22
+
 2003-07-20 [alfons]    0.9.3claws37
 
        * src/compose.c
index 3034b4f..2c67d5d 100644 (file)
@@ -1,3 +1,48 @@
+2003-07-22
+
+       * src/session.[ch]:
+         session_read_msg_cb()
+         session_read_data_cb(): ¥ê¥â¡¼¥È¥Û¥¹¥È¤Ë¤è¤Ã¤ÆÀܳ¤òÀÚÃǤµ¤ì¤¿¾ì¹ç
+         ¤Ë̵¸Â¥ë¡¼¥×¤Ë´Ù¤ë¥Ð¥°¤ò½¤Àµ(º£°æ¤µ¤ó thanks)¡£
+         SessionState ¤Ë SESSION_EOF ¤òÄɲá£
+         session_is_connected(): ¿·µ¬¡£
+       * src/inc.[ch]: inc_put_error()
+         src/send_message.c: send_put_error(): ¥í¥°¥á¥Ã¥»¡¼¥¸¤â¶¦¤Ë½ÐÎÏ¡£
+
+2003-07-18
+
+       * IMAP4 ¤Î¤µ¤é¤Ê¤ëºÇŬ²½¡£
+       * src/folder.[ch]: Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò¥Õ¥©¥ë¥À¤ËÄɲ乤ë¥á¥½¥Ã¥É
+         add_msgs() ¤òÄɲá£
+         FolderItem Áàºî¤Î¾éĹ¤Ê scan() ¤òºï½ü¡£
+       * src/imap.[ch]: Folder::add_msgs() ¤ò¼ÂÁõ¤·¡¢Â¾¤Î Folder
+         ¥¤¥ó¥¹¥¿¥ó¥¹¤«¤é¤Î°ÜÆ°¡¦¥³¥Ô¡¼¤òºÇŬ²½¡£
+       * src/mh.[ch]: Folder::add_msgs() ¤ò¼ÂÁõ¤·¡¢¥³¡¼¥É¤òÀ°Íý¡£
+         mh_fetch_msg(): É¬ÍפǤ¢¤ì¤Ð¥Õ¥©¥ë¥À¤ò¥¹¥­¥ã¥ó¡£
+       * src/procmsg.[ch]: procmsg_get_message_file_list(): ¥á¥Ã¥»¡¼¥¸¥ê¥¹¥È
+         ¤«¤é¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+       * src/summaryview.c: ºï½ü¡¦°ÜÆ°¡¦¥³¥Ô¡¼Áàºî¤Ç MSG_MARKED ¥Õ¥é¥°¤ò
+         ºï½ü¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+         summary_display_msg_full(): ¾éĹ¤Ê¥á¥Ã¥»¡¼¥¸¤Î¼èÆÀ¤òºï½ü¡£
+
+2003-07-17
+
+       * ¥³¥Þ¥ó¥É¤òȯ¹Ô¤¹¤ë¤È¤­¤Ë¥·¡¼¥±¥ó¥¹¥»¥Ã¥È¤ò»ÈÍѤ·¤Æ IMAP4 ¤Î
+         °ÜÆ°/¥³¥Ô¡¼/ºï½ü/¥Þ¡¼¥¯Áàºî¤òºÇŬ²½(claws ¤Î¼ÂÁõ¤òÀ°Íý¤·¤ÆŬÍÑ)¡£
+       * src/imap.[ch]:
+         imap_set_message_flags()
+         imap_cmd_envelope()
+         imap_cmd_copy()
+         imap_cmd_store(): UID ÈÖ¹æ¤ÎÂå¤ï¤ê¤Ë¥·¡¼¥±¥ó¥¹¥»¥Ã¥Èʸ»úÎó¤ò
+         ¼õ¤±¼è¤ë¤è¤¦¤Ë¤·¤¿¡£
+         imap_do_copy_msgs_with_dest(): ¥·¡¼¥±¥ó¥¹¥»¥Ã¥È¤ò»ÈÍѤ·¤ÆºÇŬ²½¡£
+         imap_cmd_fetch(): BODY ¤ÎÂå¤ï¤ê¤Ë BODY.PEEK ¤ò»ÈÍÑ¡£
+         imap_remove_all_msg()
+         imap_set_message_flags(): FLAGS ¤ÎÂå¤ï¤ê¤Ë FLAGS.SILENT ¤ò»ÈÍÑ¡£
+       * src/compose.c
+         src/summaryview.c: ³Æ¥á¥Ã¥»¡¼¥¸Ëè¤Ë¥³¥Þ¥ó¥É¤òȯ¹Ô¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯
+         imap_msg_list_{set,unset}_perm_flags() ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2003-07-15
 
        * src/inc.c
index cacf736..8f5309d 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=37
+EXTRA_VERSION=38
 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws${EXTRA_VERSION}
 
 dnl set $target
index 7489195..6c34156 100644 (file)
@@ -147,7 +147,7 @@ static gint session_connect_cb(SockInfo *sock, gpointer data)
 
        sock_set_nonblocking_mode(sock, session->nonblocking);
 
-       debug_print("session: connected\n");
+       debug_print("session (%p): connected\n", session);
 
        session->state = SESSION_RECV;
        session->io_tag = sock_add_watch(session->sock, G_IO_IN,
@@ -180,8 +180,6 @@ void session_destroy(Session *session)
        g_return_if_fail(session != NULL);
        g_return_if_fail(session->destroy != NULL);
 
-       debug_print("session: session_destroy()\n");
-
        session_close(session);
        session->destroy(session);
        g_free(session->server);
@@ -189,9 +187,19 @@ void session_destroy(Session *session)
        g_byte_array_free(session->read_data_buf, TRUE);
        g_free(session->read_data_terminator);
        g_free(session->write_buf);
+
+       debug_print("session (%p): destroyed\n", session);
+
        g_free(session);
 }
 
+gboolean session_is_connected(Session *session)
+{
+       return (session->state == SESSION_READY ||
+               session->state == SESSION_SEND ||
+               session->state == SESSION_RECV);
+}
+
 void session_set_recv_message_notify(Session *session,
                                     RecvMsgNotify notify_func, gpointer data)
 {
@@ -242,8 +250,6 @@ static gint session_close(Session *session)
 {
        g_return_val_if_fail(session != NULL, -1);
 
-       debug_print("session_close\n");
-
        if (session->conn_id > 0) {
                sock_connect_async_cancel(session->conn_id);
                session->conn_id = 0;
@@ -260,6 +266,8 @@ static gint session_close(Session *session)
                session->state = SESSION_DISCONNECTED;
        }
 
+       debug_print("session (%p): closed\n", session);
+
        return 0;
 }
 
@@ -429,6 +437,12 @@ static gboolean session_read_msg_cb(SockInfo *source, GIOCondition condition,
                read_len = sock_read(session->sock, session->read_buf,
                                     SESSION_BUFFSIZE - 1);
 
+               if (read_len == 0) {
+                       g_warning("sock_read: received EOF\n");
+                       session->state = SESSION_EOF;
+                       return FALSE;
+               }
+
                if (read_len < 0) {
                        switch (errno) {
                        case EAGAIN:
@@ -507,6 +521,12 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition,
                read_len = sock_read(session->sock, session->read_buf,
                                     SESSION_BUFFSIZE);
 
+               if (read_len == 0) {
+                       g_warning("sock_read: received EOF\n");
+                       session->state = SESSION_EOF;
+                       return FALSE;
+               }
+
                if (read_len < 0) {
                        switch (errno) {
                        case EAGAIN:
index 69a34a7..d747a14 100644 (file)
@@ -50,6 +50,7 @@ typedef enum {
        SESSION_READY,
        SESSION_SEND,
        SESSION_RECV,
+       SESSION_EOF,
        SESSION_ERROR,
        SESSION_DISCONNECTED
 } SessionState;
@@ -146,12 +147,13 @@ struct _Session
        gpointer send_data_notify_data;
 };
 
-void session_init      (Session        *session);
-gint session_connect   (Session        *session,
-                        const gchar    *server,
-                        gushort         port);
-gint session_disconnect        (Session        *session);
-void session_destroy   (Session        *session);
+void session_init              (Session        *session);
+gint session_connect           (Session        *session,
+                                const gchar    *server,
+                                gushort         port);
+gint session_disconnect                (Session        *session);
+void session_destroy           (Session        *session);
+gboolean session_is_connected  (Session        *session);
 
 void session_set_recv_message_notify   (Session        *session,
                                         RecvMsgNotify   notify_func,
index a3ec3c3..b7b37ea 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -575,6 +575,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                case INC_NO_SPACE:
                case INC_IO_ERROR:
                case INC_SOCKET_ERROR:
+               case INC_EOF:
                        SET_PIXMAP_AND_TEXT(errorxpm, errorxpmmask, _("Error"));
                        break;
                case INC_CANCEL:
@@ -756,8 +757,7 @@ static IncState inc_pop3_session_do(IncSession *session)
                return INC_CONNECT_ERROR;
        }
 
-       while (SESSION(pop3_session)->state != SESSION_DISCONNECTED &&
-              SESSION(pop3_session)->state != SESSION_ERROR &&
+       while (session_is_connected(SESSION(pop3_session)) &&
               session->inc_state != INC_CANCEL)
                gtk_main_iteration();
 
@@ -771,7 +771,9 @@ static IncState inc_pop3_session_do(IncSession *session)
                                        session->inc_state = INC_CONNECT_ERROR;
                                else
                                        session->inc_state = INC_ERROR;
-                       } else
+                       } else if (SESSION(pop3_session)->state == SESSION_EOF)
+                               session->inc_state = INC_EOF;
+                       else
                                session->inc_state = INC_SUCCESS;
                        break;
                case PS_AUTHFAIL:
@@ -975,51 +977,84 @@ gint inc_drop_message(const gchar *file, Pop3Session *session)
 
 static void inc_put_error(IncState istate, const gchar *msg)
 {
+       gchar *log_msg = NULL;
+       gchar *err_msg = NULL;
+       gboolean fatal_error = FALSE;
+
        switch (istate) {
        case INC_CONNECT_ERROR:
+               log_msg = _("Connection failed.");
                if (prefs_common.no_recv_err_panel)
                        break;
-               alertpanel_error(_("Connection failed."));
+               err_msg = g_strdup(log_msg);
                break;
        case INC_ERROR:
+               log_msg = _("Error occurred while processing mail.");
                if (prefs_common.no_recv_err_panel)
                        break;
                if (msg)
-                       alertpanel_error(_("Error occurred while processing mail:\n%s"), msg);
+                       err_msg = g_strdup_printf
+                               (_("Error occurred while processing mail:\n%s"),
+                                msg);
                else
-                       alertpanel_error(_("Error occurred while processing mail."));
+                       err_msg = g_strdup(log_msg);
                break;
        case INC_NO_SPACE:
-               alertpanel_error(_("No disk space left."));
+               log_msg = _("No disk space left.");
+               err_msg = g_strdup(log_msg);
+               fatal_error = TRUE;
                break;
        case INC_IO_ERROR:
-               alertpanel_error(_("Can't write file."));
+               log_msg = _("Can't write file.");
+               err_msg = g_strdup(log_msg);
+               fatal_error = TRUE;
                break;
        case INC_SOCKET_ERROR:
+               log_msg = _("Socket error.");
+               if (prefs_common.no_recv_err_panel)
+                       break;
+               err_msg = g_strdup(log_msg);
+               break;
+       case INC_EOF:
+               log_msg = _("Connection closed by the remote host.");
                if (prefs_common.no_recv_err_panel)
                        break;
-               alertpanel_error(_("Socket error."));
+               err_msg = g_strdup(log_msg);
                break;
        case INC_LOCKED:
+               log_msg = _("Mailbox is locked.");
                if (prefs_common.no_recv_err_panel)
                        break;
                if (msg)
-                       alertpanel_error(_("Mailbox is locked:\n%s"), msg);
+                       err_msg = g_strdup_printf(_("Mailbox is locked:\n%s"),
+                                                 msg);
                else
-                       alertpanel_error(_("Mailbox is locked."));
+                       err_msg = g_strdup(log_msg);
                break;
        case INC_AUTH_FAILED:
+               log_msg = _("Authentication failed.");
                if (prefs_common.no_recv_err_panel)
                        break;
                if (msg)
-                       alertpanel_error(_("Authentication failed:\n%s"),
-                                        msg);
+                       err_msg = g_strdup_printf
+                               (_("Authentication failed:\n%s"), msg);
                else
-                       alertpanel_error(_("Authentication failed."));
+                       err_msg = g_strdup(log_msg);
                break;
        default:
                break;
        }
+
+       if (log_msg) {
+               if (fatal_error)
+                       log_error("%s\n", log_msg);
+               else
+                       log_warning("%s\n", log_msg);
+       }
+       if (err_msg) {
+               alertpanel_error_log(err_msg);
+               g_free(err_msg);
+       }
 }
 
 static void inc_cancel(IncProgressDialog *dialog)
index a4477c7..bed915c 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -46,6 +46,7 @@ typedef enum
        INC_NO_SPACE,
        INC_IO_ERROR,
        INC_SOCKET_ERROR,
+       INC_EOF,
        INC_CANCEL
 } IncState;
 
index 45db745..09f8ab3 100644 (file)
@@ -409,9 +409,7 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
 
        debug_print("send_message_smtp(): begin event loop\n");
 
-       while (session->state != SESSION_DISCONNECTED &&
-              session->state != SESSION_ERROR &&
-              dialog->cancelled == FALSE)
+       while (session_is_connected(session) && dialog->cancelled == FALSE)
                gtk_main_iteration();
 
        if (SMTP_SESSION(session)->error_val == SM_AUTHFAIL) {
@@ -421,6 +419,7 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
                }
                ret = -1;
        } else if (session->state == SESSION_ERROR ||
+                  session->state == SESSION_EOF ||
                   SMTP_SESSION(session)->state == SMTP_ERROR ||
                   SMTP_SESSION(session)->error_val != SM_OK)
                ret = -1;
@@ -576,32 +575,47 @@ static void send_cancel_button_cb(GtkWidget *widget, gpointer data)
 static void send_put_error(Session *session)
 {
        gchar *msg;
+       gchar *log_msg = NULL;
+       gchar *err_msg = NULL;
 
        msg = SMTP_SESSION(session)->error_msg;
 
        switch (SMTP_SESSION(session)->error_val) {
        case SM_ERROR:
        case SM_UNRECOVERABLE:
+               log_msg = _("Error occurred while sending the message.");
                if (msg)
-                       alertpanel_error_log
+                       err_msg = g_strdup_printf
                                (_("Error occurred while sending the message:\n%s"),
                                 msg);
                else
-                       alertpanel_error_log
-                               (_("Error occurred while sending the message."));
+                       err_msg = g_strdup(log_msg);
                break;
        case SM_AUTHFAIL:
+               log_msg = _("Authentication failed.");
                if (msg)
-                       alertpanel_error_log
+                       err_msg = g_strdup_printf
                                (_("Authentication failed:\n%s"), msg);
                else
-                       alertpanel_error_log
-                               (_("Authentication failed."));
+                       err_msg = g_strdup(log_msg);
+               break;
        default:
-               if (session->state == SESSION_ERROR)
-                       alertpanel_error_log
-                               (_("Error occurred while sending the message."));
+               if (session->state == SESSION_ERROR) {
+                       log_msg =
+                               _("Error occurred while sending the message.");
+                       err_msg = g_strdup(log_msg);
+               } else if (session->state == SESSION_EOF) {
+                       log_msg = _("Connection closed by the remote host.");
+                       err_msg = g_strdup(log_msg);
+               }
                break;
        }
+
+       if (log_msg)
+               log_warning("%s\n", log_msg);
+       if (err_msg) {
+               alertpanel_error_log(err_msg);
+               g_free(err_msg);
+       }
 }