sync with 0.7.8 main
authorPaul Mangan <paul@claws-mail.org>
Mon, 17 Jun 2002 10:02:21 +0000 (10:02 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 17 Jun 2002 10:02:21 +0000 (10:02 +0000)
14 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
NEWS
configure.in
src/inc.c
src/inc.h
src/main.c
src/mainwindow.c
src/pop.c
src/pop.h
src/prefs_account.c
src/prefs_account.h
src/summaryview.c

index 6b7a56f..a995172 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2002-06-17
+
+       * po/zh_TW.Big5.po: fixed a mistake that caused a crash.
+
+2002-06-15
+
+       * version 0.7.8
+
+2002-06-13
+
+       * src/inc.c: inc_get_uidl_table(): fixed a bug that garbage time
+         could be inserted into the hash table.
+         inc_write_uidl_list(): a minor code cleanup.
+       * src/mainwindow.c: main_window_get_current_state():
+         make the state unexecutable on an empty folder.
+       * src/summaryview.c: summary_sort(): don't sort on an empty folder.
+       * src/pop.c: minor code cleanups.
+
+2002-06-12
+
+       * src/prefs_account.c: CREATE_RADIO_BUTTONS(): fixed a typo and
+         corrected the behavior of the radio buttons.
+
+2002-06-11
+
+       * implemented 'Delete messages after N days' feature for POP3.
+       * src/inc.[ch]:
+         inc_get_uidl_table()
+         inc_write_uidl_list(): moved the location of UIDL list file from
+         RC_DIR/uidl-* to RC_DIR/uidl/*.
+         Added received time for each UIDLs.
+         src/main.c: main(): create RC_DIR/uidl/ directory.
+         src/pop.[ch]: LOOKUP_NEXT_MSG(): delete expired messages here.
+         Added recv_time to Pop3MsgInfo.
+         src/prefs_account.[ch]: added an option for the number of days for
+         leaving messages.
+
+2002-06-09
+
+       * version 0.7.7
+
 2002-06-07
 
        * src/folder.c: folder_set_missing_folders(): fixed a bug that
index 435d37f..a9e1217 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-17 [paul]      0.7.8claws4
+
+       * sync with 0.7.8
+               see ChangeLog 2002-06-11 and 2002-06-13
+
 2002-06-16 [alfons]    0.7.8claws3
        
        * src/folder.c
index daab511..c3e2729 100644 (file)
@@ -1,3 +1,43 @@
+2002-06-17
+
+       * po/zh_TW.Big5.po: ¥¯¥é¥Ã¥·¥å¤òµ¯¤³¤¹¥ß¥¹¤ò½¤Àµ¡£
+
+2002-06-15
+
+       * version 0.7.8
+
+2002-06-13
+
+       * src/inc.c: inc_get_uidl_table(): Ìµ¸ú¤Ê»þ´Ö¤¬¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤Ë
+         ÁÞÆþ¤µ¤ì¤ë²ÄǽÀ­¤Î¤¢¤ë¥Ð¥°¤ò½¤Àµ¡£
+         inc_write_uidl_list(): ¾¯¤·¥³¡¼¥É¤òÀ°Íý¡£
+       * src/mainwindow.c: main_window_get_current_state():
+         ¶õ¥Õ¥©¥ë¥À¤Ç¤Î¾õÂÖ¤ò¼Â¹ÔÉԲĤˤ·¤¿¡£
+       * src/summaryview.c: summary_sort():
+         ¶õ¥Õ¥©¥ë¥À¤Ç¥½¡¼¥È¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+       * src/pop.c: ¾¯¤·¥³¡¼¥É¤òÀ°Íý¡£
+
+2002-06-12
+
+       * src/prefs_account.c: CREATE_RADIO_BUTTONS(): typo ¤ò½¤Àµ¤·¡¢
+         ¥é¥¸¥ª¥Ü¥¿¥ó¤ÎµóÆ°¤ò½¤Àµ¡£
+
+2002-06-11
+
+       * POP3 ¤Ç¡ÖN Æü¸å¤Ë¥á¥Ã¥»¡¼¥¸¤òºï½ü¡×µ¡Ç½¤ò¼ÂÁõ¡£
+       * src/inc.[ch]:
+         inc_get_uidl_table()
+         inc_write_uidl_list(): UIDL ¥ê¥¹¥È¥Õ¥¡¥¤¥ë¤Î°ÌÃÖ¤ò RC_DIR/uidl-*
+         ¤«¤é RC_DIR/uidl/* ¤Ë°ÜÆ°¡£³Æ UIDL ¤Ë¼õ¿®»þ¹ï¤òÄɲá£
+         src/main.c: main(): RC_DIR/uidl/ ¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¡£
+         src/pop.[ch]: LOOKUP_NEXT_MSG(): ¤³¤³¤Ç´ü¸ÂÀÚ¤ì¥á¥Ã¥»¡¼¥¸¤òºï½ü¡£
+         Pop3MsgInfo ¤Ë recv_time ¤òÄɲá£
+         src/prefs_account.[ch]: ¥á¥Ã¥»¡¼¥¸¤ò»Ä¤¹Æü¿ô¤Î¥ª¥×¥·¥ç¥ó¤òÄɲá£
+
+2002-06-09
+
+       * version 0.7.7
+
 2002-06-07
 
        * src/folder.c: folder_set_missing_folders(): ÆÃÊÌ¥Õ¥©¥ë¥À¤Î¥¿¥¤¥×
diff --git a/NEWS b/NEWS
index 54b964c..cbb24cb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,12 @@
 Changes of Sylpheed
 
+* 0.7.8
+
+    * The feature to leave messages on POP3 server for specified days has
+      been implemented.
+    * The SSL preferences which was broken at the previous version has been
+      fixed.
+
 * 0.7.7
 
     * The 'Redirect' (aka Bounce) feature has been implemented.
@@ -11,8 +18,8 @@ Changes of Sylpheed
     * The common / account preferences button has been removed from the
       toolbar.
     * Some fixes and improvements for MIME view have been made.
-    * The behavior of 'Folder tree' and 'Message view' toggle menu have been
-      fixed.
+    * The behavior of the toggle menu of 'Folder tree' and 'Message view'
+      have been fixed.
     * The behavior of address completion has been fixed.
     * A bug in the header MIME encoding routine on Japanese locale has been
       fixed.
index 78e73d9..8153df8 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws3
+EXTRA_VERSION=claws4
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index b317049..7e8e236 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
+#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -447,6 +448,7 @@ static Pop3State *inc_pop3_state_new(PrefsAccount *account)
        state->uidl_todelete_list = NULL;
        state->uidl_table = inc_get_uidl_table(account);
        state->inc_state = INC_SUCCESS;
+       state->current_time = time(NULL);
 
        return state;
 }
@@ -808,50 +810,44 @@ static GHashTable *inc_get_uidl_table(PrefsAccount *ac_prefs)
        gchar *path;
        FILE *fp;
        gchar buf[IDLEN + 3];
-       GDate curdate;
-       gchar **data;
+       gchar uidl[IDLEN + 3];
+       time_t recv_time;
+       time_t now;
 
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
-                          "uidl-", ac_prefs->recv_server,
+                          "uidl", G_DIR_SEPARATOR_S, ac_prefs->recv_server,
                           "-", ac_prefs->userid, NULL);
-                          
        if ((fp = fopen(path, "rb")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
                g_free(path);
-               return NULL;
+               path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+                                  "uidl-", ac_prefs->recv_server,
+                                  "-", ac_prefs->userid, NULL);
+               if ((fp = fopen(path, "rb")) == NULL) {
+                       if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
+                       g_free(path);
+                       return NULL;
+               }
+               g_free(path);
        }
-       g_free(path);
 
        table = g_hash_table_new(g_str_hash, g_str_equal);
 
-       g_date_clear(&curdate, 1);
-
-       /*
-        * NOTE: g_date_set_time() has to be called inside this 
-        * loop, because a day change may happen??? That right?
-        */
+       now = time(NULL);
 
        while (fgets(buf, sizeof(buf), fp) != NULL) {
                strretchomp(buf);
-               
-               /* data[0] will contain uidl
-                * data[1] will contain day of retrieval */
-
-               /* 
-                * FIXME: convoluted implementation. need to find
-                * a better way to split the string.
-                */
-               if (strchr(buf, '\t')) {
-                       data = g_strsplit(buf, "\t", 2);
-                       if (data) {
-                               g_hash_table_insert(table, g_strdup(data[0]), g_strdup(data[1]));
-                               g_strfreev(data);
-                       }       
-               } else {
-                       g_date_set_time(&curdate, time(NULL));  
-                       g_hash_table_insert(table, g_strdup(buf), 
-                                           g_strdup_printf("%d", g_date_day_of_year(&curdate)));
-               }                           
+               recv_time = 0;
+               if (sscanf(buf, "%s\t%ld", uidl, &recv_time) != 2) {
+                       if (sscanf(buf, "%s", uidl) != 1)
+                               continue;
+                       else
+                               recv_time = now;
+               }
+               if (recv_time == 0)
+                       recv_time = 1;
+               g_hash_table_insert(table, g_strdup(uidl),
+                                   GINT_TO_POINTER(recv_time));
        }
 
        fclose(fp);
@@ -862,64 +858,28 @@ static void inc_write_uidl_list(Pop3State *state)
 {
        gchar *path;
        FILE *fp;
+       Pop3MsgInfo *msg;
        gint n;
-       GDate curdate;
-       const char *sdate;
-       int tdate;
 
-       if (!state->uidl_is_valid)
-               return;
-       
+       if (!state->uidl_is_valid) return;
+
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
-                          "uidl-", state->ac_prefs->recv_server,
-                          "-", state->user, NULL);
+                          "uidl", G_DIR_SEPARATOR_S,
+                          state->ac_prefs->recv_server,
+                          "-", state->ac_prefs->userid, NULL);
        if ((fp = fopen(path, "wb")) == NULL) {
                FILE_OP_ERROR(path, "fopen");
                g_free(path);
                return;
        }
 
