Added work offline availability.
[claws.git] / src / inc.c
index 37c459f075efab97444e1a61ec8bb3215a0420ed..de6183bc6bd3a82e28e485f59a74110ee08466ab 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -145,7 +145,7 @@ static void inc_finished(MainWindow *mainwin, gboolean new_messages)
 
        if (prefs_common.open_inbox_on_inc) {
                item = cur_account && cur_account->inbox
-                       ? folder_find_item_from_path(cur_account->inbox)
+                       ? folder_find_item_from_identifier(cur_account->inbox)
                        : folder_get_default_inbox();
                if (FOLDER_SUMMARY_MISMATCH(item, mainwin->summaryview)) {      
                        folderview_unselect(mainwin->folderview);
@@ -166,6 +166,12 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
 
        if (inc_lock_count) return;
 
+       if (prefs_common.work_offline)
+               if (alertpanel(_("Offline warning"), 
+                              _("You're working offline. Override?"),
+                              _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+               return;
+
        inc_autocheck_timer_remove();
        summary_write_cache(mainwin->summaryview);
        main_window_lock(mainwin);
@@ -249,6 +255,12 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean notify)
        GList *list, *queue_list = NULL;
        IncProgressDialog *inc_dialog;
        gint new_msgs = 0;
+       
+       if (prefs_common.work_offline)
+               if (alertpanel(_("Offline warning"), 
+                              _("You're working offline. Override?"),
+                              _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+               return;
 
        if (inc_lock_count) return;
 
@@ -1016,7 +1028,8 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
        /* CLAWS: get default inbox (perhaps per account) */
        if (state->ac_prefs->inbox) {
                /* CLAWS: get destination folder / mailbox */
-               inbox = folder_find_item_from_identifier(state->ac_prefs->inbox);
+               inbox = folder_find_item_from_identifier
+                       (state->ac_prefs->inbox);
                if (!inbox)
                        inbox = folder_get_default_inbox();
        } else
@@ -1241,7 +1254,7 @@ static void inc_notify_cmd(gint new_msgs, gboolean notify)
        else
                buf = g_strdup(prefs_common.newmail_notify_cmd);
 
-       system(buf);
+       execute_command_line(buf, TRUE);
 
        g_free(buf);
 }
@@ -1255,8 +1268,10 @@ void inc_autocheck_timer_init(MainWindow *mainwin)
 static void inc_autocheck_timer_set_interval(guint interval)
 {
        inc_autocheck_timer_remove();
-
-       if (prefs_common.autochk_newmail && autocheck_data) {
+       /* last test is to avoid re-enabling auto_check after modifying 
+          the common preferences */
+       if (prefs_common.autochk_newmail && autocheck_data
+           && prefs_common.work_offline == FALSE) {
                autocheck_timer = gtk_timeout_add
                        (interval, inc_autocheck_func, autocheck_data);
                debug_print("added timer = %d\n", autocheck_timer);