diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 17b4d36..a104722 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -13,6 +13,7 @@ offlineimap (3.99.15) unstable; urgency=low * Made OfflineIMAP IPv6-aware. Used the short patch from Adriaan Peeters in Debian bug report 186636. Closes: #186636. + * autorefresh may now be a floating-point value. Closes: #190060. -- John Goerzen Mon, 28 Apr 2003 14:00:32 -0500 diff --git a/offlineimap/head/offlineimap.conf b/offlineimap/head/offlineimap.conf index efb215c..c69c362 100644 --- a/offlineimap/head/offlineimap.conf +++ b/offlineimap/head/offlineimap.conf @@ -160,7 +160,8 @@ remoterepository = RemoteExample # You can have offlineimap continue running indefinately, automatically # syncing your mail periodically. If you want that, specify how -# frequently to do that (in minutes) here. +# frequently to do that (in minutes) here. You can also specify +# fractional minutes (ie, 3.25). # autorefresh = 5 diff --git a/offlineimap/head/offlineimap/CustomConfig.py b/offlineimap/head/offlineimap/CustomConfig.py index 9e03682..155b5d2 100644 --- a/offlineimap/head/offlineimap/CustomConfig.py +++ b/offlineimap/head/offlineimap/CustomConfig.py @@ -34,6 +34,12 @@ class CustomConfigParser(ConfigParser): else: return default + def getdefaultfloat(self, section, option, default, *args, **kwargs): + if self.has_option(section, option): + return apply(self.getfloat, [section, option] + list(args), kwargs) + else: + return default + def getdefaultboolean(self, section, option, default, *args, **kwargs): if self.has_option(section, option): return apply(self.getboolean, [section, option] + list(args), @@ -91,3 +97,8 @@ class ConfigHelperMixin: self.getconfig().getdefaultint, self.getconfig().getint) + def getconffloat(self, option, default = CustomConfigDefault): + return self._confighelper_runner(option, default, + self.getconfig().getdefaultfloat, + self.getconfig().getfloat) + diff --git a/offlineimap/head/offlineimap/accounts.py b/offlineimap/head/offlineimap/accounts.py index 168a092..348d151 100644 --- a/offlineimap/head/offlineimap/accounts.py +++ b/offlineimap/head/offlineimap/accounts.py @@ -43,8 +43,8 @@ class Account(CustomConfig.ConfigHelperMixin): self.metadatadir = config.getmetadatadir() self.localeval = config.getlocaleval() self.ui = UIBase.getglobalui() - self.refreshperiod = self.getconfint('autorefresh', 0) - if self.refreshperiod == 0: + self.refreshperiod = self.getconffloat('autorefresh', 0.0) + if self.refreshperiod == 0.0: self.refreshperiod = None def getlocaleval(self): @@ -79,7 +79,7 @@ class Account(CustomConfig.ConfigHelperMixin): for item in kaobjs: item.startkeepalive() - refreshperiod = self.refreshperiod * 60 + refreshperiod = int(self.refreshperiod * 60) sleepresult = self.ui.sleep(refreshperiod) if sleepresult == 2: # Cancel keep-alive, but don't bother terminating threads