fix check for mail at start-up
authorPaul <paul@claws-mail.org>
Thu, 8 Nov 2018 18:42:43 +0000 (18:42 +0000)
committerPaul <paul@claws-mail.org>
Thu, 8 Nov 2018 18:42:43 +0000 (18:42 +0000)
src/inc.c
src/inc.h
src/main.c
src/toolbar.c

index 78fc240..35a09d4 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -413,7 +413,7 @@ void inc_account_list_mail(MainWindow *mainwin, GList *account_list, gboolean au
 }
 
 void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
-                         gboolean notify)
+                         gboolean check_at_startup, gboolean notify)
 {
        GList *list, *list2 = NULL;
        gboolean condition;
@@ -431,11 +431,11 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
 
                /* Set up condition which decides whether or not to check
                 * this account, based on whether we're doing global autocheck
-                * or a manual 'Get all' check. */
+                * or a check at startup or a manual 'Get all' check. */
                if (autocheck)
                        condition = prefs_common_get_prefs()->autochk_newmail
                                && account->autochk_use_default;
-               else
+               else if (check_at_startup || (!check_at_startup && !autocheck))
                        condition = account->recv_at_getall;
 
                if (condition) {
@@ -1540,7 +1540,7 @@ static gint inc_autocheck_func(gpointer data)
                return FALSE;
        }
 
-       inc_all_account_mail(mainwin, TRUE, prefs_common.newmail_notify_auto);
+       inc_all_account_mail(mainwin, TRUE, FALSE, prefs_common.newmail_notify_auto);
        inc_autocheck_timer_set();
 
        return FALSE;
index b9c09f6..c440c8f 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -93,11 +93,13 @@ void inc_account_list_mail  (MainWindow     *mainwin,
                                 gboolean        notify);
 
 /* This function is used by the global autocheck interval (autocheck TRUE),
+ * or check at startup (check_at_startup TRUE)
  * or by the manual 'Receive all' feature (autocheck FALSE). It makes
  * sure correct list of accounts is marked for checking, based on
  * global and account configuration, and calls inc_account_list_mail(). */
 void inc_all_account_mail      (MainWindow     *mainwin,
                                 gboolean        autocheck,
+                                gboolean        check_at_startup,
                                 gboolean        notify);
 
 void inc_progress_update       (Pop3Session    *session);
index eff8f86..24150c8 100644 (file)
@@ -317,10 +317,13 @@ static gboolean defer_check_all(void *data)
 {
        gboolean autochk = GPOINTER_TO_INT(data);
 
-       inc_all_account_mail(static_mainwindow, autochk, 
+       inc_all_account_mail(static_mainwindow, autochk, FALSE,
                        prefs_common.newmail_notify_manu);
 
        if (sc_starting) {
+               inc_all_account_mail(static_mainwindow, FALSE,
+                               prefs_common.chk_on_startup,
+                               prefs_common.newmail_notify_manu);
                sc_starting = FALSE;
                main_window_set_menu_sensitive(static_mainwindow);
                toolbar_main_set_sensitive(static_mainwindow);
@@ -2538,7 +2541,7 @@ static void lock_socket_input_cb(gpointer data,
        } else if (!strncmp(buf, "get_display", 11)) {
                fd_write_all(sock, x_display, strlen(x_display));
        } else if (!strncmp(buf, "receive_all", 11)) {
-               inc_all_account_mail(mainwin, FALSE,
+               inc_all_account_mail(mainwin, FALSE, FALSE,
                                     prefs_common.newmail_notify_manu);
        } else if (!strncmp(buf, "receive", 7)) {
                inc_mail(mainwin, prefs_common.newmail_notify_manu);
index 4c16c47..13fce67 100644 (file)
@@ -3018,7 +3018,7 @@ void inc_all_account_mail_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MainWindow *mainwin = (MainWindow*)data;
 
-       inc_all_account_mail(mainwin, FALSE, prefs_common.newmail_notify_manu);
+       inc_all_account_mail(mainwin, FALSE, FALSE, prefs_common.newmail_notify_manu);
 }
 
 void send_queue_cb(gpointer data, guint action, GtkWidget *widget)