-       g_date_clear(&curdate, 1);
-
        for (n = 1; n <= state->count; n++) {
-               if (state->msg[n].uidl && state->msg[n].received &&
-                   !state->msg[n].deleted) {
-                       if (fputs(state->msg[n].uidl, fp) == EOF) {
-                               FILE_OP_ERROR(path, "fputs");
-                               break;
-                       }
-                       if (fputc('\t', fp) == EOF) {
-                               FILE_OP_ERROR(path, "fputc");
-                               break;
-                       }
-                       
-                       /*
-                        * NOTE: need to set time to watch for day changes??
-                        */
-                       g_date_set_time(&curdate, time(NULL));
-
-                       if (NULL != (sdate = g_hash_table_lookup(state->uidl_table, state->msg[n].uidl))) {
-                               tdate = sdate != NULL ? atoi(sdate) : g_date_day_of_year(&curdate);
-                               if (fprintf(fp, "%3d", tdate) == EOF) {
-                                       FILE_OP_ERROR(path, "fprintf");
-                                       break;
-                               }
-                       } else {
-                               if (fprintf(fp, "%d", g_date_day_of_year(&curdate)) == EOF) {
-                                       FILE_OP_ERROR(path, "fputs");
-                                       break;
-                               }
-                       }
-
-                       if (fputc('\n', fp) == EOF) {
-                               FILE_OP_ERROR(path, "fputc");
-                               break;
-                       }               
-               }
+               msg = &state->msg[n];
+               if (msg->uidl && msg->received && !msg->deleted)
+                       fprintf(fp, "%s\t%ld\n", msg->uidl, msg->recv_time);
        }
 
