[Commits] [SCM] claws branch, master, updated. 3.16.0-247-g4fe990a

ticho at claws-mail.org ticho at claws-mail.org
Wed Jul 25 18:06:51 CEST 2018


The branch, master has been updated
       via  4fe990adffb69da201234e96134b432d00f6e9cb (commit)
      from  5513d4e1ce94cb67764588a0d2d9769a3cd3d758 (commit)

Summary of changes:
 src/inc.c        |   25 ++++++++++++++++---------
 src/inc.h        |    2 ++
 src/mainwindow.c |    2 ++
 3 files changed, 20 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit 4fe990adffb69da201234e96134b432d00f6e9cb
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jul 15 19:35:06 2018 +0200

    When switching to/from offline mode, reset override timers.
    
    Closes bug #4056: Impossible to disable overriding of offline mode

diff --git a/src/inc.c b/src/inc.c
index d7a4fc5..2415e46 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -65,6 +65,9 @@ extern SessionStats session_stats;
 
 static GList *inc_dialog_list = NULL;
 
+static time_t inc_offline_overridden_yes = 0;
+static time_t inc_offline_overridden_no  = 0;
+
 guint inc_lock_count = 0;
 
 static GdkPixbuf *currentpix;
@@ -1593,8 +1596,6 @@ void inc_account_autocheck_timer_set_interval(PrefsAccount *account)
 
 gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg)
 {
-	static time_t overridden_yes = 0;
-	static time_t overridden_no  = 0;
 	int length = 10; /* minutes */
 	gint answer = G_ALERTDEFAULT;
 
@@ -1608,15 +1609,15 @@ gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg)
 		length = prefs_common.autochk_itv; /* minutes */
 
 	if (force_ask) {
-		overridden_no = (time_t)0;
+		inc_offline_overridden_no = (time_t)0;
 	}
 
 	if (prefs_common.work_offline) {
 		gchar *tmp = NULL;
 		
-		if (time(NULL) - overridden_yes < length * 60) /* seconds */
+		if (time(NULL) - inc_offline_overridden_yes < length * 60) /* seconds */
 			 return TRUE;
-		else if (time(NULL) - overridden_no < length * 60) /* seconds */
+		else if (time(NULL) - inc_offline_overridden_no < length * 60) /* seconds */
 			 return FALSE;
 
 		if (!force_ask)
@@ -1637,17 +1638,23 @@ gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg)
 				!force_ask? _("On_ly once"):NULL, ALERTFOCUS_SECOND);
 		g_free(tmp);
 		if (answer == G_ALERTALTERNATE) {
-			overridden_yes = time(NULL);
+			inc_offline_overridden_yes = time(NULL);
 			return TRUE;
 		} else if (answer == G_ALERTDEFAULT) {
 			if (!force_ask)
-				overridden_no  = time(NULL);
+				inc_offline_overridden_no  = time(NULL);
 			return FALSE;
 		} else {
-			overridden_yes = (time_t)0;
-			overridden_no  = (time_t)0;
+			inc_reset_offline_override_timers();
 			return TRUE;
 		}
 	}
 	return TRUE;
 }
+
+void inc_reset_offline_override_timers()
+{
+	debug_print("resetting offline override timers\n");
+	inc_offline_overridden_yes = (time_t)0;
+	inc_offline_overridden_no  = (time_t)0;
+}
diff --git a/src/inc.h b/src/inc.h
index 0f91f9b..b9c09f6 100644
--- a/src/inc.h
+++ b/src/inc.h
@@ -130,4 +130,6 @@ gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg);
 void inc_account_autocheck_timer_remove(PrefsAccount *account);
 void inc_account_autocheck_timer_set_interval(PrefsAccount *account);
 
+void inc_reset_offline_override_timers();
+
 #endif /* __INC_H__ */
diff --git a/src/mainwindow.c b/src/mainwindow.c
index ae30619..3762981 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4211,6 +4211,8 @@ void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
 		online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
 	offline_ask_sync = TRUE;
 
+	inc_reset_offline_override_timers();
+
 	switching = FALSE;
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list