2006-03-01 [colin] 2.0.0cvs96
[claws.git] / src / inc.c
index 9907b42bcce87a879bfa8394c6447a6b92846716..e428ed04c82e29854ca6edc692b69b26321102ec 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -166,7 +166,10 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
 
        if (inc_lock_count) return;
 
-       if (prefs_common.work_offline && !inc_offline_should_override())
+       if (prefs_common.work_offline && 
+           !inc_offline_should_override(
+               _("Sylpheed-Claws needs network access in order "
+                 "to get mails.")))
                return;
 
        inc_lock();
@@ -268,7 +271,10 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account)
 
        if (inc_lock_count) return 0;
 
-       if (prefs_common.work_offline && !inc_offline_should_override())
+       if (prefs_common.work_offline && 
+           !inc_offline_should_override(
+               _("Sylpheed-Claws needs network access in order "
+                 "to get mails.")))
                return 0;
 
        inc_autocheck_timer_remove();
@@ -291,7 +297,10 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
        gint new_msgs = 0;
        gint account_new_msgs = 0;
        
-       if (prefs_common.work_offline && !inc_offline_should_override())
+       if (prefs_common.work_offline && 
+           !inc_offline_should_override(
+               _("Sylpheed-Claws needs network access in order "
+                 "to get mails.")))
                return;
 
        if (inc_lock_count) return;
@@ -637,6 +646,11 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                        if (!pop3_session->ac_prefs->filter_on_recv || 
                            !procmsg_msginfo_filter(msginfo))
                                folder_item_move_msg(inbox, msginfo);
+               }
+               filtering_move_and_copy_msgs(msglist);
+               for(msglist_element = msglist; msglist_element != NULL; 
+                   msglist_element = msglist_element->next) {
+                       MsgInfo *msginfo = (MsgInfo *)msglist_element->data;
                        procmsg_msginfo_free(msginfo);
                }
                folder_item_update_thaw();
@@ -690,18 +704,6 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
        progress_dialog_set_label(inc_dialog->dialog, fin_msg);
 
-#if 0
-       if (error_num && !prefs_common.no_recv_err_panel) {
-               if (inc_dialog->show_dialog)
-                       manage_window_focus_in(inc_dialog->dialog->window,
-                                              NULL, NULL);
-               alertpanel_error_log(_("Some errors occurred while getting mail."));
-               if (inc_dialog->show_dialog)
-                       manage_window_focus_out(inc_dialog->dialog->window,
-                                               NULL, NULL);
-       }
-#endif
-
        while (inc_dialog->queue_list != NULL) {
                session = inc_dialog->queue_list->data;
                inc_session_destroy(session);
@@ -890,17 +892,7 @@ static void inc_progress_dialog_set_label(IncProgressDialog *inc_dialog,
                break;
        case POP3_RETR:
        case POP3_RETR_RECV:
-               break;
        case POP3_DELETE:
-#if 0
-               if (session->msg[session->cur_msg].recv_time <
-                       session->current_time) {
-                       gchar buf[MSGBUFSIZE];
-                       g_snprintf(buf, sizeof(buf), _("Deleting message %d"),
-                                  session->cur_msg);
-                       progress_dialog_set_label(dialog, buf);
-               }
-#endif
                break;
        case POP3_LOGOUT:
                progress_dialog_set_label(dialog, _("Quitting"));
@@ -1424,7 +1416,7 @@ static gint inc_autocheck_func(gpointer data)
        return FALSE;
 }
 
-gboolean inc_offline_should_override(void)
+gboolean inc_offline_should_override(const gchar *msg)
 {
        static time_t overridden_yes = 0;
        static time_t overridden_no  = 0;
@@ -1439,21 +1431,23 @@ gboolean inc_offline_should_override(void)
                
                if (time(NULL) - overridden_yes < length * 60) /* seconds */
                         return TRUE;
-               else if (time(NULL) - overridden_no < length * 60) /* seconds */
+               else if (time(NULL) - overridden_no < 3) /* seconds */
                         return FALSE;
 
                tmp = g_strdup_printf(
-                               _("You're working offline. Override for %d minutes?"),
+                               _("%s%sYou're working offline. Override for %d minutes?"),
+                               msg?msg:"", 
+                               msg?"\n\n":"",
                                length);
 
                answer = alertpanel(_("Offline warning"), 
                               tmp,
-                              GTK_STOCK_YES, GTK_STOCK_NO, _("On_ly once"));
+                              GTK_STOCK_NO, "+" GTK_STOCK_YES, _("On_ly once"));
                g_free(tmp);
-               if (answer == G_ALERTDEFAULT) {
+               if (answer == G_ALERTALTERNATE) {
                        overridden_yes = time(NULL);
                        return TRUE;
-               } else if (answer == G_ALERTALTERNATE) {
+               } else if (answer == G_ALERTDEFAULT) {
                        overridden_no  = time(NULL);
                        return FALSE;
                } else {