-       if (fclose(fp) == EOF) 
-               FILE_OP_ERROR(path, "fclose");
+       if (fclose(fp) == EOF) FILE_OP_ERROR(path, "fclose");
        g_free(path);
 }
 
@@ -1021,11 +981,13 @@ void inc_progress_update(Pop3State *state, Pop3Phase phase)
                         (gfloat)(state->cur_total_bytes) /
                         (gfloat)(state->total_bytes));
                break;
-#if 0
        case POP3_DELETE_SEND:
-               progress_dialog_set_label(dialog, _("Deleting message"));
+               if (state->msg[state->cur_msg].recv_time < state->current_time) {
+                       g_snprintf(buf, sizeof(buf), _("Deleting message %d"),
+                                  state->cur_msg);
+                       progress_dialog_set_label(dialog, buf);
+               }
                break;
-#endif
        case POP3_LOGOUT_SEND:
                progress_dialog_set_label(dialog, _("Quitting"));
                break;
index 2eaf3cd..eaead51 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -25,6 +25,7 @@
 #endif
 
 #include <glib.h>
+#include <time.h>
 
 #include "mainwindow.h"
 #include "progressdialog.h"
@@ -93,6 +94,8 @@ struct _Pop3State
        
        gboolean uidl_is_valid;
 
+       time_t current_time;
+
        gint error_val;
        IncState inc_state;
 
index eb03b16..b51eeda 100644 (file)
@@ -211,6 +211,7 @@ int main(int argc, char *argv[])
        MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir());
        MAKE_DIR_IF_NOT_EXIST(get_news_cache_dir());
        MAKE_DIR_IF_NOT_EXIST(get_mime_tmp_dir());
+       MAKE_DIR_IF_NOT_EXIST(RC_DIR G_DIR_SEPARATOR_S "uidl");
 
        if (is_file_exist(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log")) {
                if (rename(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log",
index 5d903eb..2a1c24b 100644 (file)
@@ -1559,7 +1559,7 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_UNLOCKED;
        if (selection != SUMMARY_NONE)
                state |= M_MSG_EXIST;
-       if (item) {
+       if (item && item->path && item->parent && !item->no_select) {
                state |= M_EXEC;
                if (item->threaded)
                        state |= M_THREADED;
@@ -1681,7 +1681,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/File/Exit" , M_UNLOCKED},
 
                {"/Edit/Select thread"             , M_SINGLE_TARGET_EXIST},
-               {"/View/Sort"                      , M_MSG_EXIST},
+               {"/View/Sort"                      , M_EXEC},
                {"/View/Thread view"               , M_EXEC},
                {"/View/Expand all threads"        , M_MSG_EXIST},
                {"/View/Collapse all threads"      , M_MSG_EXIST},
index e932652..a3e50fb 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -27,6 +27,7 @@
 #include <stdarg.h>
 #include <ctype.h>
 #include <unistd.h>
+#include <time.h>
 
 #include "intl.h"
 #include "pop.h"
 #  include "ssl.h"
 #endif
 
-#define LOOKUP_NEXT_MSG() \
-       for (;;) { \
-               gint size = state->msg[state->cur_msg].size; \
-               gboolean size_limit_over = \
-                   (state->ac_prefs->enable_size_limit && \
-                    state->ac_prefs->size_limit > 0 && \
-                    size > state->ac_prefs->size_limit * 1024); \
- \
-               if (size_limit_over) \
-                       log_print(_("POP3: Skipping message %d (%d bytes)\n"), \
-                                 state->cur_msg, size); \
- \
-               if (size == 0 || state->msg[state->cur_msg].received || \
-                   size_limit_over) { \
-                       if (size > 0) \
-                               state->cur_total_bytes += size; \
-                       if (state->cur_msg == state->count) \
-                               return POP3_LOGOUT_SEND; \
-                       else \
-                               state->cur_msg++; \
-               } else \
-                       break; \
-       }
+#define LOOKUP_NEXT_MSG()                                                      \
+{                                                                              \
+       Pop3MsgInfo *msg;                                                       \
+       PrefsAccount *ac = state->ac_prefs;                                     \
+       gint size;                                                              \
+       gboolean size_limit_over;                                               \
+                                                                               \
+       for (;;) {                                                              \
+               msg = &state->msg[state->cur_msg];                              \
+               size = msg->size;                                               \
+               size_limit_over =                                               \
+                   (ac->enable_size_limit &&                                   \
+                    ac->size_limit > 0 &&                                      \
+                    size > ac->size_limit * 1024);                             \
+                                                                               \
+               if (ac->rmmail &&                                               \
+                   msg->recv_time != 0 &&                                      \
+                   state->current_time - msg->recv_time >=                     \
+                   ac->msg_leave_time * 24 * 60 * 60) {                        \
+                       log_print(_("POP3: Deleting expired message %d\n"),     \
+                                 state->cur_msg);                              \
+                       return POP3_DELETE_SEND;                                \
+               }                                                               \
+                                                                               \
+               if (size_limit_over)                                            \
+                       log_print(_("POP3: Skipping message %d (%d bytes)\n"),  \
+                                 state->cur_msg, size);                        \
+                                                                               \
+               if (size == 0 || msg->received || size_limit_over) {            \
+                       state->cur_total_bytes += size;                         \
+                       if (state->cur_msg == state->count)                     \
+                               return POP3_LOGOUT_SEND;                        \
+                       else                                                    \
+                               state->cur_msg++;                               \
+               } else                                                          \
+                       break;                                                  \
+       }                                                                       \
+}
 
 static gint pop3_ok(SockInfo *sock, gchar *argbuf);
 static void pop3_gen_send(SockInfo *sock, const gchar *format, ...);
@@ -79,16 +95,14 @@ gint pop3_greeting_recv(SockInfo *sock, gpointer data)
        gchar buf[POPBUFSIZE];
 
        if (pop3_ok(sock, buf) == PS_SUCCESS) {
+               state->greeting = g_strdup(buf);
 #if USE_SSL
-               if (state->ac_prefs->ssl_pop == SSL_STARTTLS) {
-                       state->greeting = g_strdup(buf);
+               if (state->ac_prefs->ssl_pop == SSL_STARTTLS)
                        return POP3_STLS_SEND;
-               }
 #endif
-               if (state->ac_prefs->protocol == A_APOP) {
-                       state->greeting = g_strdup(buf);
+               if (state->ac_prefs->protocol == A_APOP)
                        return POP3_GETAUTH_APOP_SEND;
-               else
+               else
                        return POP3_GETAUTH_USER_SEND;
        } else
                return -1;
@@ -110,9 +124,9 @@ gint pop3_stls_recv(SockInfo *sock, gpointer data)
        if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
                if (!ssl_init_socket_with_method(sock, SSL_METHOD_TLSv1))
                        return -1;
-               if (state->ac_prefs->protocol == A_APOP) {
+               if (state->ac_prefs->protocol == A_APOP)
                        return POP3_GETAUTH_APOP_SEND;
-               else
+               else
                        return POP3_GETAUTH_USER_SEND;
        } else if (ok == PS_PROTOCOL) {
                log_warning(_("can't start TLS session\n"));
@@ -164,9 +178,8 @@ gint pop3_getauth_pass_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
-       if (pop3_ok(sock, NULL) == PS_SUCCESS) 
+       if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return POP3_GETRANGE_STAT_SEND;
-       
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
@@ -211,9 +224,8 @@ gint pop3_getauth_apop_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
-       if (pop3_ok(sock, NULL) == PS_SUCCESS) 
+       if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return POP3_GETRANGE_STAT_SEND;
-
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
@@ -304,7 +316,8 @@ gint pop3_getrange_uidl_recv(SockInfo *sock, gpointer data)
        gint next_state;
 
        if (!state->uidl_table) new = TRUE;
-       if (state->ac_prefs->getall)
+       if (state->ac_prefs->getall ||
+           (state->ac_prefs->rmmail && state->ac_prefs->msg_leave_time == 0))
                get_all = TRUE;
 
        if (pop3_ok(sock, NULL) != PS_SUCCESS) {
@@ -320,6 +333,7 @@ gint pop3_getrange_uidl_recv(SockInfo *sock, gpointer data)
 
        while (sock_gets(sock, buf, sizeof(buf)) >= 0) {
                gint num;
+               time_t recv_time;
 
                if (buf[0] == '.') break;
                if (sscanf(buf, "%d %" Xstr(IDLEN) "s", &num, id) != 2)
@@ -328,18 +342,19 @@ gint pop3_getrange_uidl_recv(SockInfo *sock, gpointer data)
 
                state->msg[num].uidl = g_strdup(id);
 
-               if (state->uidl_table) {
-                       if (!get_all &&
-                           g_hash_table_lookup(state->uidl_table, id) != NULL)
-                               state->msg[num].received = TRUE;
-                       else {
-                               if (new == FALSE) {
-                                       state->cur_msg = num;
-                                       new = TRUE;
-                               }
-                       }
-               }
+               if (!state->uidl_table) continue;
+
+               recv_time = (time_t)g_hash_table_lookup(state->uidl_table, id);
+               state->msg[num].recv_time = recv_time;
+
+               if (!get_all && recv_time != 0)
+                       state->msg[num].received = TRUE;
 
+               if (new == FALSE &&
+                   (get_all || recv_time == 0 || state->ac_prefs->rmmail)) {
+                       state->cur_msg = num;
+                       new = TRUE;
+               }
                if (should_delete(buf, (Pop3State *) state))
                        state->uidl_todelete_list = g_slist_append
                                        (state->uidl_todelete_list, g_strdup(buf));             
@@ -380,7 +395,7 @@ static gboolean should_delete(const char *uidl, gpointer data)
 
        if (NULL != (sdate = g_hash_table_lookup(state->uidl_table, answer[1]))) {
                tdate    = atoi(sdate);
-               keep_for = atoi(state->ac_prefs->leave_time); /* FIXME: leave time should be an int */
+               keep_for = atoi(state->ac_prefs->msg_leave_time); /* FIXME: leave time should be an int */
 
                g_date_clear(&curdate, 1);
                g_date_set_time(&curdate, time(NULL));
@@ -490,8 +505,6 @@ gint pop3_retr_recv(SockInfo *sock, gpointer data)
        const gchar *file;
        gint ok, drop_ok;
        gint next_state;
-       int keep_for;
-       
        if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
                if (recv_write_to_file(sock, (file = get_tmp_file())) < 0) {
                        if (state->inc_state == INC_SUCCESS)
@@ -510,14 +523,13 @@ gint pop3_retr_recv(SockInfo *sock, gpointer data)
                state->cur_total_bytes += state->msg[state->cur_msg].size;
                state->cur_total_num++;
 
-               keep_for = (state->ac_prefs && state->ac_prefs->leave_time) ? 
-                          atoi(state->ac_prefs->leave_time) : 0;
+               state->msg[state->cur_msg].received = TRUE;
+               state->msg[state->cur_msg].recv_time = state->current_time;
 
-               if (drop_ok == 0 && state->ac_prefs->rmmail && keep_for == 0)
+               if (state->ac_prefs->rmmail &&
+                   state->ac_prefs->msg_leave_time == 0)
                        return POP3_DELETE_SEND;
 
-               state->msg[state->cur_msg].received = TRUE;
-
                if (state->cur_msg < state->count) {
                        state->cur_msg++;
                        LOOKUP_NEXT_MSG();
index 0b785c4..25f1557 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -25,6 +25,7 @@
 #endif
 
 #include <glib.h>
+#include <time.h>
 
 #include "socket.h"
 
@@ -66,6 +67,7 @@ struct _Pop3MsgInfo
 {
        gint size;
        gchar *uidl;
+       time_t recv_time;
        guint received : 1;
        guint deleted  : 1;
 };
index d837534..0907b9c 100644 (file)
@@ -267,8 +267,8 @@ static PrefParam param[] = {
        {"remove_mail", "TRUE", &tmp_ac_prefs.rmmail, P_BOOL,
         &receive.rmmail_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
-       
-       {"leave_mail_time", "0", &tmp_ac_prefs.leave_time, P_STRING,
+
+       {"message_leave_time", "0", &tmp_ac_prefs.msg_leave_time, P_INT,
         &receive.leave_time_entry,
         prefs_set_data_from_entry, prefs_set_entry},
 
@@ -1040,6 +1040,9 @@ static void prefs_account_receive_create(void)
        GtkWidget *frame1;
        GtkWidget *vbox2;
        GtkWidget *rmmail_chkbtn;
+       GtkWidget *hbox_spc;
+       GtkWidget *leave_time_label;
+       GtkWidget *leave_time_entry;
        GtkWidget *getall_chkbtn;
        GtkWidget *hbox1;
        GtkWidget *size_limit_chkbtn;
@@ -1052,9 +1055,6 @@ static void prefs_account_receive_create(void)
        GtkWidget *hbox2;
        GtkWidget *inbox_label;
        GtkWidget *inbox_entry;
-       GtkWidget *leave_time_entry;
-       GtkWidget *leave_time_label;
-       GtkWidget *leave_time_hint;     
        GtkWidget *inbox_btn;
        GtkWidget *recvatgetall_chkbtn;
 
@@ -1070,26 +1070,50 @@ static void prefs_account_receive_create(void)
        gtk_container_add (GTK_CONTAINER (frame1), vbox2);
        gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
-       hbox2 = gtk_hbox_new (FALSE, 0);
-       gtk_widget_show (hbox2);
-       gtk_container_add (GTK_CONTAINER (vbox2), hbox2);
-       gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
+       PACK_CHECK_BUTTON (vbox2, rmmail_chkbtn,
+                          _("Remove messages on server when received"));
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       leave_time_label = gtk_label_new (_("Remove after"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
 
-       PACK_CHECK_BUTTON (hbox2, rmmail_chkbtn,
-                          _("Remove messages on server when received for "));
        leave_time_entry = gtk_entry_new ();
        gtk_widget_show (leave_time_entry);
-       gtk_widget_set_usize (leave_time_entry, DEFAULT_ENTRY_WIDTH, -1);
-       gtk_box_pack_start (GTK_BOX (hbox2), leave_time_entry, TRUE, TRUE, 0);
-       
-       leave_time_label = gtk_label_new (_(" days"));
+       gtk_widget_set_usize (leave_time_entry, 64, -1);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_entry, FALSE, FALSE, 0);
+
+       leave_time_label = gtk_label_new (_("days"));
        gtk_widget_show (leave_time_label);
-       gtk_box_pack_start (GTK_BOX (hbox2), leave_time_label, FALSE, FALSE, 0);
-       
-       leave_time_hint=gtk_label_new (_("(Setting to 0 days will delete messages immediately)"));
-       gtk_widget_show(leave_time_hint);
-       gtk_box_pack_start (GTK_BOX (vbox2), leave_time_hint, FALSE, FALSE, 0);
-               
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
+
+       SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1);
+
+       PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       leave_time_label = gtk_label_new (_("(0 days: remove immediately)"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
+
+       SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1);
+
        PACK_CHECK_BUTTON (vbox2, getall_chkbtn,
                           _("Download all messages on server"));
        PACK_CHECK_BUTTON (vbox2, sd_filter_on_recv_chkbtn,
@@ -1244,7 +1268,7 @@ static void prefs_account_send_create(void)
        hbox_spc = gtk_hbox_new (FALSE, 0);
        gtk_widget_show (hbox_spc);
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
-       gtk_widget_set_usize (hbox_spc, 16, -1);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
 
        label = gtk_label_new (_("User ID"));
        gtk_widget_show (label);
@@ -1274,7 +1298,7 @@ static void prefs_account_send_create(void)
        hbox_spc = gtk_hbox_new (FALSE, 0);
        gtk_widget_show (hbox_spc);
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
-       gtk_widget_set_usize (hbox_spc, 16, -1);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
 
        label = gtk_label_new
                (_("If you leave these entries empty, the same\n"
index 1268263..8e76480 100644 (file)
@@ -99,7 +99,7 @@ struct _PrefsAccount
 
        /* Receive */
        gboolean rmmail;
-       gchar *leave_time;      
+       gint msg_leave_time;
        gboolean getall;
        gboolean recv_at_getall;
        gboolean sd_rmmail_on_download;
index 4f8538e..f591f39 100644 (file)
@@ -1881,7 +1881,7 @@ void summary_sort(SummaryView *summaryview,
        GtkCListCompareFunc cmp_func;
        FolderItem *item = summaryview->folder_item;
 
-       if (!item) return;
+       if (!item || !item->path || !item->parent || item->no_select) return;
 
        switch (sort_key) {
        case SORT_BY_MARK: